public class KafkaThrottledLatestProcessedCommit extends ContextHolder implements KafkaCommitHandler
This strategy mimics the behavior of the kafka consumer when `enable.auto.commit` is `true`.
The connector will be marked as unhealthy in the presence of any received record that has gone too long without being processed as defined by `throttled.unprocessed-record-max-age.ms` (default: 60000). If `throttled.unprocessed-record-max-age.ms` is set to less than or equal to 0 then will not perform any health check (this might lead to running out of memory).
This strategy guarantees at-least-once delivery even if the channel performs asynchronous processing.
To use set `commit-strategy` to `throttled`.
Modifier and Type | Class and Description |
---|---|
static class |
KafkaThrottledLatestProcessedCommit.TooManyMessagesWithoutAckException |
KafkaCommitHandler.Strategy
context, vertx
Modifier and Type | Method and Description |
---|---|
static void |
clearCache() |
static KafkaThrottledLatestProcessedCommit |
create(io.vertx.mutiny.core.Vertx vertx,
ReactiveKafkaConsumer<?,?> consumer,
String groupId,
KafkaConnectorIncomingConfiguration config,
KafkaSource<?,?> source) |
<K,V> CompletionStage<Void> |
handle(IncomingKafkaRecord<K,V> record)
A message has been acknowledged.
|
void |
partitionsAssigned(Collection<org.apache.kafka.common.TopicPartition> partitions)
New partitions are assigned.
|
void |
partitionsRevoked(Collection<org.apache.kafka.common.TopicPartition> partitions)
Revoked partitions.
|
<K,V> IncomingKafkaRecord<K,V> |
received(IncomingKafkaRecord<K,V> record)
Received a new record from Kafka.
|
void |
terminate(boolean graceful) |
capture, getContext, runOnContext, runOnContextAndAwait
public static void clearCache()
public static KafkaThrottledLatestProcessedCommit create(io.vertx.mutiny.core.Vertx vertx, ReactiveKafkaConsumer<?,?> consumer, String groupId, KafkaConnectorIncomingConfiguration config, KafkaSource<?,?> source)
public void partitionsAssigned(Collection<org.apache.kafka.common.TopicPartition> partitions)
partitionsAssigned
in interface KafkaCommitHandler
partitions
- the list of partitions that are now assigned to the consumer
(may include partitions previously assigned to the consumer)public void partitionsRevoked(Collection<org.apache.kafka.common.TopicPartition> partitions)
partitionsRevoked
in interface KafkaCommitHandler
partitions
- The list of partitions that were assigned to the consumer on the last rebalancepublic <K,V> IncomingKafkaRecord<K,V> received(IncomingKafkaRecord<K,V> record)
received
in interface KafkaCommitHandler
K
- the keyV
- the valuerecord
- the recordpublic <K,V> CompletionStage<Void> handle(IncomingKafkaRecord<K,V> record)
handle
in interface KafkaCommitHandler
K
- the keyV
- the valuerecord
- the recordpublic void terminate(boolean graceful)
terminate
in interface KafkaCommitHandler
Copyright © 2018–2021 SmallRye. All rights reserved.