Announcement Announcement Module
Collapse
No announcement yet.
async steps Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • async steps

    Hi all,

    I have a simple (I hope :-)) question for the spring batch users.

    I'm trying to understad if spring batch is the correct tool I have to use. What I need to do is the following:

    1. Step A add a row in a db shared table
    2. Step B read the row and start a specific step based on what the other step has written

    As you can see the scenario is pretty simple; the complexity, at least for me, is to allow the step B to launch a new step/job in async way.
    In this way, the step B can run some parallel substeps that execute a set of actions.

    Do you think is it possible to achieve that? If yes, can you indicate me how?

    Thanks,
    Danilo

  • #2
    In terms of Spring Batch to do the parallel steps is very easy:

    Code:
    <batch:job id="myJob">
    	<!-- Below defined steps will be run in parallel: -->
    	<batch:split id="jobSplit" task-executor="taskExecutor">
    		<batch:flow>
    			<batch:step id="stepA">
    				<batch:tasklet>
    					<batch:chunk reader="..." processor="..." writer="..." />
    				</batch:tasklet>
    			</batch:step>
    		</batch:flow>
    		<batch:flow>
    			<batch:step id="stepB">
    				<batch:tasklet>
    					<batch:chunk reader="..." processor="..." writer="..." />
    				</batch:tasklet>
    			</batch:step>
    		</batch:flow>
    	</batch:split>
    </batch:job>
    But how will you implement stepB? Will you poll the database periodically? I would suggest to use Message Queue to communicate between stepA and stepB – that would be more efficient.

    Comment

    Working...
    X