@NoImplement public interface BatchEngine extends BatchProcessingListenersOwner
BatchJobInstance| Modifier and Type | Method and Description |
|---|---|
void |
cancel(BatchJobInstanceAdapter jobInstance)
Stops the jobInstance if it's executing (by delegating into
stopExecution(BatchJobInstanceAdapter, boolean). |
void |
cancelAllRunningInstance()
Invokes
cancel(BatchJobInstanceAdapter) on every running instance of any job |
org.mule.runtime.core.api.event.CoreEvent.Builder |
createEventBuilder(Record record,
BatchJobInstanceAdapter jobInstance)
Creates a new
CoreEvent.Builder with the base attributes set for a CoreEvent to process the given record for the given
jobInstance. |
org.mule.runtime.core.api.event.CoreEvent.Builder |
createEventBuilder(Record record,
BatchJobInstanceAdapter jobInstance,
CompletableFuture<Void> externalCompletion)
Creates a new
CoreEvent.Builder with the base attributes set for a CoreEvent to process the given record for the given
jobInstance. |
BatchJobInstanceAdapter |
createNewJobInstance(BatchJobAdapter job,
org.mule.runtime.core.api.event.CoreEvent event)
Creates and initialises a new
BatchJobInstanceAdapter related to the given job. |
BatchTransactionContext |
createTransactionContext(BatchJobInstanceAdapter jobInstance)
Creates a new BatchTransactionContext referencing the given {@link BatchJobInstanceAdapter}
|
BatchJobInstanceAdapter |
finishExecution(BatchJobInstanceAdapter jobInstance,
boolean shouldRefresh)
Ends the execution of the given
jobInstance |
Collection<BatchJob> |
getBatchJobs()
Returns all defined
BatchJobs |
BatchQueueManager |
getBatchQueueManager()
Returns the
BatchQueueManager in which queueing operations are
delegated |
BatchTransactionContextFactory |
getBatchTransactionContextFactory()
For monitoring and testing purposes only
|
List<Record> |
getBlockFrom(BatchTransactionContext context)
Returns the records in the stepping queue which corresponds to the
BatchJobInstance referenced by the given
context |
int |
getBlockSize(com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance jobInstance)
|
Optional<BatchJob> |
getJob(String jobName) |
BatchJobAdapter |
getJobFor(com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance jobInstance)
Returns the owning
BatchJobAdapter for the given BatchJobInstance |
BatchJobInstanceStore |
getJobInstanceStore()
Returns the
BatchJobInstanceStore in which persistence operations are delegated on |
Lock |
getLock(BatchJobInstanceAdapter jobInstance)
Obtains a
Lock for the given jobInstance. |
long |
getSteppingQueueSize(BatchTransactionContext context)
Deprecated.
on 4.3.0, use
getBlockFrom(BatchTransactionContext) |
BatchJobInstanceAdapter |
load(BatchJobInstanceAdapter jobInstance,
org.mule.runtime.core.api.event.CoreEvent muleEvent)
Splits the
CoreEvent payload and loads it into the BatchJobInstanceAdapter queue. |
void |
registerBatchJob(BatchJobAdapter batchJob) |
void |
releaseResources(BatchJobInstanceAdapter jobInstance,
boolean includeFailedRecords)
Releases the resources still allocated to the given
BatchJobInstanceAdapter, including queues and storage |
void |
resumeExecution(BatchJobInstanceAdapter jobInstance)
Resumes execution of a
BatchJobInstance which was stopped through the
stopExecution(BatchJobInstanceAdapter, boolean) method. |
void |
startExecution(BatchJobInstanceAdapter jobInstance)
Starts asynchronous execution of the given
BatchJobInstanceAdapter. |
void |
stopExecution(BatchJobInstanceAdapter jobInstance,
boolean markAsFailed)
Stops the execution of the given
BatchJobInstanceAdapter. |
BatchJobInstanceAdapter |
updateStatisticsAndRoute(BatchTransactionContext ctx,
List<Record> records) |
addBatchProcessingListener, addBatchProcessingListener, removeBatchProcessingListener, removeBatchProcessingListenervoid registerBatchJob(BatchJobAdapter batchJob)
BatchJobInstanceAdapter createNewJobInstance(BatchJobAdapter job, org.mule.runtime.core.api.event.CoreEvent event) throws org.mule.runtime.api.exception.MuleException
BatchJobInstanceAdapter related to the given job. The returned instance will be already
persistedjob - the BatchJobAdapter being executedevent - the CoreEvent that triggered the job's executionBatchJobInstanceAdapterorg.mule.runtime.api.exception.MuleExceptionBatchTransactionContext createTransactionContext(BatchJobInstanceAdapter jobInstance)
jobInstance - a not null BatchJobInstanceAdapterBatchTransactionContextvoid startExecution(BatchJobInstanceAdapter jobInstance) throws org.mule.runtime.api.exception.MuleException
BatchJobInstanceAdapter. The instance will be persisted at this point and
will become elegible for execution by the steps. It also fires a BatchNotification.JOB_PROCESS_RECORDS_BEGIN
notificationjobInstance - the BatchJobInstanceAdapter to be executedorg.mule.runtime.api.exception.MuleExceptionvoid stopExecution(BatchJobInstanceAdapter jobInstance, boolean markAsFailed) throws org.mule.runtime.api.exception.MuleException
BatchJobInstanceAdapter. This doesn't mean that all threads processing records will
immediately stop. It means that no more records will be taken out of the queue and start processing. All records currently
being processed will complete their normal execution. if markAsFailed is true the jobInstance status will be set
to BatchJobInstanceStatus.FAILED_PROCESS_RECORDS and a BatchNotification.JOB_PROCESS_RECORDS_FAILED
notification will be fired. Otherwise, the status will be set to BatchJobInstanceStatus.STOPPED and a
BatchNotification.JOB_STOPPED notification is fired instead.jobInstance - a BatchJobInstanceAdaptermarkAsFailed - if true the jobInstance status will be set to
BatchJobInstanceStatus.FAILED_PROCESS_RECORDS. Otherwise it will be set to
BatchNotification.JOB_STOPPEDorg.mule.runtime.api.exception.MuleExceptionvoid resumeExecution(BatchJobInstanceAdapter jobInstance) throws org.mule.runtime.api.exception.MuleException
BatchJobInstance which was stopped through the
stopExecution(BatchJobInstanceAdapter, boolean) method.
Execution is resumed by setting the job instance status back to BatchJobInstanceStatus.EXECUTING. The
BatchNotification.JOB_PROCESS_RECORDS_BEGIN notification will be fired again.jobInstance - the BatchJobInstanceAdapter to be resmedIllegalStateException - if the BatchJobInstance is in a state other than BatchJobInstanceStatus.STOPPEDorg.mule.runtime.api.exception.MuleException - in case of unhandled errorvoid cancel(BatchJobInstanceAdapter jobInstance) throws org.mule.runtime.api.exception.MuleException
stopExecution(BatchJobInstanceAdapter, boolean). Finally, the instance's resources are released (by
delegating into releaseResources(BatchJobInstanceAdapter, boolean) and a
BatchNotification.JOB_CANCELLED notification is firedjobInstance - a BatchJobInstanceAdapterorg.mule.runtime.api.exception.MuleExceptionvoid cancelAllRunningInstance()
throws org.mule.runtime.api.exception.MuleException
cancel(BatchJobInstanceAdapter) on every running instance of any joborg.mule.runtime.api.exception.MuleExceptionorg.mule.runtime.core.api.event.CoreEvent.Builder createEventBuilder(Record record, BatchJobInstanceAdapter jobInstance)
CoreEvent.Builder with the base attributes set for a CoreEvent to process the given record for the given
jobInstance. This method will create a copy of the original event that generated the jobInstance, will set the record's
payload as the message payload and will put the record in an invocation property under the key in
BatchProperties.RECORD_VARIABLE_NAMErecord - an instance of RecordjobInstance - an instance of BatchJobInstanceAdapterCoreEvent.Builderorg.mule.runtime.core.api.event.CoreEvent.Builder createEventBuilder(Record record, BatchJobInstanceAdapter jobInstance, CompletableFuture<Void> externalCompletion)
CoreEvent.Builder with the base attributes set for a CoreEvent to process the given record for the given
jobInstance. This method will create a copy of the original event that generated the jobInstance, will set the record's
payload as the message payload and will put the record in an invocation property under the key in
BatchProperties.RECORD_VARIABLE_NAMErecord - an instance of RecordjobInstance - an instance of BatchJobInstanceAdapterexternalCompletion - A custom completion callback for the event context. If null, then default completion will
be usedCoreEvent.BuilderBatchJobInstanceAdapter load(BatchJobInstanceAdapter jobInstance, org.mule.runtime.core.api.event.CoreEvent muleEvent) throws org.mule.runtime.api.exception.MuleException
CoreEvent payload and loads it into the BatchJobInstanceAdapter queue. If this process fails, the
job instance's resources are released.jobInstance - a BatchJobInstanceAdaptermuleEvent - a CoreEvent which payload is splittableBatchJobInstanceAdapter which state has been updated to reflect this operation's resultorg.mule.runtime.api.exception.MuleExceptionBatchJobInstanceStore getJobInstanceStore()
BatchJobInstanceStore in which persistence operations are delegated onBatchJobInstanceBatchQueueManager getBatchQueueManager()
BatchQueueManager in which queueing operations are
delegatedBatchQueueManagerBatchJobInstanceAdapter updateStatisticsAndRoute(BatchTransactionContext ctx, List<Record> records) throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleException@Deprecated long getSteppingQueueSize(BatchTransactionContext context)
getBlockFrom(BatchTransactionContext)BatchJobInstance referenced by the given
contextcontext - the context for a current transactionvoid releaseResources(BatchJobInstanceAdapter jobInstance, boolean includeFailedRecords)
BatchJobInstanceAdapter, including queues and storagejobInstance - a BatchJobInstanceAdapterincludeFailedRecords - if true, the stored failed records will also be wiped out.BatchJobAdapter getJobFor(com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance jobInstance)
BatchJobAdapter for the given BatchJobInstancejobInstance - a BatchJobInstanceBatchJobAdapterCollection<BatchJob> getBatchJobs()
BatchJobsCollection of BatchJob. The collection might be empty but will never be nullint getBlockSize(com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance jobInstance)
jobInstance - a BatchJobInstanceLock getLock(BatchJobInstanceAdapter jobInstance)
Lock for the given jobInstance. Invoking this method with difference instances which share the same
id, will always return the same lockjobInstance - a BatchJobInstanceAdapterLockBatchJobInstanceAdapter finishExecution(BatchJobInstanceAdapter jobInstance, boolean shouldRefresh) throws org.mule.runtime.api.exception.MuleException
jobInstancejobInstance - a BatchJobInstanceAdaptershouldRefresh - whether the instance should be reloaded from the store to update its stateBatchJobInstanceAdapterorg.mule.runtime.api.exception.MuleExceptionBatchTransactionContextFactory getBatchTransactionContextFactory()
BatchTransactionContextFactoryList<Record> getBlockFrom(BatchTransactionContext context)
BatchJobInstance referenced by the given
contextcontext - the context for a current transactionCopyright © 2006–2022 MuleSoft, Inc.. All rights reserved.