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()
RetrieveSerde
for type K.StreamElement
read(org.apache.kafka.clients.consumer.ConsumerRecord<java.lang.String,byte[]> record, EntityDescriptor entityDesc)
Parse the raw bytes from Kafka and return aStreamElement
.boolean
storesSequentialId()
org.apache.kafka.common.serialization.Serde<byte[]>
valueSerde()
RetrieveSerde
for type V.org.apache.kafka.clients.producer.ProducerRecord<java.lang.String,byte[]>
write(java.lang.String topic, int partition, StreamElement data)
ConvertStreamElement
intoProducerRecord
.-
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:ElementSerializer
Parse the raw bytes from Kafka and return aStreamElement
.- Specified by:
read
in interfaceElementSerializer<java.lang.String,byte[]>
- Parameters:
record
- aConsumerRecord
to be parsedentityDesc
- descriptor of entity being read- Returns:
- the
StreamElement
or 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:ElementSerializer
ConvertStreamElement
intoProducerRecord
.- Specified by:
write
in interfaceElementSerializer<java.lang.String,byte[]>
- Parameters:
topic
- the target topicpartition
- the target partitiondata
- theStreamElement
to convert- Returns:
- the
ProducerRecord
to write to Kafka
-
keySerde
public org.apache.kafka.common.serialization.Serde<java.lang.String> keySerde()
Description copied from interface:ElementSerializer
RetrieveSerde
for type K.- Specified by:
keySerde
in interfaceElementSerializer<java.lang.String,byte[]>
- Returns:
Serde
for key
-
valueSerde
public org.apache.kafka.common.serialization.Serde<byte[]> valueSerde()
Description copied from interface:ElementSerializer
RetrieveSerde
for type V.- Specified by:
valueSerde
in interfaceElementSerializer<java.lang.String,byte[]>
- Returns:
Serde
for value
-
storesSequentialId
public boolean storesSequentialId()
- Specified by:
storesSequentialId
in interfaceElementSerializer<java.lang.String,byte[]>
- Returns:
true
if this serializer reads and writes sequential IDs ofStreamElement
(if any).
-
-