@ParametersAreNonnullByDefault public final class KafkaMessageFactory extends Object
MessageReader
and MessageWriter for Kafka Producer and Consumer.| Modifier and Type | Method and Description |
|---|---|
static <K> MessageReader |
createReader(org.apache.kafka.clients.consumer.ConsumerRecord<K,byte[]> record)
Create a
MessageReader to read ConsumerRecord |
static MessageReader |
createReader(org.apache.kafka.common.header.Headers headers,
byte[] payload) |
static MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<Void,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<Void,byte[]>> |
createWriter(String topic) |
static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> |
createWriter(String topic,
Integer partition,
K key) |
static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> |
createWriter(String topic,
Integer partition,
Long timestamp,
K key)
Create a
MessageWriter to write a ProducerRecord |
static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> |
createWriter(String topic,
K key) |
public static <K> MessageReader createReader(org.apache.kafka.clients.consumer.ConsumerRecord<K,byte[]> record) throws IllegalArgumentException
MessageReader to read ConsumerRecordK - the type of the record keyrecord - the record to convert to MessageReaderMessageReaderIllegalArgumentExceptionpublic static MessageReader createReader(org.apache.kafka.common.header.Headers headers, byte[] payload) throws IllegalArgumentException
IllegalArgumentExceptioncreateReader(ConsumerRecord)public static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> createWriter(String topic, Integer partition, Long timestamp, K key)
MessageWriter to write a ProducerRecordK - the key typetopic - the topic where to write the recordpartition - the partition where to write the recordtimestamp - the timestamp of the recordkey - the key of the recordMessageWriterpublic static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> createWriter(String topic, Integer partition, K key)
public static <K> MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<K,byte[]>> createWriter(String topic, K key)
public static MessageWriter<io.cloudevents.rw.CloudEventWriter<org.apache.kafka.clients.producer.ProducerRecord<Void,byte[]>>,org.apache.kafka.clients.producer.ProducerRecord<Void,byte[]>> createWriter(String topic)
Copyright © 2020. All rights reserved.