public abstract class AbstractConsumer extends AbstractTaskRunner implements Consumer
Modifier and Type | Field and Description |
---|---|
protected Batch |
batch |
protected static long |
CHECK_INTERVAL |
protected com.codahale.metrics.Timer |
commitTimer |
protected com.codahale.metrics.Counter |
consumerCount |
protected com.codahale.metrics.Counter |
failCount |
protected long |
lastCheckTime |
protected long |
lastCommitTime |
protected long |
lastCount |
protected double |
lastImediatThroughput |
protected ImporterLogger |
log |
protected String |
originatingUsername |
protected com.codahale.metrics.Timer |
processTimer |
protected int |
queue |
protected QueuesManager |
queuesManager |
protected com.codahale.metrics.MetricRegistry |
registry |
protected boolean |
replayMode |
protected String |
repositoryName |
protected com.codahale.metrics.Counter |
retryCount |
protected DocumentRef |
rootRef |
protected long |
startTime |
protected String |
threadName |
protected static long |
TRANSACTION_THRESOLD_MS |
canStop, completed, error, mustStop, nbProcessed, started
Constructor and Description |
---|
AbstractConsumer(ImporterLogger log,
DocumentModel root,
int batchSize,
QueuesManager queuesManager,
int queue) |
Modifier and Type | Method and Description |
---|---|
protected void |
commit(CoreSession session) |
protected void |
commitIfNeeded(CoreSession session)
commit if batch is full or if transaction is running for more than 5 min.
|
String |
getOriginatingUsername() |
protected void |
onSourceNodeException(SourceNode node,
Exception e)
Override if you want to do more that logging the error.
|
protected void |
onSourceNodeRollBack(SourceNode node)
Override if you want to do more that logging the error.
|
protected abstract void |
process(CoreSession session,
SourceNode bh) |
protected void |
rollbackAndReplayBatch(CoreSession session) |
void |
run() |
protected void |
runDrainer() |
protected void |
runImport() |
void |
setOriginatingUsername(String originatingUsername) |
canStop, getError, getNbProcessed, incrementProcessed, isCompleted, isTerminated, mustStop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNbDocsCreated
canStop, getError, getNbProcessed, isCompleted, isTerminated, mustStop
protected final String repositoryName
protected final QueuesManager queuesManager
protected final int queue
protected final DocumentRef rootRef
protected long startTime
protected long lastCheckTime
protected long lastCount
protected static final long CHECK_INTERVAL
protected double lastImediatThroughput
protected String originatingUsername
protected ImporterLogger log
protected boolean replayMode
protected String threadName
protected final com.codahale.metrics.MetricRegistry registry
protected final com.codahale.metrics.Timer processTimer
protected final com.codahale.metrics.Timer commitTimer
protected final com.codahale.metrics.Counter retryCount
protected final com.codahale.metrics.Counter failCount
protected final com.codahale.metrics.Counter consumerCount
protected long lastCommitTime
protected static final long TRANSACTION_THRESOLD_MS
public AbstractConsumer(ImporterLogger log, DocumentModel root, int batchSize, QueuesManager queuesManager, int queue)
protected void runDrainer()
protected void runImport()
protected abstract void process(CoreSession session, SourceNode bh) throws Exception
Exception
protected void commitIfNeeded(CoreSession session)
protected void commit(CoreSession session)
protected void rollbackAndReplayBatch(CoreSession session)
protected void onSourceNodeException(SourceNode node, Exception e)
node
- e
- protected void onSourceNodeRollBack(SourceNode node)
node
- public String getOriginatingUsername()
public void setOriginatingUsername(String originatingUsername)
Copyright © 2017 Nuxeo. All rights reserved.