Class 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 Detail

      • ValueAsStringSerializer

        protected ValueAsStringSerializer​(java.lang.String attrName)
    • 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 given EntityDescriptor.
        Specified by:
        setup in interface ElementSerializer<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 a StreamElement.
        Specified by:
        read in interface ElementSerializer<java.lang.Void,​java.lang.String>
        Parameters:
        consumerRecord - a ConsumerRecord to be parsed
        entityDescriptor - 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
        Convert StreamElement into ProducerRecord.
        Specified by:
        write in interface ElementSerializer<java.lang.Void,​java.lang.String>
        Parameters:
        topic - the target topic
        partition - the target partition
        streamElement - the StreamElement 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
        Retrieve Serde for type K.
        Specified by:
        keySerde in interface ElementSerializer<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
        Retrieve Serde for type V.
        Specified by:
        valueSerde in interface ElementSerializer<java.lang.Void,​java.lang.String>
        Returns:
        Serde for value