Class KafkaStreamElement.KafkaStreamElementSerializer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.kafka.common.serialization.Serde<java.lang.String> keySerde()
      Retrieve Serde 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 a StreamElement.
      boolean storesSequentialId()  
      org.apache.kafka.common.serialization.Serde<byte[]> valueSerde()
      Retrieve Serde for type V.
      org.apache.kafka.clients.producer.ProducerRecord<java.lang.String,​byte[]> write​(java.lang.String topic, int partition, StreamElement data)
      Convert StreamElement into ProducerRecord.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KafkaStreamElementSerializer

        public KafkaStreamElementSerializer()
    • 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 a StreamElement.
        Specified by:
        read in interface ElementSerializer<java.lang.String,​byte[]>
        Parameters:
        record - a ConsumerRecord to be parsed
        entityDesc - 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
        Convert StreamElement into ProducerRecord.
        Specified by:
        write in interface ElementSerializer<java.lang.String,​byte[]>
        Parameters:
        topic - the target topic
        partition - the target partition
        data - the StreamElement 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
        Retrieve Serde for type K.
        Specified by:
        keySerde in interface ElementSerializer<java.lang.String,​byte[]>
        Returns:
        Serde for key
      • valueSerde

        public org.apache.kafka.common.serialization.Serde<byte[]> valueSerde()
        Description copied from interface: ElementSerializer
        Retrieve Serde for type V.
        Specified by:
        valueSerde in interface ElementSerializer<java.lang.String,​byte[]>
        Returns:
        Serde for value
      • storesSequentialId

        public boolean storesSequentialId()
        Specified by:
        storesSequentialId in interface ElementSerializer<java.lang.String,​byte[]>
        Returns:
        true if this serializer reads and writes sequential IDs of StreamElement (if any).