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
Modifier and TypeFieldDescriptionprotected long
protected boolean
protected long
protected long
protected long
protected String
protected BatchPolicy
protected final ConsumerFactory<M>
protected io.dropwizard.metrics5.Timer
protected io.dropwizard.metrics5.Timer
protected io.dropwizard.metrics5.Counter
protected io.dropwizard.metrics5.Counter
protected io.dropwizard.metrics5.Counter
static final String
protected final ConsumerPolicy
protected final io.dropwizard.metrics5.MetricRegistry
protected String
protected boolean
-
Constructor Summary
ConstructorDescriptionConsumerRunner
(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 BatchState
protected void
addSalt()
protected void
call()
protected void
commitBatch
(BatchState state) protected void
createTailer
(LogManager manager, Codec<M> codec, List<LogPartition> defaultAssignments) void
onPartitionsAssigned
(Collection<LogPartition> partitions) void
onPartitionsLost
(Collection<LogPartition> partitions) void
onPartitionsRevoked
(Collection<LogPartition> partitions) protected boolean
protected boolean
processBatchWithRetry
(net.jodah.failsafe.Execution<Object> execution) protected void
protected void
protected void
protected void
setTailerPosition
(LogManager manager) protected void
setThreadName
(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 acodec
totailer
. -
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:
onPartitionsRevoked
in interfaceRebalanceListener
-
onPartitionsLost
- Specified by:
onPartitionsLost
in interfaceRebalanceListener
-
onPartitionsAssigned
- Specified by:
onPartitionsAssigned
in interfaceRebalanceListener
-
ConsumerRunner(ConsumerFactory, ConsumerPolicy, LogManager, Codec, List)
which allows to give acodec
totailer
.