public class DefaultBatchJob extends org.mule.runtime.api.component.AbstractComponent implements BatchJobAdapter, org.mule.runtime.core.api.processor.Processor, org.mule.runtime.api.lifecycle.Lifecycle
ANNOTATION_NAME, LOCATION_KEY, ROOT_CONTAINER_NAME_KEYDEFAULT_MAX_CONCURRENCY| Constructor and Description |
|---|
DefaultBatchJob(String name,
int blockSize,
org.mule.runtime.core.api.MuleContext muleContext)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance |
execute(org.mule.runtime.core.api.event.CoreEvent event)
Executes the batch and generates a
BatchJobInstance in loading state |
String |
generateJobInstanceId(org.mule.runtime.core.api.event.CoreEvent event)
Generates an id by evaluating the
jobInstanceIdExpression on the given event. |
BatchEngine |
getBatchEngine() |
BatchJobInstanceSchedulingStrategy |
getBatchJobInstanceSchedulingStrategy() |
int |
getBlockSize()
For performance reasons, batch records are queued and scheduled in blocks.
|
HistoryExpirationPolicy |
getHistoryExpirationPolicy() |
int |
getMaxConcurrency() |
int |
getMaxFailedRecords()
The number of max records allowed to fail before failing the job
|
org.mule.runtime.core.api.MuleContext |
getMuleContext() |
String |
getName() |
Optional<org.mule.runtime.core.api.processor.Processor> |
getOnCompleteBlock()
The job's on complete block if configured
|
org.mule.runtime.core.api.processor.ReactiveProcessor.ProcessingType |
getProcessingType() |
BatchStepAdapter |
getStepById(String stepId)
Returns the step of the given id
|
List<BatchStep> |
getSteps() |
protected void |
initExpirationPolicy() |
void |
initialise() |
org.mule.runtime.core.api.event.CoreEvent |
process(org.mule.runtime.core.api.event.CoreEvent event) |
void |
setBatchEngine(BatchEngine batchEngine) |
void |
setBatchJobInstanceSchedulingStrategy(BatchJobInstanceSchedulingStrategy batchJobInstanceSchedulingStrategy) |
void |
setHistoryExpirationPolicy(HistoryExpirationPolicy historyExpirationPolicy) |
void |
setJobInstanceIdExpression(String jobInstanceIdExpression) |
void |
setMaxConcurrency(int maxConcurrency) |
void |
setMaxFailedRecords(int maxFailures) |
void |
setOnCompleteBlock(BatchMessageBlock onCompleteBlock) |
void |
setRecordProcessors(BatchRecordProcessors recordProcessors) |
void |
setTarget(String target) |
void |
setTargetValue(String targetValue) |
void |
start() |
void |
stop() |
void |
submitWork(Runnable before,
Runnable work,
Runnable after)
Schedules the given work to be executed.
|
getAnnotation, getAnnotations, getDslSource, getIdentifier, getLocation, getRepresentation, getRootContainerLocation, initRootContainerName, setAnnotationsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DefaultBatchJob(String name, int blockSize, org.mule.runtime.core.api.MuleContext muleContext)
name - the job's nameblockSize - the size of the block to be used for storing/scheduling recordsmuleContext - the application's MuleContextpublic void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic void start()
throws org.mule.runtime.api.exception.MuleException
start in interface org.mule.runtime.api.lifecycle.Startableorg.mule.runtime.api.exception.MuleExceptionpublic void stop()
throws org.mule.runtime.api.exception.MuleException
stop in interface org.mule.runtime.api.lifecycle.Stoppableorg.mule.runtime.api.exception.MuleExceptionpublic void dispose()
dispose in interface org.mule.runtime.api.lifecycle.Disposableprotected void initExpirationPolicy()
throws org.mule.runtime.api.lifecycle.InitialisationException
org.mule.runtime.api.lifecycle.InitialisationExceptionpublic String getName()
getName in interface org.mule.runtime.api.meta.NamedObjectpublic void submitWork(Runnable before, Runnable work, Runnable after)
BatchJobAdapterMuleContext is stopped or stopping, or
this job adapter is stopped, then the work is silently discarded and the context is rolled back.submitWork in interface BatchJobAdapterbefore - a callback to be run right before workwork - a javax.resource.spi.work.Workpublic org.mule.runtime.core.api.event.CoreEvent process(org.mule.runtime.core.api.event.CoreEvent event)
throws org.mule.runtime.api.exception.MuleException
process in interface org.mule.runtime.core.api.processor.Processororg.mule.runtime.api.exception.MuleExceptionpublic com.mulesoft.mule.runtime.module.batch.api.BatchJobInstance execute(org.mule.runtime.core.api.event.CoreEvent event)
throws org.mule.runtime.api.exception.MuleException
BatchJobAdapterBatchJobInstance in loading stateexecute in interface BatchJobAdapterevent - an instance of CoreEventBatchJobInstanceorg.mule.runtime.api.exception.MuleExceptionpublic Optional<org.mule.runtime.core.api.processor.Processor> getOnCompleteBlock()
getOnCompleteBlock in interface BatchJobAdapterProcessor or nullpublic void setOnCompleteBlock(BatchMessageBlock onCompleteBlock)
public BatchStepAdapter getStepById(String stepId)
getStepById in interface BatchJobAdapterstepId - the id of a stepBatchStepAdapterpublic BatchEngine getBatchEngine()
getBatchEngine in interface BatchJobAdapterpublic String generateJobInstanceId(org.mule.runtime.core.api.event.CoreEvent event)
jobInstanceIdExpression on the given event. The
jobInstanceIdExpression is expected to return a non blank StringgenerateJobInstanceId in interface BatchJobAdapterevent - a CoreEventStringorg.mule.runtime.api.exception.MuleRuntimeException - if the expression returned null, a blank String or something of another typepublic void setBatchEngine(BatchEngine batchEngine)
public void setRecordProcessors(BatchRecordProcessors recordProcessors)
public int getMaxFailedRecords()
getMaxFailedRecords in interface BatchJobpublic int getBlockSize()
getBlockSize in interface BatchJobAdapterpublic void setMaxFailedRecords(int maxFailures)
public org.mule.runtime.core.api.processor.ReactiveProcessor.ProcessingType getProcessingType()
getProcessingType in interface org.mule.runtime.core.api.processor.ReactiveProcessorpublic BatchJobInstanceSchedulingStrategy getBatchJobInstanceSchedulingStrategy()
getBatchJobInstanceSchedulingStrategy in interface BatchJobAdapterpublic void setBatchJobInstanceSchedulingStrategy(BatchJobInstanceSchedulingStrategy batchJobInstanceSchedulingStrategy)
public void setJobInstanceIdExpression(String jobInstanceIdExpression)
public HistoryExpirationPolicy getHistoryExpirationPolicy()
getHistoryExpirationPolicy in interface BatchJobAdapterpublic int getMaxConcurrency()
getMaxConcurrency in interface BatchJobAdapterpublic org.mule.runtime.core.api.MuleContext getMuleContext()
getMuleContext in interface BatchJobAdapterpublic void setHistoryExpirationPolicy(HistoryExpirationPolicy historyExpirationPolicy)
public void setMaxConcurrency(int maxConcurrency)
public void setTarget(String target)
public void setTargetValue(String targetValue)
Copyright © 2006–2022 MuleSoft, Inc.. All rights reserved.