public class ConsumerRunner<M extends Message> extends Object implements Callable<ConsumerStatus>, RebalanceListener
Modifier and Type | Field and Description |
---|---|
protected long |
acceptCounter |
protected boolean |
alreadySalted |
protected long |
batchCommitCounter |
protected long |
batchFailureCounter |
protected long |
committedCounter |
protected Consumer<M> |
consumer |
protected String |
consumerId |
protected BatchPolicy |
currentBatchPolicy |
protected ConsumerFactory<M> |
factory |
protected com.codahale.metrics.Timer |
globalAcceptTimer |
protected com.codahale.metrics.Timer |
globalBatchCommitTimer |
protected com.codahale.metrics.Counter |
globalBatchFailureCounter |
protected com.codahale.metrics.Counter |
globalCommittedCounter |
protected com.codahale.metrics.Counter |
globalConsumersCounter |
static String |
NUXEO_METRICS_REGISTRY_NAME |
protected ConsumerPolicy |
policy |
protected com.codahale.metrics.MetricRegistry |
registry |
protected LogTailer<M> |
tailer |
protected String |
threadName |
Constructor and Description |
---|
ConsumerRunner(ConsumerFactory<M> factory,
ConsumerPolicy policy,
LogManager manager,
List<LogPartition> defaultAssignments) |
Modifier and Type | Method and Description |
---|---|
protected BatchState |
acceptBatch() |
protected void |
addSalt() |
protected void |
beginBatch() |
ConsumerStatus |
call() |
protected void |
commitBatch(BatchState state) |
protected void |
consumerLoop() |
protected LogTailer<M> |
createTailer(LogManager manager,
List<LogPartition> defaultAssignments) |
void |
onPartitionsAssigned(Collection<LogPartition> partitions) |
void |
onPartitionsRevoked(Collection<LogPartition> partitions) |
protected boolean |
processBatch() |
protected boolean |
processBatchWithRetry(net.jodah.failsafe.Execution execution) |
protected void |
restoreBatchPolicy() |
protected void |
rollbackBatch(Exception e) |
protected void |
setBatchRetryPolicy() |
protected void |
setMetrics() |
protected void |
setTailerPosition(LogManager manager) |
protected void |
setThreadName(String message) |
public static final String NUXEO_METRICS_REGISTRY_NAME
protected final ConsumerFactory<M extends Message> factory
protected final ConsumerPolicy policy
protected String consumerId
protected BatchPolicy currentBatchPolicy
protected String threadName
protected final com.codahale.metrics.MetricRegistry registry
protected long acceptCounter
protected long committedCounter
protected long batchCommitCounter
protected long batchFailureCounter
protected boolean alreadySalted
protected com.codahale.metrics.Timer globalAcceptTimer
protected com.codahale.metrics.Counter globalCommittedCounter
protected com.codahale.metrics.Timer globalBatchCommitTimer
protected com.codahale.metrics.Counter globalBatchFailureCounter
protected com.codahale.metrics.Counter globalConsumersCounter
public ConsumerRunner(ConsumerFactory<M> factory, ConsumerPolicy policy, LogManager manager, List<LogPartition> defaultAssignments)
protected LogTailer<M> createTailer(LogManager manager, List<LogPartition> defaultAssignments)
public ConsumerStatus call() throws Exception
call
in interface Callable<ConsumerStatus>
Exception
protected void setMetrics()
protected void addSalt() throws InterruptedException
InterruptedException
protected void setTailerPosition(LogManager manager)
protected void consumerLoop() throws InterruptedException
InterruptedException
protected boolean processBatchWithRetry(net.jodah.failsafe.Execution execution) throws InterruptedException
InterruptedException
protected void setBatchRetryPolicy()
protected void restoreBatchPolicy()
protected boolean processBatch() throws InterruptedException
InterruptedException
protected void beginBatch()
protected void commitBatch(BatchState state)
protected void rollbackBatch(Exception e)
protected BatchState acceptBatch() throws InterruptedException
InterruptedException
protected void setThreadName(String message)
public void onPartitionsRevoked(Collection<LogPartition> partitions)
onPartitionsRevoked
in interface RebalanceListener
public void onPartitionsAssigned(Collection<LogPartition> partitions)
onPartitionsAssigned
in interface RebalanceListener
Copyright © 2018 Nuxeo. All rights reserved.