Class ConsumerRunner<M extends Message>
java.lang.Object
org.nuxeo.lib.stream.pattern.consumer.internals.ConsumerRunner<M>
- All Implemented Interfaces:
Callable<ConsumerStatus>,RebalanceListener
public class ConsumerRunner<M extends Message>
extends Object
implements Callable<ConsumerStatus>, RebalanceListener
Read messages from a tailer and drive a consumer according to its policy.
- Since:
- 9.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected booleanprotected longprotected longprotected longprotected Stringprotected BatchPolicyprotected final ConsumerFactory<M>protected io.dropwizard.metrics5.Timerprotected io.dropwizard.metrics5.Timerprotected io.dropwizard.metrics5.Counterprotected io.dropwizard.metrics5.Counterprotected io.dropwizard.metrics5.Counterstatic final Stringprotected final ConsumerPolicyprotected final io.dropwizard.metrics5.MetricRegistryprotected Stringprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionConsumerRunner(ConsumerFactory<M> factory, ConsumerPolicy policy, LogManager manager, List<LogPartition> defaultAssignments) Deprecated.ConsumerRunner(ConsumerFactory<M> factory, ConsumerPolicy policy, LogManager manager, Codec<M> codec, List<LogPartition> defaultAssignments) -
Method Summary
Modifier and TypeMethodDescriptionprotected BatchStateprotected voidaddSalt()protected voidcall()protected voidcommitBatch(BatchState state) protected voidcreateTailer(LogManager manager, Codec<M> codec, List<LogPartition> defaultAssignments) voidonPartitionsAssigned(Collection<LogPartition> partitions) voidonPartitionsLost(Collection<LogPartition> partitions) voidonPartitionsRevoked(Collection<LogPartition> partitions) protected booleanprotected booleanprocessBatchWithRetry(net.jodah.failsafe.Execution<Object> execution) protected voidprotected voidprotected voidprotected voidsetTailerPosition(LogManager manager) protected voidsetThreadName(String message)
-
Field Details
-
NUXEO_METRICS_REGISTRY_NAME
- See Also:
-
factory
-
policy
-
tailer
-
consumerId
-
currentBatchPolicy
-
threadName
-
consumer
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry -
acceptCounter
protected long acceptCounter -
committedCounter
protected long committedCounter -
batchCommitCounter
protected long batchCommitCounter -
batchFailureCounter
protected long batchFailureCounter -
alreadySalted
protected boolean alreadySalted -
globalAcceptTimer
protected io.dropwizard.metrics5.Timer globalAcceptTimer -
globalCommittedCounter
protected io.dropwizard.metrics5.Counter globalCommittedCounter -
globalBatchCommitTimer
protected io.dropwizard.metrics5.Timer globalBatchCommitTimer -
globalBatchFailureCounter
protected io.dropwizard.metrics5.Counter globalBatchFailureCounter -
globalConsumersCounter
protected io.dropwizard.metrics5.Counter globalConsumersCounter -
usingSubscribe
protected boolean usingSubscribe
-
-
Constructor Details
-
ConsumerRunner
@Deprecated public ConsumerRunner(ConsumerFactory<M> factory, ConsumerPolicy policy, LogManager manager, List<LogPartition> defaultAssignments) Deprecated.since 11.1, due to serialization issue with java 11, useConsumerRunner(ConsumerFactory, ConsumerPolicy, LogManager, Codec, List)which allows to give acodectotailer. -
ConsumerRunner
public ConsumerRunner(ConsumerFactory<M> factory, ConsumerPolicy policy, LogManager manager, Codec<M> codec, List<LogPartition> defaultAssignments)
-
-
Method Details
-
createTailer
protected LogTailer<M> createTailer(LogManager manager, Codec<M> codec, List<LogPartition> defaultAssignments) -
call
-
setMetrics
protected void setMetrics() -
addSalt
- Throws:
InterruptedException
-
setTailerPosition
-
consumerLoop
- Throws:
InterruptedException
-
processBatchWithRetry
protected boolean processBatchWithRetry(net.jodah.failsafe.Execution<Object> execution) throws InterruptedException - Throws:
InterruptedException
-
setBatchRetryPolicy
protected void setBatchRetryPolicy() -
restoreBatchPolicy
protected void restoreBatchPolicy() -
processBatch
- Throws:
InterruptedException
-
beginBatch
protected void beginBatch() -
commitBatch
-
rollbackBatch
-
acceptBatch
- Throws:
InterruptedException
-
setThreadName
-
onPartitionsRevoked
- Specified by:
onPartitionsRevokedin interfaceRebalanceListener
-
onPartitionsLost
- Specified by:
onPartitionsLostin interfaceRebalanceListener
-
onPartitionsAssigned
- Specified by:
onPartitionsAssignedin interfaceRebalanceListener
-
ConsumerRunner(ConsumerFactory, ConsumerPolicy, LogManager, Codec, List)which allows to give acodectotailer.