Interface StreamMessageDecoder<T>

  • Type Parameters:
    T -

    @Public
    @Stable
    public interface StreamMessageDecoder<T>
    Interface for a decoder of messages fetched from the stream
    • Method Detail

      • init

        void init​(Map<String,​String> props,
                  Set<String> fieldsToRead,
                  String topicName)
           throws Exception
        Initializes the decoder.
        Parameters:
        props - Decoder properties extracted from the StreamConfig
        fieldsToRead - The fields to read from the source stream. If blank, reads all fields (only for AVRO/JSON currently)
        topicName - Topic name of the stream
        Throws:
        Exception - If an error occurs
      • decode

        @Nullable
        GenericRow decode​(T payload,
                          GenericRow destination)
        Decodes a row.
        Parameters:
        payload - The buffer from which to read the row.
        Returns:
        A new row decoded from the buffer. If the returned value is null the row is dropped from the segment.
      • decode

        @Nullable
        GenericRow decode​(T payload,
                          int offset,
                          int length,
                          GenericRow destination)
        Decodes a row.
        Parameters:
        payload - The buffer from which to read the row.
        offset - The offset into the array from which the row contents starts
        length - The length of the row contents in bytes
        destination - The GenericRow to write the decoded row into
        Returns:
        A new row decoded from the buffer If the returned value is null the row is dropped from the segment.