public class StreamingAggregatorBuffer extends AggregatorRecordBuffer
AggregatorRecordBuffer for streaming instances of DefaultBatchStepAggregator. This
implementation accumulates all the records in the current BatchJobInstanceAdapter into an input queue. Once the input
queue has been filled with all the records, then this buffer flushes them using a streaming Iterator. As this iterator
is consumed, processed records are accumulated into an output queue. Once iteration is completed, the records are finally sent
to the next BatchStep. The reason for the output queue instead of flushing directly to the next step is functional: a)
we don't want any record to be available to the next step before processing finishes and b) if one record fails we want to fail
them allbatchEngine, exceptionReporter, muleContext, notificationDispatcher, step| Constructor and Description |
|---|
StreamingAggregatorBuffer(BatchEngine batchEngine,
BatchStepAdapter step,
org.mule.runtime.core.api.processor.Processor chain,
org.mule.runtime.api.notification.NotificationDispatcher notificationDispatcher,
org.mule.runtime.core.api.MuleContext muleContext) |
| Modifier and Type | Method and Description |
|---|---|
int |
add(BatchJobInstanceAdapter jobInstance,
BatchTransactionContext ctx,
Record record)
buffers the given
Record for the given BatchJobInstanceAdapter |
protected org.mule.runtime.core.api.event.CoreEvent |
configureChainEvent(org.mule.runtime.core.api.event.CoreEvent event,
BatchJobInstanceAdapter jobInstance,
com.google.common.collect.Multimap<BatchTransactionContext,Record> records)
Configures the
event (set payload, properties, etc) to is going to be used when flushing the aggregated records
through the AggregatorRecordBuffer.chain |
void |
flush(BatchJobInstanceAdapter jobInstance)
Flushes the buffered
Records for the given
BatchJobInstanceAdapter. |
void |
flushAndForget(BatchJobInstanceAdapter jobInstance)
|
void |
forget(BatchJobInstanceAdapter jobInstance)
Releases all tracking information for the given
BatchJobInstanceAdapter |
protected BatchProcessingTemplate |
makeProcessingTemplate(com.google.common.collect.Multimap<BatchTransactionContext,Record> records,
org.mule.runtime.core.api.processor.Processor processor,
org.mule.runtime.core.api.MuleContext muleContext)
Returns the
BatchProcessingTemplate through which AggregatorRecordBuffer.chain will be executed |
long |
size(BatchJobInstanceAdapter jobInstance)
Returns how many records are buffered for the given
BatchJobInstanceAdapter |
doFlush, getLocation, markError, setExceptionReportergetHolderLockadd, getNamepublic StreamingAggregatorBuffer(BatchEngine batchEngine, BatchStepAdapter step, org.mule.runtime.core.api.processor.Processor chain, org.mule.runtime.api.notification.NotificationDispatcher notificationDispatcher, org.mule.runtime.core.api.MuleContext muleContext)
public int add(BatchJobInstanceAdapter jobInstance, BatchTransactionContext ctx, Record record)
InMemoryRecordBufferRecord for the given BatchJobInstanceAdapteradd in interface RecordBufferadd in class InMemoryRecordBufferjobInstance - a BatchJobInstanceAdapterrecord - a BatchJobInstanceAdapterpublic void forget(BatchJobInstanceAdapter jobInstance)
InMemoryRecordBufferBatchJobInstanceAdapterforget in interface RecordBufferforget in class InMemoryRecordBufferjobInstance - a BatchJobInstanceAdapter which you no longer need
to trackpublic void flushAndForget(BatchJobInstanceAdapter jobInstance)
InMemoryRecordBufferInMemoryRecordBuffer.flush(com.mulesoft.mule.runtime.module.batch.engine.BatchJobInstanceAdapter) followed by a
InMemoryRecordBuffer.forget(com.mulesoft.mule.runtime.module.batch.engine.BatchJobInstanceAdapter).
You MUST use this method when you know that the given jobInstance will no longer be executed in order to avoid a
memory leak on its tracking information
This is NOT a thread-safe operation. You must be careful to not have several threads invoking this method at the same
time for the same BatchJobInstanceAdapterflushAndForget in interface RecordBufferflushAndForget in class InMemoryRecordBufferjobInstance - a BatchJobInstanceAdapter which you no longer need
to trackpublic void flush(BatchJobInstanceAdapter jobInstance)
InMemoryRecordBufferRecords for the given
BatchJobInstanceAdapter.
Use this method when you want to flush the info but you still expect more records from the same job instance to come. In this
way, you flush the records but you avoid constantly recreating the internal tracking information.
This is a thread-safe operation.flush in interface RecordBufferflush in class InMemoryRecordBufferjobInstance - the BatchJobInstanceAdapter which records you want
flushedpublic long size(BatchJobInstanceAdapter jobInstance)
InMemoryRecordBufferBatchJobInstanceAdaptersize in interface RecordBuffersize in class InMemoryRecordBufferjobInstance - a BatchJobInstanceAdapterprotected org.mule.runtime.core.api.event.CoreEvent configureChainEvent(org.mule.runtime.core.api.event.CoreEvent event,
BatchJobInstanceAdapter jobInstance,
com.google.common.collect.Multimap<BatchTransactionContext,Record> records)
throws org.mule.runtime.api.exception.MuleException
AggregatorRecordBufferevent (set payload, properties, etc) to is going to be used when flushing the aggregated records
through the AggregatorRecordBuffer.chainconfigureChainEvent in class AggregatorRecordBufferevent - a CoreEventjobInstance - the BatchJobInstanceAdapter being executedrecords - the aggregated RecordsCoreEvent or null, which means that the chain should be skipped for this eventorg.mule.runtime.api.exception.MuleException - if anything goes wrongprotected BatchProcessingTemplate makeProcessingTemplate(com.google.common.collect.Multimap<BatchTransactionContext,Record> records, org.mule.runtime.core.api.processor.Processor processor, org.mule.runtime.core.api.MuleContext muleContext)
AggregatorRecordBufferBatchProcessingTemplate through which AggregatorRecordBuffer.chain will be executedmakeProcessingTemplate in class AggregatorRecordBufferrecords - the aggregated Recordsprocessor - the Processor to be executedmuleContext - the current MuleContextCopyright © 2006–2022 MuleSoft, Inc.. All rights reserved.