Interface KafkaSpoutRetryService

All Superinterfaces:
All Known Implementing Classes:

public interface KafkaSpoutRetryService extends Serializable
Represents the logic that manages the retrial of failed tuples.
  • Method Details

    • schedule

      boolean schedule(KafkaSpoutMessageId msgId)
      Schedules this KafkaSpoutMessageId if 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.
      msgId - message to schedule for retrial
      true if the message will be retried, false otherwise
    • remove

      boolean remove(KafkaSpoutMessageId msgId)
      Removes a message from the list of messages scheduled for retrial.
      msgId - message to remove from retrial
      true if the message was scheduled for retrial, false otherwise
    • retainAll

      boolean retainAll(Collection<org.apache.kafka.common.TopicPartition> topicPartitions)
      Retains all the messages whose TopicPartition belongs to the specified Collection<TopicPartition>. All messages that come from a TopicPartition NOT existing in the collection will be removed. This method is useful to cleanup state following partition rebalance.
      topicPartitions - Collection of TopicPartition for which to keep messages
      true if at least one message was removed, false otherwise
    • earliestRetriableOffsets

      Map<org.apache.kafka.common.TopicPartition,Long> earliestRetriableOffsets()
      Gets the earliest retriable offsets.
      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.
    • isReady

      boolean isReady(KafkaSpoutMessageId msgId)
      Checks if a specific failed KafkaSpoutMessageId is ready to be retried, i.e is scheduled and has retry time that is less than current time.
      msgId - message to check for readiness
      true if message is ready to be retried, false otherwise
    • isScheduled

      boolean isScheduled(KafkaSpoutMessageId msgId)
      Checks if a specific failed KafkaSpoutMessageId is scheduled to be retried. The message may or may not be ready to be retried yet.
      msgId - message to check for scheduling status
      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
    • readyMessageCount

      int readyMessageCount()
      Get the number of messages ready for retry.
      The number of messages that are ready for retry
    • getMessageId

      KafkaSpoutMessageId getMessageId(org.apache.kafka.common.TopicPartition topicPartition, long offset)
      Gets the KafkaSpoutMessageId for the record on the given topic partition and offset.
      topicPartition - The topic partition of the record
      offset - The offset of the record
      The id the record was scheduled for retry with, or a new KafkaSpoutMessageId if the record was not scheduled for retry.