Package cz.o2.proxima.direct.io.kafka
Class KafkaStreamElement.KafkaStreamElementSerializer
- java.lang.Object
-
- cz.o2.proxima.direct.io.kafka.KafkaStreamElement.KafkaStreamElementSerializer
-
- All Implemented Interfaces:
ElementSerializer<java.lang.String,byte[]>,java.io.Serializable
- Enclosing class:
- KafkaStreamElement
public static class KafkaStreamElement.KafkaStreamElementSerializer extends java.lang.Object implements ElementSerializer<java.lang.String,byte[]>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KafkaStreamElementSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.kafka.common.serialization.Serde<java.lang.String>keySerde()RetrieveSerdefor type K.StreamElementread(org.apache.kafka.clients.consumer.ConsumerRecord<java.lang.String,byte[]> record, EntityDescriptor entityDesc)Parse the raw bytes from Kafka and return aStreamElement.booleanstoresSequentialId()org.apache.kafka.common.serialization.Serde<byte[]>valueSerde()RetrieveSerdefor type V.org.apache.kafka.clients.producer.ProducerRecord<java.lang.String,byte[]>write(java.lang.String topic, int partition, StreamElement data)ConvertStreamElementintoProducerRecord.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cz.o2.proxima.direct.io.kafka.ElementSerializer
setup
-
-
-
-
Method Detail
-
read
@Nullable public StreamElement read(org.apache.kafka.clients.consumer.ConsumerRecord<java.lang.String,byte[]> record, EntityDescriptor entityDesc)
Description copied from interface:ElementSerializerParse the raw bytes from Kafka and return aStreamElement.- Specified by:
readin interfaceElementSerializer<java.lang.String,byte[]>- Parameters:
record- aConsumerRecordto be parsedentityDesc- descriptor of entity being read- Returns:
- the
StreamElementor null on parse error
-
write
public org.apache.kafka.clients.producer.ProducerRecord<java.lang.String,byte[]> write(java.lang.String topic, int partition, StreamElement data)Description copied from interface:ElementSerializerConvertStreamElementintoProducerRecord.- Specified by:
writein interfaceElementSerializer<java.lang.String,byte[]>- Parameters:
topic- the target topicpartition- the target partitiondata- theStreamElementto convert- Returns:
- the
ProducerRecordto write to Kafka
-
keySerde
public org.apache.kafka.common.serialization.Serde<java.lang.String> keySerde()
Description copied from interface:ElementSerializerRetrieveSerdefor type K.- Specified by:
keySerdein interfaceElementSerializer<java.lang.String,byte[]>- Returns:
Serdefor key
-
valueSerde
public org.apache.kafka.common.serialization.Serde<byte[]> valueSerde()
Description copied from interface:ElementSerializerRetrieveSerdefor type V.- Specified by:
valueSerdein interfaceElementSerializer<java.lang.String,byte[]>- Returns:
Serdefor value
-
storesSequentialId
public boolean storesSequentialId()
- Specified by:
storesSequentialIdin interfaceElementSerializer<java.lang.String,byte[]>- Returns:
trueif this serializer reads and writes sequential IDs ofStreamElement(if any).
-
-