Liberty Repository[8.5.5.6 或更高版本]

使用 Liberty 概要文件嵌入式消息传递提供程序启用多服务器支持

可设置批处理环境以便让一些服务器充当批处理分派器,而让其他服务器充当批处理执行程序。批处理分派器接受来自外部客户机的请求,并将它们提供给批处理执行程序。批处理执行程序接收与其定义功能相匹配的请求,然后执行这些请求。批处理分派器和批处理执行程序使用 Java 消息传递服务 (JMS) 进行通信。

开始之前

确定嵌入式消息传递引擎所在的位置。它可以在批处理分派服务器、批处理执行程序服务器或单独服务器上。完成此任务前,必须配置此服务器。JMS 连接工厂和激活规范在其配置中引用消息引擎服务器。要配置消息引擎,请执行以下操作:
  1. wasJmsServer-1.0 功能部件添加至 server.xml
  2. 通过添加 messageEngine 元素定义消息引擎。定义用于批处理分派器和批处理执行程序的队列。以下示例说明 server.xml 中的消息引擎配置。
<!-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. -->
<wasJmsExecutor host="*" 
		  wasJmsPort="7280" 
		  wasJmsSSLPort="7290" 
		  enabled="true"> 
</wasJmsExecutor>

<messagingEngine>
	<!- queue for batch jms message. -->
	<queue id="batchLibertyQueue" 
		forceReliability="ReliablePersistent"
		receiveAllowed="true"/>
</messagingEngine>

关于此任务

此任务帮助您使用 Liberty 概要文件嵌入式消息传递提供程序配置批处理分派服务器和批处理执行程序。

过程

要配置使用 Liberty 概要文件嵌入式消息传递提供程序的批处理分派器和执行程序,请执行以下操作:

  1. 配置批处理 JMS 分派器。
    1. 通过将 wasJmsClient-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 队列添加至服务器配置。这不是特定于批处理配置的操作。 以下示例说明批处理 JMS 分派器配置及其 JMS 配置。
      注: remoteServerAddress 属性指向托管 Liberty 概要文件消息引擎的服务器的 host:port
      <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>
  2. 配置批处理 JMS 执行程序。
    1. 通过将 wasJmsClient-2.0 功能部件添加至 server.xml 文件中的功能部件管理器可启用 JMS 支持。
    2. batchJmsExecutor 元素添加至托管批处理执行程序的服务器上的 server.xml 文件。
      <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 队列。
    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_applicationName 属性来指定消息选择器,以确保该执行程序仅接收它可处理的作业。
        以下示例指示执行程序的 messageSelector 属性,用于接受对应应用程序 SimpleBatchJobBonusPayout 的作业。
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' OR com_ibm_ws_batch_applicationName = 'BonusPayout'">
        以下示例指示执行程序的 messageSelector 属性,用于接受对应应用程序 SimpleBatchJob 的作业。
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob'">
      • 根据用户定义的属性进行过滤:

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

        以下示例说明使用 com_ibm_ws_batch_applicationName 属性和作业参数 specialCapability 的可能消息选择器。
        messageSelector="com_ibm_ws_batch_applicationName = 'SimpleBatchJob' AND specialCapability = 'superCapability'">
      以下示例演示批处理 JMS 执行程序配置及其 JMS 配置。
      <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'"
      			   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>
  3. 在服务器上安装批处理应用程序。有关更多信息,请参阅将应用程序部署到 Liberty 概要文件

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

信息中心的条款和条件 | 反馈


时间戳记图标 最近一次更新时间: Wednesday, 2 September 2015
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=twlp_batch_multiJVMembed
文件名:twlp_batch_multiJVMembed.html