Announcement Announcement Module
Collapse
No announcement yet.
Job-step configuration question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Job-step configuration question

    I am attempting to execute a secondary job via a job-step in a primary job. My secondary job can also be initiated by a scheduler and therefore has a jobparameter binding in the reader to identify the correct load to work on.
    My issue is that the "loadid" parameter is not set wihen the job is kicked off inside the parent job. Is there any way to set the parameter as defined?

    the configuration is as follows:
    Code:
    <batch:job id="aLoadJob">
    	<batch:step id="readDWLoad">	
    			<batch:tasklet>
    				<batch:chunk reader="reader" processor="processor" writer="writer" commit-interval="200">
    				</batch:chunk>
    			<batch:fail on="FAILED" exit-code="FAILED"/>
    			<batch:fail on="NO WORK" exit-code="JOB-ENDED-NO-WORK"/>
    			<batch:next on="*" to="reconcileJob"/>
    		</batch:step>
    
    	 	<batch:step id="reconcileJob">
    	 		<batch:job ref="importReconciliationJob" job-parameters-extractor="jobParametersExtractor1"/>	
    			<batch:fail on="FAILED" exit-code="FAILED"/>
    			<batch:fail on="NO WORK" exit-code="JOB-ENDED-NO-WORK"/>
    			<batch:next on="*" to="post-process/>
    		</batch:step>
    	</batch:job>
    
    The reconcile Job looks like this:
    <batch:job id="importReconciliationJob">
    		<batch:step id="processResults">
    			<batch:tasklet>
    				<batch:chunk reader="resultsReader" processor="resultsProcessor" writer="resultsWriter" commit-interval="200">
    				</batch:chunk>
    			</batch:tasklet>
    			<batch:fail on="FAILED" exit-code="FAILED"/>
    			 <batch:next  on="*" to="sendResults"/> 
    		</batch:step>
    </batch:job>
    where the resultsReader is defined as:
    	<bean id="resultsReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" 
    		 scope="step">
    		<property name="dataSource" ref="hsqDataSource" />
    		<property name="sql" value="
    		Select 
    			EXCEPTION_MSG,
    			OBJECT_KEY,
    			ORIG_VALUE,
    			DW_VALUE,
    			COL_NAME,
    			MSG_DATE 
    		from RECONCILER_DATA
    		WHERE LOAD_ID = #{jobParameters['loadid']} 
    		group by 
    			EXCEPTION_MSG,
    			OBJECT_KEY,
    			ORIG_VALUE,
    			DW_VALUE,
    			COL_NAME,
    			MSG_DATE"/> 
    		<property name="rowMapper">
    			<bean class="aRowMapper" />
    		</property>		
    	</bean>

  • #2
    Problem resolved

    Turns out that the :

    <bean class="org.springframework.batch.core.scope.StepSc ope" />

    Bean definition had been removed from an included context file. All is working as expected now.

    Comment

    Working...
    X