Reputation: 370
I currently have a Spring Integration-JDBC implementation up and running that polls a db table for records and then sends valid records to be processed by Spring Batch. I'm in the process of adding an additional table monitor to the project, and an additional batch job, but I'm uncertain what nuts and bolts of Batch need to be unique to the other task, and what can/should be reused?
Spring Batch Job Setup:
<bean id="jobOperator" class="org.springframework.batch.core.launch.support.SimpleJobOperator">
<property name="jobExplorer">
<bean class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>
</property>
<property name="jobRepository" ref="jobRepository" />
<property name="jobRegistry" ref="jobRegistry" />
<property name="jobLauncher" ref="jobLauncher" />
</bean>
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry"/>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
Should I be making a jobOperator2, JobLauncher2, ... for all of these?
Upvotes: 3
Views: 405
Reputation: 121552
No, those are fine and should be as single instance per application and per job store.
All you need a new job definition for that new task.
See more information in the Reference Manual.
Upvotes: 3