Enabling multiple server partitions support by using the Liberty embedded messaging provider
You can set up the batch environment to have servers function as batch dispatchers, while other servers function as batch executors.
Before you begin
- Determine where the embedded message engine is hosted. It can be hosted on the batch dispatch server, the batch executor server, or on a separate server. This server must be configured before you complete this task. The JMS connection factory and activation specification references the message engine server in its configuration.
- To configure the message engine:
- Add the wasJmsServer-1.0 feature to the server.xml.
- Define the message engine by adding the messageEngine element. Define the
queue that is used for the batch dispatcher and batch executor. The following example illustrates
the message engine configuration in your server.xml
file:
<!-specify the ports for the message engine. The ports in this example are the default ports. This element is not needed when the default ports are used. --> <wasJmsEndpoint host="*" wasJmsPort="7280" wasJmsSSLPort="7290" enabled="true"> </wasJmsEndpoint> <messagingEngine> <!- queue for batch jms message. --> <queue id="batchLibertyQueue" forceReliability="ReliablePersistent" receiveAllowed="true"/> </messagingEngine>
About this task
Batch dispatchers accept requests from external clients and make them available to the batch executors. The batch executors receive requests that match its defined capabilities and execute those requests. If the job is configured to run partitions, the batch executors make them available to the other executors to run. The batch executors communicate with each other by using Java Messaging Service (JMS). This task helps you configure the batch dispatch server and the batch executor by using the Liberty embedded messaging provider.
Procedure
- Configure the batch JMS dispatcher.
- Enable JMS support by adding the wasJmsClient-2.0 feature to the feature manager in your server.xml file.
- Add the batchJmsDispatcher element to your server.xml
file on the server that hosts the batch dispatcher; for example:
<batchJmsDispatcher connectionFactoryRef={reference to a configured JMS connection factory} queueRef={reference to a configured JMS queue} />
Note: If you do not specify the connectionFactoryRef and queueRef attributes, the default value for connectionFactoryRef is batchConnectionFactory and the default value for queueRef is batchJobSubmissionQueue. You can specify the batchJmsDispatcher element as <batchJmsDispatcher/>. You still must configure the batchConnectionFactory JMS connection factory and the JMS batchJobSubmissionQueue queue in the server.xml file. - Add the corresponding JMS connection factory and JMS queue to the server configuration. This is
not specific to batch configuration. The following example illustrates the batch JMS dispatcher configuration and its JMS
configuration:Note: The remoteServerAddress attribute points to the host:port of the server that is hosting the Liberty message engine.
<batchJmsDispatcher connectionFactoryRef="batchConnectionFactory" queueRef="batchJobSubmissionQueue" /> <jmsConnectionFactory id="batchConnectionFactory" jndiName="jms/batch/connectionFactory"> <properties.wasJms remoteServerAddress="host:7280:BootstrapBasicMessaging"> </properties.wasJms> </jmsConnectionFactory> <jmsQueue id="batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue"> <properties.wasJms deliveryMode="Persistent" queuename="batchLibertyQueue"> </properties.wasJms> </jmsQueue>
Note: Ensure that you are referencing a jmsConnectionFactory element, as shown in the example, and not a jmsQueueConnectionFactory element. Using a jmsQueueConnectionFactory element will not work. Your configuration should include both a jmsConnectionFactory element and a jmsQueue element, but not a jmsQueueConnectionFactory element.
- Configure the batch JMS executor for executing batch jobs.
- Enable JMS support by adding the wasJmsClient-2.0 feature to the feature manager in your server.xml file.
- Add the batchJmsDispatcher element to your server.xml
file on the server that hosts the batch executor.
<batchJmsExecutor activationSpecRef={configured activation specification or batch executor} queueRef={reference to the configured JMS queue} />
Note: If you do not add the batchJmsDispatcher element to your server.xml file, the server will not dispatch partitions to run on multiple servers and will run the partitions locally.Note: If you do not specify the connectionFactoryRef and queueRef attributes, the default value for connectionFactoryRef is batchConnectionFactory and the default value for queueRef is batchJobSubmissionQueue. You can specify the batchJmsDispatcher element as <batchJmsDispatcher/>. You still must configure the batchConnectionFactory JMS connections factory and the batchJobSubmissionQueue in the server.xml file. - Add the corresponding JMS connection factory and JMS queue to the server configuration. This is not specific to batch configuration. The following example illustrates the batch JMS
dispatcher configuration and its JMS configuration:Note: The remoteServerAddress attribute points to the host:port of the server that is hosting the Liberty message engine.
<batchJmsDispatcher connectionFactoryRef="batchConnectionFactory" queueRef="batchJobSubmissionQueue" /> <jmsConnectionFactory id="batchConnectionFactory" jndiName="jms/batch/connectionFactory"> <properties.wasJms remoteServerAddress="host:7280:BootstrapBasicMessaging"> </properties.wasJms> </jmsConnectionFactory> <jmsQueue id='batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue"> <properties.wasJms deliveryMode="Persistent" queuename="batchLibertyQueue"> </properties.wasJms> </jmsQueue>
- Add the batchJmsExecutor element to your server.xml
on the server that hosts the batch executor; for example:
<batchJmsExecutor activationSpecRef={configured activation specification or batch executor} queueRef={reference to the configured JMS queue} />
Note: If you do not specify the activationSpecRef and queueRef attributes, the default value for activationSpecRef is batchConnectionFactory and the default value for queueRef is batchJobSubmissionQueue. You can specify the batchJmsExecutor element as <batchJmsExecutor/>. You still must configure the JMS activation specification for batchActivationSpec and the batchJobSubmissionQueue queue in the server.xml file. - Add the corresponding JMS activation specification and JMS queue to the server configuration. This is not specific to batch configuration.
- Define batch executor server capabilities by including a JMS message selector in the activation
specification.
- Filter based on system-defined properties:
The following batch dispatcher properties are available on the batch JMS message that the batch executor can use to filter for inbound messages.
- com_ibm_ws_batch_applicationName: the name of the batch application for the job request
- com_ibm_ws_batch_moduleName: the module name of the batch application for the job request
- com_ibm_ws_batch_componentName: the component name of the batch application for the job request
- com_ibm_ws_batch_work_type: the work type : "Job"
Note: Specify a message selector with at least the com_ibm_ws_batch_applicationName property to ensure that the executor only receives jobs that it can process.The following example indicates the messageSelector attribute for the executor to accept only batch jobs for the application SimpleBatchJob:messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND com_ibm_ws_batch_work_type = 'Job'">
- Filtering based on user-defined properties:
The batch dispatcher sets all job parameters that conform to the proper JMS message property on the batch dispatcher request message. These properties can also be used by the message selector to add extra filtering to the message selector. The property name, or identifier, must conform to JMS message property constraints. For example, the property is an unlimited length sequence of letters and digits, the first of which must be a letter. A letter is any character for which the method Character.isJavaLetter returns true, and includes '_' and '$'. A letter or digit is any character for which the method Character.isJavaLetterOrDigit returns true. Check the JMS API documentation for more information on JMS message selectory.
The following example illustrates a possible message selector by using the com_ibm_ws_batch_applicationName property and a job parameter specialCapability:messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND specialCapability = 'superCapability'">
<batchJmsExecutor activationSpecRef="batchActivationSpec" queueRef="batchJobSubmissionQueue"/> <jmsActivationSpec id="batchActivationSpec" > <properties.wasJms destinationRef="batchJobSubmissionQueue" messageSelector="(com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayoutCDI') AND com_ibm_ws_batch_work_type='Job'" destinationType="javax.jms.Queue" remoteServerAddress="host:7280:BootstrapBasicMessaging"> </properties.wasJms> </jmsActivationSpec> <jmsQueue id="batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue"> <properties.wasJms deliveryMode="Persistent" queueName="batchLibertyQueue"> </properties.wasJms> </jmsQueue>
- Filter based on system-defined properties:
- Configure the batch JMS executor for executing only partitions.
- Enable JMS support by adding the wasJmsClient-2.0 feature to the feature manager in your server.xml file.
- Add the batchJmsExecutor element to your server.xml
file on the server that hosts the batch executor that is running batch jobs.
<batchJmsExecutor activationSpecRef={configured activation specification or batch executor} queueRef={reference to the configured JMS queue} replyConnectionFactoryRef={reference to the configured JMS connection factory} />
Note: If you do not specify the connectionFactoryRef and queueRef attributes, the default value for connectionFactoryRef is batchConnectionFactory and the default value for queueRef is batchJobSubmissionQueue. You can specify the batchJmsDispatcher element as <batchJmsDispatcher/>. You still must configure the batchConnectionFactory JMS connections factory and the batchJobSubmissionQueue in the server.xml file. - Add the corresponding JMS connection factory and JMS queue to the server configuration. This is not specific to batch configuration.
- Define batch executor server capabilities by including a JMS message selector in the activation
specification.
- Filter based on system-defined properties:
The following batch dispatcher properties are available on the batch JMS message that the batch executor can use to filter for inbound messages.
- com_ibm_ws_batch_applicationName: the name of the batch application for the job request
- com_ibm_ws_batch_moduleName: the module name of the batch application for the job request
- com_ibm_ws_batch_componentName: the component name of the batch application for the job request
- com_ibm_ws_batch_work_type: the work type : "Partition"
- com_ibm_ws_batch_partitionNum(Type=Integer): the partition number of the partition that is being dispatched
- com_ibm_ws_batch_stepName: the name of the step as defined in the JSL
Note: Specify a message selector with at least the com_ibm_ws_batch_applicationName property to ensure that the executor only receives jobs that it can process.The following example indicates the messageSelector attribute for the executor to accept only partitions for the application SimpleBatchJob:messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND com_ibm_ws_batch_work_type = 'Partition'">
The following example indicates the messageSelector attribute for the executor to accept only partitions for the application SimpleBatchJob:messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND com_ibm_ws_batch_work_type = 'Partition' AND come_ibm_ws_batch_stepName = 'step1'">
- Filtering based on user-defined properties:
The batch dispatcher sets all job parameters that conform to the proper JMS message property on the batch dispatcher request message. These properties can also be used by the message selector to add extra filtering to the message selector. The property name, or identifier, must conform to JMS message property constraints. For example, the property is an unlimited length sequence of letters and digits, the first of which must be a letter. A letter is any character for which the method Character.isJavaLetter returns true, and includes '_' and '$'. A letter or digit is any character for which the method Character.isJavaLetterOrDigit returns true. Check the JMS API documentation for more information on JMS message selectory.
The following example illustrates a possible message selector by using the com_ibm_ws_batch_applicationName property and a job parameter specialCapability:messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND specialCapability = 'superCapability'">
<jmsConnectionFactory id="batchConnectionFactory" jndiName="jms/batch/connectionFactory"/> <batchJmsExecutor activationSpecRef="batchActivationSpec" queueRef="batchJobSubmissionQueue"/> replyConnectionFactoryRef="batchConnectionFactory"/> <jmsActivationSpec id="batchActivationSpec" > <properties.wasJms destinationRef="batchJobSubmissionQueue" messageSelector="(com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayoutCDI') AND com_ibm_ws_batch_work_type='Partition'" destinationRef="batchJobSubmissionQueue" destinationType="javax.jms.Queue" remoteServerAddress="host:7280:BootstrapBasicMessaging"> </properties.wasJms> </jmsActivationSpec> <jmsQueue id="batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue"> <properties.wasJms deliveryMode="Persistent" queueName="batchLibertyQueue"> </properties.wasJms> </jmsQueue>
- Filter based on system-defined properties:
- Install your batch application on the server. For more information, see Deploying applications in Liberty. To disable multiple server partition execution: If you want to have multiple server support
but do not want multiple server partition executions, you can set job property
come.ibm.websphere.batch.partition.multiJVM to false in your
jsl job XML file. The following example illustrates a JSL job to disable
multiple server partitions:
<property name="com.ibm.websphere.batch.partition.multiJVM" value="false"/>
Note: If you are running a partition on a remote executor, there are no job logs created for that partition.

File name: twlp_batch_multipartitionsembed.html