public interface KafkaSpoutRetryService extends Serializable
Represents the logic that manages the retrial of failed tuples.
Modifier and Type | Method and Description |
---|---|
Map<org.apache.kafka.common.TopicPartition,Long> |
earliestRetriableOffsets() |
KafkaSpoutMessageId |
getMessageId(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Gets the
KafkaSpoutMessageId for the given record. |
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. |
boolean |
isScheduled(KafkaSpoutMessageId msgId)
Checks if a specific failed
KafkaSpoutMessageId is scheduled to be retried. |
int |
readyMessageCount() |
boolean |
remove(KafkaSpoutMessageId msgId)
Removes a message from the list of messages scheduled for retrial
|
boolean |
retainAll(Collection<org.apache.kafka.common.TopicPartition> topicPartitions)
Retains all the messages whose
TopicPartition belongs to the specified Collection<TopicPartition> . |
boolean |
schedule(KafkaSpoutMessageId msgId)
Schedules this
KafkaSpoutMessageId if not yet scheduled, or updates retry time if it has already been scheduled. |
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 retrialboolean remove(KafkaSpoutMessageId msgId)
Removes a message from the list of messages scheduled for retrial
msgId
- message to remove from retrialboolean 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 messagesMap<org.apache.kafka.common.TopicPartition,Long> earliestRetriableOffsets()
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 readinessboolean 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 statusint readyMessageCount()
KafkaSpoutMessageId getMessageId(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Gets the KafkaSpoutMessageId
for the given record.
record
- The record to fetch the id forKafkaSpoutMessageId
if the record was not scheduled for retry.Copyright © 2022 The Apache Software Foundation. All Rights Reserved.