Package org.apache.storm.kafka.spout
Interface KafkaSpoutRetryService
- All Superinterfaces:
- Serializable
- All Known Implementing Classes:
- KafkaSpoutRetryExponentialBackoff
Represents the logic that manages the retrial of failed tuples.
- 
Method SummaryModifier and TypeMethodDescriptionGets the earliest retriable offsets.getMessageId(org.apache.kafka.common.TopicPartition topicPartition, long offset) Gets theKafkaSpoutMessageIdfor the record on the given topic partition and offset.booleanisReady(KafkaSpoutMessageId msgId) Checks if a specific failedKafkaSpoutMessageIdis ready to be retried, i.e is scheduled and has retry time that is less than current time.booleanisScheduled(KafkaSpoutMessageId msgId) Checks if a specific failedKafkaSpoutMessageIdis scheduled to be retried.intGet the number of messages ready for retry.booleanremove(KafkaSpoutMessageId msgId) Removes a message from the list of messages scheduled for retrial.booleanretainAll(Collection<org.apache.kafka.common.TopicPartition> topicPartitions) Retains all the messages whoseTopicPartitionbelongs to the specifiedCollection<TopicPartition>.booleanschedule(KafkaSpoutMessageId msgId) Schedules thisKafkaSpoutMessageIdif not yet scheduled, or updates retry time if it has already been scheduled.
- 
Method Details- 
scheduleSchedules thisKafkaSpoutMessageIdif not yet scheduled, or updates retry time if it has already been scheduled. It may also indicate that the message should not be retried, in which case the message will not be scheduled.- Parameters:
- msgId- message to schedule for retrial
- Returns:
- true if the message will be retried, false otherwise
 
- 
removeRemoves a message from the list of messages scheduled for retrial.- Parameters:
- msgId- message to remove from retrial
- Returns:
- true if the message was scheduled for retrial, false otherwise
 
- 
retainAllRetains all the messages whoseTopicPartitionbelongs to the specifiedCollection<TopicPartition>. All messages that come from aTopicPartitionNOT existing in the collection will be removed. This method is useful to cleanup state following partition rebalance.- Parameters:
- topicPartitions- Collection of- TopicPartitionfor which to keep messages
- Returns:
- true if at least one message was removed, false otherwise
 
- 
earliestRetriableOffsetsGets the earliest retriable offsets.- Returns:
- The earliest retriable offset for each TopicPartition that has offsets ready to be retried, i.e. for which a tuple has failed and has retry time less than current time.
 
- 
isReadyChecks if a specific failedKafkaSpoutMessageIdis ready to be retried, i.e is scheduled and has retry time that is less than current time.- Parameters:
- msgId- message to check for readiness
- Returns:
- true if message is ready to be retried, false otherwise
 
- 
isScheduledChecks if a specific failedKafkaSpoutMessageIdis scheduled to be retried. The message may or may not be ready to be retried yet.- Parameters:
- msgId- message to check for scheduling status
- Returns:
- true if the message is scheduled to be retried, regardless of being or not ready to be retried. Returns false is this message is not scheduled for retrial
 
- 
readyMessageCountint readyMessageCount()Get the number of messages ready for retry.- Returns:
- The number of messages that are ready for retry
 
- 
getMessageIdKafkaSpoutMessageId getMessageId(org.apache.kafka.common.TopicPartition topicPartition, long offset) Gets theKafkaSpoutMessageIdfor the record on the given topic partition and offset.- Parameters:
- topicPartition- The topic partition of the record
- offset- The offset of the record
- Returns:
- The id the record was scheduled for retry with,
     or a new KafkaSpoutMessageIdif the record was not scheduled for retry.
 
 
-