Batch controller bean
In its deployment descriptor, a batch application is required to declare a special stateless session bean. This bean acts as a batch job controller.
Each application can include only a single controller bean. We can only include a controller bean in a single work class, and a batch application can only have a single work class defined. This single work class is created when the application is installed. We can associate this work class with any service policy that has discretionary or queue-time goal type. The implementation of this bean is provided by the product, not by the batch application. The bean must be declared in the batch application deployment descriptor. Only one controller bean per batch application can be defined. The resource references and EJB references declared on the controller bean are available to batch data streams of the batch application in which the controller bean is declared. For example, if a batch data stream in the application needs access to a WAS data source, then a resource reference to that data source can be declared on the controller bean, and the batch data stream can look up the data source at run time in the java:comp/env name space.
Restrictions:
- The home interface must be com.ibm.ws.batch.BatchJobControllerHome.
- The remote interface must be com.ibm.ws.batch.BatchJobController.
- The EJB class must be com.ibm.ws.batch.BatchJobControllerBean.
- The transaction type can be bean or container.
- The session type must be stateless.
- There can be at most one batch controller stateless session bean per batch application.
The following example deployment descriptor illustrates a batch controller stateless session bean:
<session id="BatchController> <ejb-name>BatchController</ejb-name> <home>com.ibm.ws.batch.BatchJobControllerHome</home> <remote>com.ibm.ws.batch.BatchJobController</remote> <ejb-class>com.ibm.ws.batch.BatchJobControllerBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Bean</transaction-type> <resource-ref id="ResourceRef_1117024737807"> <description></description> <res-ref-name>wm/BatchWorkManager</res-ref-name> <res-type>commonj.work.WorkManager</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> </session>
Related concepts
Batch programming model