Class ValueAsStringSerializer
- java.lang.Object
-
- cz.o2.proxima.direct.io.kafka.serializer.ValueAsStringSerializer
-
- All Implemented Interfaces:
ElementSerializer<java.lang.Void,java.lang.String>
,java.io.Serializable
public class ValueAsStringSerializer extends java.lang.Object implements ElementSerializer<java.lang.Void,java.lang.String>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueAsStringSerializer(UnaryFunction<EntityDescriptor,AttributeDescriptor<java.lang.String>> readAttributeFn)
protected
ValueAsStringSerializer(java.lang.String attrName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.kafka.common.serialization.Serde<java.lang.Void>
keySerde()
RetrieveSerde
for type K.StreamElement
read(org.apache.kafka.clients.consumer.ConsumerRecord<java.lang.Void,java.lang.String> consumerRecord, EntityDescriptor entityDescriptor)
Parse the raw bytes from Kafka and return aStreamElement
.void
setup(EntityDescriptor entityDescriptor)
Life-cycle method called after being instantiated to be able to parameterize itself from the givenEntityDescriptor
.org.apache.kafka.common.serialization.Serde<java.lang.String>
valueSerde()
RetrieveSerde
for type V.org.apache.kafka.clients.producer.ProducerRecord<java.lang.Void,java.lang.String>
write(java.lang.String topic, int partition, StreamElement streamElement)
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
storesSequentialId
-
-
-
-
Constructor Detail
-
ValueAsStringSerializer
protected ValueAsStringSerializer(java.lang.String attrName)
-
ValueAsStringSerializer
protected ValueAsStringSerializer(UnaryFunction<EntityDescriptor,AttributeDescriptor<java.lang.String>> readAttributeFn)
-
-
Method Detail
-
setup
public void setup(EntityDescriptor entityDescriptor)
Description copied from interface:ElementSerializer
Life-cycle method called after being instantiated to be able to parameterize itself from the givenEntityDescriptor
.- Specified by:
setup
in interfaceElementSerializer<java.lang.Void,java.lang.String>
- Parameters:
entityDescriptor
- the entity that this serializer will be used for
-
read
@Nullable public StreamElement read(org.apache.kafka.clients.consumer.ConsumerRecord<java.lang.Void,java.lang.String> consumerRecord, EntityDescriptor entityDescriptor)
Description copied from interface:ElementSerializer
Parse the raw bytes from Kafka and return aStreamElement
.- Specified by:
read
in interfaceElementSerializer<java.lang.Void,java.lang.String>
- Parameters:
consumerRecord
- aConsumerRecord
to be parsedentityDescriptor
- descriptor of entity being read- Returns:
- the
StreamElement
or null on parse error
-
write
public org.apache.kafka.clients.producer.ProducerRecord<java.lang.Void,java.lang.String> write(java.lang.String topic, int partition, StreamElement streamElement)
Description copied from interface:ElementSerializer
ConvertStreamElement
intoProducerRecord
.- Specified by:
write
in interfaceElementSerializer<java.lang.Void,java.lang.String>
- Parameters:
topic
- the target topicpartition
- the target partitionstreamElement
- theStreamElement
to convert- Returns:
- the
ProducerRecord
to write to Kafka
-
keySerde
public org.apache.kafka.common.serialization.Serde<java.lang.Void> keySerde()
Description copied from interface:ElementSerializer
RetrieveSerde
for type K.- Specified by:
keySerde
in interfaceElementSerializer<java.lang.Void,java.lang.String>
- Returns:
Serde
for key
-
valueSerde
public org.apache.kafka.common.serialization.Serde<java.lang.String> valueSerde()
Description copied from interface:ElementSerializer
RetrieveSerde
for type V.- Specified by:
valueSerde
in interfaceElementSerializer<java.lang.Void,java.lang.String>
- Returns:
Serde
for value
-
-