Interface ElementSerializer<K,​V>

    • Method Detail

      • setup

        default void setup​(EntityDescriptor entityDescriptor)
        Life-cycle method called after being instantiated to be able to parameterize itself from the given EntityDescriptor.
        Parameters:
        entityDescriptor - the entity that this serializer will be used for
      • read

        @Nullable
        StreamElement read​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> record,
                           EntityDescriptor entityDesc)
        Parse the raw bytes from Kafka and return a StreamElement.
        Parameters:
        record - a ConsumerRecord to be parsed
        entityDesc - descriptor of entity being read
        Returns:
        the StreamElement or null on parse error
      • write

        org.apache.kafka.clients.producer.ProducerRecord<K,​V> write​(java.lang.String topic,
                                                                          int partition,
                                                                          StreamElement element)
        Convert StreamElement into ProducerRecord.
        Parameters:
        topic - the target topic
        partition - the target partition
        element - the StreamElement to convert
        Returns:
        the ProducerRecord to write to Kafka
      • keySerde

        org.apache.kafka.common.serialization.Serde<K> keySerde()
        Retrieve Serde for type K.
        Returns:
        Serde for key
      • valueSerde

        org.apache.kafka.common.serialization.Serde<V> valueSerde()
        Retrieve Serde for type V.
        Returns:
        Serde for value
      • storesSequentialId

        default boolean storesSequentialId()
        Returns:
        true if this serializer reads and writes sequential IDs of StreamElement (if any).