Class RemoteStep
java.lang.Object
org.springframework.batch.core.step.AbstractStep
org.springframework.batch.integration.remote.RemoteStep
- All Implemented Interfaces:
Step
,StoppableStep
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
A
Step
implementation that delegates the
execution to a remote worker step through messaging.
The remote worker step must be listening to the same message channel to receive step execution requests.
The step execution is created locally and sent to the remote worker step which will
update its status and context in the job repository. The RemoteStep
will poll
the job repository to check for step completion.
- Since:
- 6.0.0
- Author:
- Mahmoud Ben Hassine
-
Field Summary
Fields inherited from class org.springframework.batch.core.step.AbstractStep
observationRegistry
Fields inherited from interface org.springframework.batch.core.step.Step
STEP_TYPE_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteStep
(String name, String remoteStepName, JobRepository jobRepository, org.springframework.integration.core.MessagingTemplate messagingTemplate) Create a newRemoteStep
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doExecute
(StepExecution stepExecution) Extension point for subclasses to execute business logic.void
setMessageChannel
(org.springframework.messaging.MessageChannel messageChannel) void
setPollInterval
(long pollInterval) void
setTimeout
(long timeout) Methods inherited from class org.springframework.batch.core.step.AbstractStep
afterPropertiesSet, close, doExecutionRegistration, doExecutionRelease, execute, getCompositeListener, getJobRepository, getName, getStartLimit, isAllowStartIfComplete, open, registerStepExecutionListener, setAllowStartIfComplete, setBeanName, setJobRepository, setName, setObservationRegistry, setStartLimit, setStepExecutionListeners, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.batch.core.step.StoppableStep
stop
-
Constructor Details
-
RemoteStep
public RemoteStep(String name, String remoteStepName, JobRepository jobRepository, org.springframework.integration.core.MessagingTemplate messagingTemplate) Create a newRemoteStep
instance.- Parameters:
name
- the name of this stepremoteStepName
- the name of the remote worker step to executejobRepository
- the job repository to usemessagingTemplate
- the messaging template to use to send step execution requests
-
-
Method Details
-
setTimeout
public void setTimeout(long timeout) -
setPollInterval
public void setPollInterval(long pollInterval) -
setMessageChannel
public void setMessageChannel(org.springframework.messaging.MessageChannel messageChannel) -
doExecute
Description copied from class:AbstractStep
Extension point for subclasses to execute business logic. Subclasses should set theExitStatus
on theStepExecution
before returning.- Specified by:
doExecute
in classAbstractStep
- Parameters:
stepExecution
- the current step context- Throws:
Exception
- checked exception thrown by implementation
-