java - Spring - Rerun batch job after final step complete -
i've written batch job processing on message pulls queue. reads in message, processes, removes queue. want job go first step (seeing if message exists) after removes previous message queue. if message exists, go through of steps again. if no message exists, job complete.
i'm trying implement job decider this.
right xml configuration is:
<j:decision decider="jobstarter" id="startjob"> <j:next on="start_step" to="producecloseoutmessage" /> <j:end on="completed" /> <j:fail on="failed" /> </j:decision>
but i'm not sure how implement decider itself. have queue reader class i've implemented actual check of queue see if message exists or not. should calling method in decider?
i know current implementation of decider wrong i've included below anyway:
protected static final flowexecutionstatus start_step = new flowexecutionstatus("start_step"); protected static final flowexecutionstatus end_job = flowexecutionstatus.completed; protected static final flowexecutionstatus failed = flowexecutionstatus.failed; private queuereader queuereader; public jobdecider(queuereader queuereader){ this.queuereader = queuereader; } @override public flowexecutionstatus decide(jobexecution jobexecution, stepexecution stepexecution) { flowexecutionstatus flowexecutionstatus; flowexecutionstatus = jobdecider.start_step; try { if(!queuereader.receivemessage().isempty()){ flowexecutionstatus = wmflgintjobdecider.start_step; } else{ flowexecutionstatus = wmflgintjobdecider.end_job; } } catch (jmsexception e) { flowexecutionstatus = wmflgintjobdecider.failed; e.printstacktrace(); } return flowexecutionstatus; }
edit: think might have solution. i've updated code above in decider.
Comments
Post a Comment