配置用戶端以在多部 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 連線,請配置 Connection Factory 的 <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 Connection Factory 時,它會利用 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