org.apache.storm.kafka.spout

## Interface RecordTranslator<K,V>

- All Superinterfaces:
    Func<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>,List<Object>>, Serializable
  All Known Implementing Classes:
    ByTopicRecordTranslator, DefaultRecordTranslator, OnlyValueRecordTranslator, RecordTranslatorSchemeAdapter, SimpleRecordTranslator

      public interface RecordTranslator<K,V>
      extends Serializable, Func<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>,List<Object>>

  Translate a `ConsumerRecord` to a tuple.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static List<String>` | `DEFAULT_STREAM`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Object>` | `apply(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)` Translate the ConsumerRecord into a list of objects that can be emitted.
    `Fields` | `getFieldsFor(String stream)` Get the fields associated with a stream.
    `default List<String>` | `streams()` Get the list of streams this translator will handle.

- - ### Field Detail

    - #### DEFAULT_STREAM

          static final List<String> DEFAULT_STREAM

  - ### Method Detail

    - #### apply

          List<Object> apply(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)

      Translate the ConsumerRecord into a list of objects that can be emitted.

      Specified by:
        `apply` in interface `Func<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>,List<Object>>`
      Parameters:
        `record` - the record to translate
      Returns:
        the objects in the tuple. Return a `KafkaTuple` if you want to route the tuple to a non-default stream. Return `null` to discard an invalid `ConsumerRecord` if `KafkaSpoutConfig.Builder.setEmitNullTuples(boolean)` is set to `false`.

    - #### getFieldsFor

          Fields getFieldsFor(String stream)

      Get the fields associated with a stream. The streams passed in are returned by the `streams()` method.

      Parameters:
        `stream` - the stream the fields are for
      Returns:
        the fields for that stream.

    - #### streams

          default List<String> streams()

      Get the list of streams this translator will handle.

      Returns:
        the list of streams that this will handle.

Copyright © 2019 The Apache Software Foundation. All rights reserved.