Package org.apache.storm.kafka.spout
Interface KafkaTupleListener
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
EmptyKafkaTupleListener
The KafkaTupleListener handles state changes of a kafka tuple inside a KafkaSpout.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
Called during the initialization of the kafka spout.- Parameters:
conf
- The storm configuration.context
- TheTopologyContext
-
onEmit
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
Called when a tuple is acked.- Parameters:
msgId
- The id of the tuple in the spout.
-
onPartitionsReassigned
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
Called when the Kafka spout sets a record for retry.- Parameters:
msgId
- The id of the tuple in the spout.
-
onMaxRetryReached
Called when the maximum number of retries have been reached.- Parameters:
msgId
- The id of the tuple in the spout.
-