Package org.apache.storm.kafka.spout

# Interface KafkaTupleListener

All Superinterfaces:
  `Serializable`

All Known Implementing Classes:
  `EmptyKafkaTupleListener`

public interface KafkaTupleListener extends Serializable
The KafkaTupleListener handles state changes of a kafka tuple inside a KafkaSpout.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAck(KafkaSpoutMessageId msgId)`
  Called when a tuple is acked.
  `void`
  `onEmit(List<Object> tuple, KafkaSpoutMessageId msgId)`
  Called when the tuple is emitted and auto commit is disabled.
  `void`
  `onMaxRetryReached(KafkaSpoutMessageId msgId)`
  Called when the maximum number of retries have been reached.
  `void`
  `onPartitionsReassigned(Collection<org.apache.kafka.common.TopicPartition> partitions)`
  Called when kafka partitions are rebalanced.
  `void`
  `onRetry(KafkaSpoutMessageId msgId)`
  Called when the Kafka spout sets a record for retry.
  `void`
  `open(Map<String,Object> conf, TopologyContext context)`
  Called during the initialization of the kafka spout.

- ## Method Details

  - ### open

    void open(Map<String,Object> conf, TopologyContext context)
    Called during the initialization of the kafka spout.
    Parameters:
      `conf` - The storm configuration.
      `context` - The `TopologyContext`

  - ### onEmit

    void onEmit(List<Object> tuple, KafkaSpoutMessageId msgId)
    Called when the tuple is emitted and auto commit is disabled. If kafka auto commit is enabled, the kafka consumer will periodically (depending on the commit interval) commit the offsets. Therefore, storm disables anchoring for tuples when auto commit is enabled and the spout will not receive acks and fails for those tuples.
    Parameters:
      `tuple` - the storm tuple.
      `msgId` - The id of the tuple in the spout.

  - ### onAck

    void onAck(KafkaSpoutMessageId msgId)
    Called when a tuple is acked.
    Parameters:
      `msgId` - The id of the tuple in the spout.

  - ### onPartitionsReassigned

    void onPartitionsReassigned(Collection<org.apache.kafka.common.TopicPartition> partitions)
    Called when kafka partitions are rebalanced.
    Parameters:
      `partitions` - The list of partitions that are now assigned to the consumer (may include partitions previously assigned to the consumer)

  - ### onRetry

    void onRetry(KafkaSpoutMessageId msgId)
    Called when the Kafka spout sets a record for retry.
    Parameters:
      `msgId` - The id of the tuple in the spout.

  - ### onMaxRetryReached

    void onMaxRetryReached(KafkaSpoutMessageId msgId)
    Called when the maximum number of retries have been reached.
    Parameters:
      `msgId` - The id of the tuple in the spout.