配置客户机以在多个 Liberty 服务器之间启用 JMS 消息传递
要在多个服务器上启用 JMS 消息传递,必须在其他 Liberty 服务器上配置 wasJmsClient-2.0 功能部件。
过程
- 在客户机上启用 JMS 客户机功能部件。如果要执行 JNDI 查找,那么还必须添加 jndi-1.0 功能部件。
<featureManager> <feature>wasJmsClient-2.0</feature> <feature>jndi-1.0</feature> </featureManager>
- 配置必需的 JMS 资源。
<jmsQueueConnectionFactory jndiName="myQCF" connectionManagerRef="ConMgr4"> <properties.wasJms remoteServerAddress="meserver.ibm.com:7276:BootstrapBasicMessaging" /> </jmsQueueConnectionFactory> <connectionManager id="ConMgr4" maxPoolSize="2"/> <jmsQueue jndiName="myQ"> <properties.wasJms queueName="libertyQ" /> </jmsQueue>
注: 要使 JMS 应用程序能够与远程消息传递引擎进行远程 TCP/IP 连接,请配置连接工厂的 <remoteServerAddress> 属性。<remoteServerAddress> 属性涉及到必须与其联系并且存在消息传递引擎的服务器。属性声明必须为如下所示:
其中 hostname 是正在运行消息传递引擎的主机的名称;port 是在服务器端配置的 JMS 入站端口;如果未使用 SSL,那么 mode 为 BootstrapBasicMessaging,如果使用了 SSL,那么为 BootStrapSecureMessaging。remoteServerAddress="hostname:port:mode"
如果未指定 <remoteServerAddress>,那么 JMS 应用程序将尝试连接至缺省情况下位于同一 Liberty 服务器中的本地消息传递引擎。
- 可选: 配置其他属性。
- 当配置客户机以远程连接至消息传递引擎时,您可以创建定制通道,应用程序可以使用这些通道来连接至消息传递引擎。两个缺省通道为 BootstrapBasicMessaging 和 BootStrapSecureMessaging。如果要覆盖这两个通道定义,并且使用定制通道,请使用 <wasJmsOutbound> 元素,如下所示:
<featureManager> <feature>wasJmsClient-2.0</feature> <feature>jndi-1.0</feature> </featureManager> <wasJmsOutbound id=”CustomChain”/> <jmsQueueConnectionFactory jndiName="myQCF" connectionManagerRef="ConMgr4"> <properties.wasJms remoteServerAddress="meserver.ibm.com:7276: CustomChain" /> </jmsQueueConnectionFactory> <connectionManager id="ConMgr4" maxPoolSize="2"/>
- 当应用程序使用 myQCF 连接工厂时,该应用程序将使用 CustomChain(而不使用 BootStrapBasicMessaging)来连接至远程消息传递引擎。类似地,如果您想要使用安全通道,那么可以在 <wasJmsOutbound> 元素中使用 <useSSL> 选项,如以下示例中所示。
<featureManager> <feature>wasJmsClient-2.0</feature> <feature>jndi-1.0</feature> </featureManager> <wasJmsOutbound id=”CustomChainSecured” useSSL=”true”/> <jmsQueueConnectionFactory jndiName="myQCF" connectionManagerRef="ConMgr4"> <properties.wasJms remoteServerAddress="meserver.ibm.com:7276: CustomChainSecured" /> </jmsQueueConnectionFactory> <connectionManager id="ConMgr4" maxPoolSize="2"/>
- 当配置客户机以远程连接至消息传递引擎时,您可以创建定制通道,应用程序可以使用这些通道来连接至消息传递引擎。两个缺省通道为 BootstrapBasicMessaging 和 BootStrapSecureMessaging。如果要覆盖这两个通道定义,并且使用定制通道,请使用 <wasJmsOutbound> 元素,如下所示:

文件名:twlp_msg_multi_client.html