使用 IBM MQ 消息传递提供者启用多服务器分区支持

可设置批处理环境以便让服务器充当批处理分派器,并让其他服务器充当批处理执行程序。

关于此任务

批处理分派器接受来自外部客户机的请求,并将它们提供给批处理执行程序。批处理执行程序接收与其定义功能相匹配的请求,然后执行这些请求。如果作业配置为运行分区,那么批处理执行程序将它们提供给其他执行程序以运行。批处理执行程序通过使用 Java 消息传递服务 (JMS) 进行通信。此任务帮助您使用 IBM MQ 消息传递提供程序来配置批处理分派服务器和批处理执行程序。

过程

  1. 配置批处理 JMS 分派器。
    1. 通过将 wmqJmsClient-2.0 功能部件添加至 server.xml 文件中的功能部件管理器可启用 JMS 支持。
    2. batchJmsDispatcher 元素添加至托管批处理分派器的服务器上的 server.xml 文件;例如:
      <batchJmsDispatcher connectionFactoryRef={reference to a configured JMS connection factory}
      	queueRef={reference to a configured JMS queue} />
      注: 如果未指定 connectionFactoryRefqueueRef 属性,那么 connectionFactoryRef 的缺省值为 batchConnectionFactoryqueueRef 的缺省值为 batchJobSubmissionQueue。可将 batchJmsDispatcher 元素指定为 <batchJmsDispatcher/>。在 server.xml 文件中,您仍然必须配置 batchConnectionFactory JMS 连接工厂和 JMS batchJobSubmissionQueue 队列。
    3. 将相应 JMS 连接工厂和 JMS 队列添加至服务器配置。这不是特定于批处理配置的操作。

      以下示例说明使用 IBM MQ 绑定方式的批处理 JMS 分派器配置及其 JMS 配置:

      <batchJmsDispatcher connectionFactoryRef="batchConnectionFactory"
      		      queueRef="batchJobSubmissionQueue" />
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
         	value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- nativeLibraryPath is required for BINDING mode -->
      <!-- the startup retry and reconnect retry properties are 
           recommended to ensure robustness of the system.-->
      <wmqJmsClient nativeLibraryPath="/mqm/jms/java/lib" 
      		startupRetryCount=999
      		startupRetryInterval="1000ms"
      		reconnectionRetryCount=10
      		reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <jmsConnectionFactory id="batchConnectionFactory"	
      		      jndiName="jms/batch/connectionFactory">
      	<properties.wmqJms transportType="BINDINGS"
      			   queueManager="WMQX">
      	</properties.wmqJms>
      </jmsConnectionFactory>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
      			  priority="QDEF"
      			  baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>

      以下示例说明使用 IBM MQ 客户机方式的批处理 JMS 分派器配置及其 JMS 配置:

      <batchJmsDispatcher connectionFactoryRef="batchConnectionFactory"
      		      queueRef="batchJobSubmissionQueue" />
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
         	value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- the startup retry and reconnect retry properties are 
           recommended to ensure robustness of the system.-->
      <wmqJmsClient startupRetryCount=999
      		 startupRetryInterval="1000ms"
      		 reconnectionRetryCount=10
      		 reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <jmsConnectionFactory id="batchConnectionFactory"	
      		      jndiName="jms/batch/connectionFactory">
      	<properties.wmqJms 
      			   hostName="webs24.pok.stglabs.ibm.com"
      			   transportType="CLIENT"
      			   channel="WAS.JMS.SVRCONN"
      			   port="1414"
      			   queueManager="WMQX"/>>
      	</properties.wmqJms>
      </jmsConnectionFactory>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
      			  priority="QDEF"
      			  baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>
      注: 确保引用的是 jmsConnectionFactory 元素(如示例中所示)而不是 jmsQueueConnectionFactory 元素。 使用 jmsQueueConnectionFactory 元素无效。您的配置应该包含 jmsConnectionFactory 元素和 jmsQueue 元素而不包含 jmsQueueConnectionFactory 元素。
  2. 配置批处理 JMS 执行程序以执行作业
    1. 通过将 wmqJmsClient-2.0 功能部件添加至 server.xml 文件中的功能部件管理器可启用 JMS 支持。
    2. batchJmsDispatcher 元素添加至托管批处理执行程序的服务器上的 server.xml 文件。
      注: 如果未将 batchJmsDispatcher 元素添加至 server.xml 文件,那么服务器不会分派分区以在多个服务器上运行,而是在分区本地运行。
    3. batchJmsExecutor 元素和 connectionFactory 添加至托管批处理执行程序的服务器上的 server.xml 文件。有关更多信息,请参阅步骤 1b 和 1c。
      <batchJmsExecutor activationSpecRef={configured activation specification or batch executor}
      	queueRef={reference to the configured JMS queue} />
      注: 如果未指定 activationSpecRefqueueRef 属性,那么 activationSpecRef 的缺省值为 batchActivationSpecqueueRef 的缺省值为 batchJobSubmissionQueue。可将 batchJmsExecutor 元素指定为 <batchJmsExecutor/>。在 server.xml 文件中,您仍然必须对 batchActivationSpec 配置 JMS 激活规范,并配置 batchJobSubmissionQueue JMS 队列。
    4. 将相应 JMS 激活规范和 JMS 队列添加至服务器配置。这不是特定于批处理配置的操作。
    5. 通过在激活规范中包含 JMS 消息选择器来定义批处理执行程序服务器功能。
      • 根据系统定义的属性进行过滤:

        以下批处理分派器属性在批处理 JMS 消息上可用,批处理执行程序可使用它们来进行过滤以获取入站消息。

        • com_ibm_ws_batch_applicationName:用于获取作业请求的批处理应用程序的名称
        • com_ibm_ws_batch_moduleName:用于获取作业请求的批处理应用程序的模块名称
        • com_ibm_ws_batch_componentName:用于获取作业请求的批处理应用程序的组件名称
        • com_ibm_ws_batch_work_type:工作类型:“作业”
        注: 指定带有至少一个 com_ibm_ws_batch_applicationName 属性的消息选择器以确保执行程序仅接收它可以处理的作业。
        以下示例指示执行程序的 messageSelector 属性,用于接受对应应用程序 SimpleBatchJobBonusPayout 的作业。
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout'">
      • 根据用户定义的属性进行过滤:

        批处理分派器设置符合批处理分派器请求消息上的相应 JMS 消息属性的所有作业参数。消息选择器还可使用这些属性将额外过滤条件添加至消息选择器。属性名称或标识必须符合 JMS 消息属性约束。例如,属性是长度不受限制的字母和数字组成的序列,第一位必须为字母。字母是方法 Character.isJavaLetter 对其返回 true 的任意字符,并包含“_”和“$”。字母或数字是方法 Character.isJavaLetterOrDigit 对其返回 true 的任意字符。查看 JMS API 文档以了解有关 JMS 消息选择器的更多信息。

        以下示例使用 com_ibm_ws_batch_applicationName 属性和作业参数 specialCapability 来演示可行消息选择器:
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND specialCapability = 'superCapability'">
      以下示例说明使用 IBM MQ 绑定方式的批处理 JMS 执行程序配置及其 JMS 配置:
      <batchJmsExecutor activationSpecRef="batchActivationSpec"
      		  queueRef="batchJobSubmissionQueue"/>
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
                value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- nativeLibraryPath is required for BINDING mode -->
      <!-- the startup retry and reconnect retry properties are
           recommended to ensure robustness of the system.-->
      <wmqJmsClient nativeLibraryPath="/mqm/jms/java/lib" 
      		startupRetryCount=999
      		startupRetryInterval="1000ms"
      		reconnectionRetryCount=10
      		reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <JmsActivationSpec id="batchActivationSpec" >
          <properties.wmqJms destinationRef="batchJobSubmissionQueue" 
                destinationType="javax.jms.Queue"
                messageSelector="(com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout') AND com_ibm_ws_batch_work_type='Job'""
                transportType="BINDINGS"
                queueManager="WMQX">
          </properties.wmqJms>
      </jmsActivationSpec>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
                priority="QDEF"
                baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>
      以下示例说明使用 WebSphere MQ 客户机方式的批处理 JMS 执行程序配置及其 JMS 配置:
      <batchJmsExecutor activationSpecRef="batchActivationSpec"
      		  queueRef="batchJobSubmissionQueue"/>
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
                value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- the startup retry and reconnect retry properties are
           recommended to ensure robustness of the system.-->
      <wmqJmsClient startupRetryCount=999  
      		 startupRetryInterval="1000ms"
      		 reconnectionRetryCount=10
      		 reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <JmsActivationSpec id="batchActivationSpec" >
          <properties.wmqJms destinationRef="batchJobSubmissionQueue" 
      			   messageSelector="com_ibm_ws_batch_applicationName = SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout'"
      		 transportType="CLIENT"
      		 channel="WAS.JMS.SVRCONN"
      		 destinationType="javax.jms.Queue"
      		 queueManager="WMQX"
      		 hostName="webs24.pok.stglabs.ibm.com"
      		 port="1414">
          </properties.wmqJms>
      </jmsActivationSpec>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
         	baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>
  3. 配置批处理 JMS 执行程序以仅执行分区。
    1. 通过将 wmqJmsClient-2.0 功能部件添加至 server.xml 文件中的功能部件管理器可启用 JMS 支持。
    2. batchJmsExecutor 元素和 connectionFactory 添加至托管批处理执行程序的服务器上的 server.xml 文件。有关更多信息,请参阅步骤 1b 和 1c。
      <batchJmsExecutor activationSpecRef={configured activation specification or batch executor}
      	queueRef={reference to the configured JMS queue}
             replyConnectionFactoryRef={reference to the configured JMS connection factory} />
      注: 如果未指定 activationSpecRefqueueRef 属性,那么 activationSpecRef 的缺省值为 batchActivationSpecqueueRef 的缺省值为 batchJobSubmissionQueue。可将 batchJmsExecutor 元素指定为 <batchJmsExecutor/>。在 server.xml 文件中,您仍然必须对 batchActivationSpec 配置 JMS 激活规范,并配置 batchJobSubmissionQueue JMS 队列。
    3. 将相应 JMS 激活规范和 JMS 队列添加至服务器配置。这不是特定于批处理配置的操作。
    4. 通过在激活规范中包含 JMS 消息选择器来定义批处理执行程序服务器功能。
      • 根据系统定义的属性进行过滤:

        以下批处理分派器属性在批处理 JMS 消息上可用,批处理执行程序可使用它们来进行过滤以获取入站消息。

        • com_ibm_ws_batch_applicationName:用于获取作业请求的批处理应用程序的名称
        • com_ibm_ws_batch_moduleName:用于获取作业请求的批处理应用程序的模块名称
        • com_ibm_ws_batch_componentName:用于获取作业请求的批处理应用程序的组件名称
        • com_ibm_ws_batch_work_type:工作类型:“分区”
        • com_ibm_ws_batch_partitionNum(Type=Integer):要分派的分区的分区号
        • com_ibm_ws_batch_stepName:JSL 中定义的步骤的名称
        注: 指定带有至少一个 com_ibm_ws_batch_applicationName 属性的消息选择器以确保执行程序仅接收它可以处理的作业。
        以下示例指示执行程序的 messageSelector 属性,用于接受对应应用程序 SimpleBatchJobBonusPayout 的作业。
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout'">
      • 根据用户定义的属性进行过滤:

        批处理分派器设置符合批处理分派器请求消息上的相应 JMS 消息属性的所有作业参数。消息选择器还可使用这些属性将额外过滤条件添加至消息选择器。属性名称或标识必须符合 JMS 消息属性约束。例如,属性是长度不受限制的字母和数字组成的序列,第一位必须为字母。字母是方法 Character.isJavaLetter 对其返回 true 的任意字符,并包含“_”和“$”。字母或数字是方法 Character.isJavaLetterOrDigit 对其返回 true 的任意字符。查看 JMS API 文档以了解有关 JMS 消息选择器的更多信息。

        以下示例使用 com_ibm_ws_batch_applicationName 属性和作业参数 specialCapability 来演示可行消息选择器:
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND specialCapability = 'superCapability'">
      以下示例说明使用 IBM MQ 绑定方式的批处理 JMS 执行程序配置及其 JMS 配置:
      <jmsConnectionFactory id="batchConnectionFactory"	
                            jndiName="jms/batch/connectionFactory"/>
      
      <batchJmsExecutor activationSpecRef="batchActivationSpec"
      		  queueRef="batchJobSubmissionQueue"/>
                     replyConnectionFactoryRef="batchConnectionFactory"/>
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
                value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- nativeLibraryPath is required for BINDING mode -->
      <!-- the startup retry and reconnect retry properties are
           recommended to ensure robustness of the system.-->
      <wmqJmsClient nativeLibraryPath="/mqm/jms/java/lib" 
      		startupRetryCount=999
      		startupRetryInterval="1000ms"
      		reconnectionRetryCount=10
      		reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <JmsActivationSpec id="batchActivationSpec" >
          <properties.wmqJms destinationRef="batchJobSubmissionQueue" 
                destinationType="javax.jms.Queue"
                messageSelector="(com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout') AND com_ibm_batch_work_type='Job'""
                transportType="BINDINGS"
                queueManager="WMQX">
          </properties.wmqJms>
      </jmsActivationSpec>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
                priority="QDEF"
                baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>
      以下示例说明使用 WebSphere MQ 客户机方式的批处理 JMS 执行程序配置及其 JMS 配置:
      <jmsConnectionFactory id="batchConnectionFactory"	
                            jndiName="jms/batch/connectionFactory"/>
      
      <batchJmsExecutor activationSpecRef="batchActivationSpec"
      		  queueRef="batchJobSubmissionQueue"/>
                     replyConnectionFactoryRef="batchConnectionFactory"/>
      
      <!-- wmq resource adapter -->
      <variable name="wmqJmsClient.rar.location"
                value="${server.config.dir}/wmq.wlp.rar"/>
      
      <!-- the startup retry and reconnect retry properties are
           recommended to ensure robustness of the system.-->
      <wmqJmsClient startupRetryCount=999  
      		 startupRetryInterval="1000ms"
      		 reconnectionRetryCount=10
      		 reconnectionRetryInterval="5m">
      </wmqJmsClient>
      
      <authData password="pwd" user="user">
      </authData>
      
      <JmsActivationSpec id="batchActivationSpec" >
          <properties.wmqJms destinationRef="batchJobSubmissionQueue" 
      			   messageSelector="com_ibm_ws_batch_applicationName = SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout'"
      		 transportType="CLIENT"
      		 channel="WAS.JMS.SVRCONN"
      		 destinationType="javax.jms.Queue"
      		 queueManager="WMQX"
      		 hostName="webs24.pok.stglabs.ibm.com"
      		 port="1414">
          </properties.wmqJms>
      </jmsActivationSpec>
      
      <!-- baseQueueName is the queue defined on WMQ system -->
      <jmsQueue id="batchJobSubmissionQueue"
      	  jndiName="jms/batch/jobSubmissionQueue">
          <properties.wmqJms baseQueueName="BATCHQ"
         	baseQueueManagerName="WMQX">
          </properties.wmqJms>
      </jmsQueue>
  4. 在服务器上安装批处理应用程序。有关更多信息,请参阅在 Liberty 中部署应用程序 要禁用多服务器分区执行:如果您想要多服务器支持但不想要多服务器分区执行,那么可在 jsl 作业 XML 文件中将作业属性 come.ibm.websphere.batch.partition.multiJVM 设置为 false。以下示例说明 JSL 作业如何禁用多服务器分区:
    <property name="com.ibm.websphere.batch.partition.multiJVM" value="false"/>
    注: 如果要在远程执行程序上运行分区,那么系统不会为该分区创建任何作业日志。

用于指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: Tuesday, 6 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twlp_batch_multipartitionsmq
文件名:twlp_batch_multipartitionsmq.html