public abstract class BatchProcessingTemplate extends Object
Processor chain in different sections of a BatchJob
such as BatchStep, DefaultBatchStepAggregator or the on-complete section implemented through
BatchMessageBlock| Constructor and Description |
|---|
BatchProcessingTemplate(org.mule.runtime.core.api.processor.ReactiveProcessor processor,
org.mule.runtime.api.component.location.ComponentLocation location,
org.mule.runtime.core.api.context.notification.FlowTraceManager flowTraceManager,
org.mule.runtime.core.api.util.StreamCloserService streamCloser)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
before(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent event)
This method is invoked right before each execution of
messageProcessor. |
protected void |
handleException(BatchJobInstanceAdapter jobInstance,
Exception e,
org.mule.runtime.core.api.event.CoreEvent event) |
protected void |
handleSuccess(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent resultEvent,
org.mule.runtime.core.api.event.CoreEvent.Builder builder) |
protected abstract void |
onException(BatchJobInstanceAdapter jobInstance,
Exception e,
org.mule.runtime.core.api.event.CoreEvent event)
This method is invoked when the execution of
messageProcessor throws exception or the result event carries a
ExceptionPayload |
protected void |
onFinally(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent originalEvent,
org.mule.runtime.core.api.event.CoreEvent resultEvent)
This method is invoked when each execution of
messageProcessor completes, no matter if was successful or not. |
protected abstract void |
onSuccess(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent responseEvent)
This method is invoked when
messageProcessor is execute without any exceptions |
org.mule.runtime.core.api.event.CoreEvent |
process(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent event)
Executes the
messageProcessor provided in the constructor with the given payload. |
protected void |
resolveOutputHandlerPayload(org.mule.runtime.core.api.event.CoreEvent event,
org.mule.runtime.core.api.event.CoreEvent.Builder builder) |
public BatchProcessingTemplate(org.mule.runtime.core.api.processor.ReactiveProcessor processor,
org.mule.runtime.api.component.location.ComponentLocation location,
org.mule.runtime.core.api.context.notification.FlowTraceManager flowTraceManager,
org.mule.runtime.core.api.util.StreamCloserService streamCloser)
processor - the Processor to be executedlocation - the location of the component that owns this templatemuleContext - the current MuleContextpublic org.mule.runtime.core.api.event.CoreEvent process(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent event) throws org.mule.runtime.api.exception.MuleException
messageProcessor provided in the constructor with the given payload. If execution is completed without
errors, then onSuccess(BatchJobInstanceAdapter, CoreEvent)} invoked. On the contrary, if an exception is thrown or
if the response event carries an ExceptionPayload,
onException(BatchJobInstanceAdapter, Exception, CoreEvent) method is invoked instead. In any case,
onFinally(BatchJobInstanceAdapter, CoreEvent, CoreEvent) invoked.jobInstance - the BatchJobInstanceAdapter for which the messageProcessor is being executedevent - the CoreEvent that is triggering this executionCoreEventorg.mule.runtime.api.exception.MuleExceptionprotected void handleSuccess(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent resultEvent, org.mule.runtime.core.api.event.CoreEvent.Builder builder) throws Exception
Exceptionprotected void handleException(BatchJobInstanceAdapter jobInstance, Exception e, org.mule.runtime.core.api.event.CoreEvent event) throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionprotected void resolveOutputHandlerPayload(org.mule.runtime.core.api.event.CoreEvent event,
org.mule.runtime.core.api.event.CoreEvent.Builder builder)
throws Exception
Exceptionprotected void before(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent event) throws org.mule.runtime.api.exception.MuleException
messageProcessor. This default implementation is a no-op and
can be overridden by the template for each phase.jobInstance - the BatchJobInstanceAdapter for which execution will be doneevent - the CoreEvent originally passed to messageProcessororg.mule.runtime.api.exception.MuleExceptionprotected void onFinally(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent originalEvent, org.mule.runtime.core.api.event.CoreEvent resultEvent) throws org.mule.runtime.api.exception.MuleException
messageProcessor completes, no matter if was successful or not. This
default implementation uses a StreamCloserService to close any Closeable resources found on the result
event's payloadjobInstance - the BatchJobInstanceAdapter for which execution was doneoriginalEvent - the CoreEvent originally passed to messageProcessorresultEvent - the result CoreEventorg.mule.runtime.api.exception.MuleExceptionprotected abstract void onException(BatchJobInstanceAdapter jobInstance, Exception e, org.mule.runtime.core.api.event.CoreEvent event) throws org.mule.runtime.api.exception.MuleException
messageProcessor throws exception or the result event carries a
ExceptionPayloadjobInstance - the BatchJobInstance for which execution is being donee - the Exception thrown or found in the ExceptionPayloadevent - the CoreEvent for which the exception occurredorg.mule.runtime.api.exception.MuleExceptionprotected abstract void onSuccess(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent responseEvent) throws org.mule.runtime.api.exception.MuleException
messageProcessor is execute without any exceptionsjobInstance - the BatchJobInstance for which execution is being doneresponseEvent - the response CoreEventorg.mule.runtime.api.exception.MuleExceptionCopyright © 2006–2022 MuleSoft, Inc.. All rights reserved.