More detail to the problem:
We are trying to get data via a REST call from a db, process it (no details necessary) and write it to other tables in another database.
The connection to the REST service must be auth'd using kerberos,
Code:
<bean id="abstractReader" class="org.springframework.batch.item.xml.StaxEventItemReader"
abstract="true">
<property name="fragmentRootElementName" value="PersonCoverage" />
<property name="unmarshaller" ref="personCoverageMarshaller" />
<property name="strict" value="false" />
</bean>
<bean id="personReader" parent="abstractReader">
<property name="resource" ref="personUrlResource" />
</bean>
<bean id="personUrlResource" class="com.blah.reader.KerberisedUrlResource"
scope="step">
<!-- we think the issue is here as jobParameters is out of scope to this bean-->
<constructor-arg value="#{jobParameters['url.PERSON']}" />
</bean>
here the url needs to be passed to the URL resource,
the job
Code:
<job job-repository="jobRepository" id="mgrmaint2tm"
xmlns="http://www.springframework.org/schema/batch">
<step id="divLoad" next="allOrgLoad">
<tasklet>
<listeners>
<listener ref="stepListener" />
</listeners>
<chunk reader="divReader" processor="corpIdProcessor" writer="divWriter"
commit-interval="${chunk.commit.interval}" />
</tasklet>
</step>
<step id="allOrgLoad" next="ccLoad">
<tasklet>
<listeners>
<listener ref="stepListener" />
</listeners>
<chunk reader="allOrgReader" processor="corpIdProcessor"
writer="allOrgWriter" commit-interval="${chunk.commit.interval}" />
</tasklet>
</step>
<step id="ccLoad" next="personLoad">
<tasklet>
<listeners>
<listener ref="stepListener" />
</listeners>
<chunk reader="ccReader" processor="corpIdProcessor" writer="ccWriter"
commit-interval="${chunk.commit.interval}" />
</tasklet>
</step>
<step id="personLoad">
<tasklet>
<listeners>
<listener ref="stepListener" />
</listeners>
<chunk reader="personReader" processor="corpIdProcessor"
writer="personWriter" commit-interval="${chunk.commit.interval}" />
</tasklet>
</step>
</job>
As the rest url, the job paramater will have two parameters,
A, B where A is like the company (of which there are more than one) and B like dept where there are (roughly) 4 of each to 1 A.
so:
http://restcall?A=A1&B=B1
http://restcall?A=A1&B=B2
http://restcall?A=A2&B=B1
http://restcall?A=A2&B=B2 so on so forth.
The ultimate goal is to have one job which is run many times changing depending on the job parameters.
But as the kererisedURL resource is outwith the scope of the jobparameters within a job, the url cant be dynamically. we cant pass the REST url and have it auth via the kerbURLresource class/bean.