How JMS applications connect to a messaging engine on a bus
There are several factors that affect how JMS applications connect to a service integration bus, so that they can use resources provided by the bus.
To connect to a service integration bus, an application actually connects to a messaging engine on the bus.
依預設,環境會自動將應用程式連接到匯流排上可用的傳訊引擎。 不過,您可以指定額外的配置詳細資料來影響連線程序;比方說,識別特殊的引導伺服器,或是限制只能連線到某些可用傳訊引擎的子群組,或改進可用性或效能,或確保收到之訊息的循序處理。
Applications running in an application server: Default configuration
Applications that are running in an application server are directed by the WebSphere® Application Server environment to an available messaging engine.
If the messaging engine is found in the same server, a connection is created that provides the application with the fastest available connection to a messaging engine. Otherwise, if a messaging engine is found in another process - on the same or a different host - a remote connection is made. If no suitable messaging engine is found the application fails to connect to the bus.

The figure shows two applications running in application servers. Application X on server3 has connected to the messaging engine running in the same server. Application Y on server1 has connected to a messaging engine that is running in the same bus but on a different server and host, because server1 does not have a suitable messaging engine.
Applications running outside an application server
Client applications running outside an application server (for example, running in a client container or outside the WebSphere Application Server environment) cannot locate a suitable messaging engine themselves and must complete a bootstrap process through a bootstrap server. A bootstrap server is an application server that is running the SIBService service, but is not necessarily running any messaging engines. The bootstrap server selects a messaging engine that is running in an application server that supports the required target transport chain.

This figure shows a client application running outside an application server. To connect to a messaging engine, the application connects first to a bootstrap server. The bootstrap server selects a messaging engine then tells the client application to connect to that messaging engine.
A bootstrap server uses a specific port and bootstrap transport chain, which with the host name form the endpoint address of the bootstrap server.
![[IBM i]](../images/iseries.gif)
When you create an application server, it is automatically assigned a unique non-secure bootstrap port, SIB_ENDPOINT_ADDRESS, and a secure bootstrap port, SIB_ENDPOINT_SECURE_ADDRESS. If you want to use an application server as a bootstrap server, and the server has been assigned a non-secure port other than 7276, or you want to use the secure port, then you must specify the endpoint address of the server on the Provider endpoints property of the connection factory.
The endpoint addresses for bootstrap servers must be specified in every connection factory that is used by applications outside of an application server. To avoid having to specify a long list of bootstrap servers, you can provide a few highly-available servers as dedicated bootstrap servers. Then you only have to specify a short list of bootstrap servers on each connection factory.
The messaging engine selection process
- For JMS client applications, this information is configured on the connection factory.
- For message-driven bean (MDB) applications, this information is configured on the activation specification.
- For other types of application, this information is configured programmatically by the application.
- If a messaging engine is running in the required bus within the same application server, then a connection is made from the application to the messaging engine. If there is no suitable messaging engine, the next rule is checked.
- If a messaging engine is running on the same host as the application, then the application makes a remote connection to the selected messaging engine. If there is no suitable messaging engine, the next rule is checked.
- If a messaging engine is running anywhere in the bus, then the application makes a remote connection to the selected messaging engine. If there is no suitable messaging engine, the connection attempt does not succeed.
In both cases (that is, an application running in an application server and an application running outside an application server) you can restrict the range of messaging engines available for connection, to a subgroup of those available in the service integration bus. You do this by configuring the following connection properties of the connection factory or activation specification:
- 目標
在執行連線近似性搜尋來選取適當的傳訊引擎之前,會先選取本身是指定目標群組成員的一組傳訊引擎。之後,會將連線近似性搜尋限制於這些傳訊引擎中。 如果未指定目標群組(預設值),在連線近似性搜尋期間會考量匯流排中的所有傳訊引擎。
比方說,如果將 目標類型 內容設為 匯流排成員名稱,則 目標 內容指定可從中選擇合適傳訊引擎的匯流排成員名稱。
- 目標類型
- 匯流排成員名稱
- 匯流排成員的名稱。這個選項會擷取指定的匯流排成員(應用程式伺服器或伺服器叢集)所管理的作用中傳訊引擎。
- 自訂傳訊引擎群組名稱
- 傳訊引擎自訂群組(形成自我宣告的叢集)的名稱。這個選項會擷取登錄在指名自訂群組中的作用中傳訊引擎。
- 傳訊引擎名稱
- 傳訊引擎的名稱。這個選項會擷取可用來連接指名的傳訊引擎的端點。
- 目標重要性
- 此內容定義連線近似性搜尋是否要限制為只有目標群組中的傳訊引擎。
- 偏好的
- 傳訊引擎最好是選自目標群組。如果目標群組中有可用的傳訊引擎,就會選取它。如果目標群組中沒有可用的傳訊引擎,而在相同的服務整合匯流排中有可用的傳訊引擎,則會選取目標群組外的傳訊引擎。
- 必要
- 傳訊引擎必須選自目標群組。如果目標群組中有可用的傳訊引擎,就會選取它。如果目標群組中沒有可用的傳訊引擎,連線程序會失敗。
- 目標入埠傳輸鏈
The name of the messaging engine inbound transport chain that the application should target when connecting to a messaging engine in a separate process to the application.
這些傳輸鏈指定可用來與用戶端應用程式連接之應用程式伺服器通訊的通訊協定。 If a messaging engine in another process is chosen, a connection can be made only if the messaging engine is in a server that runs the specified inbound transport chain.
以下是所提供的預先定義的傳訊引擎入埠傳輸鏈:- InboundBasicMessaging
- JFAP over TCP/IP
- InboundSecureMessaging
- JFAP over SSL over TCP/IP
- 連線近似性
- For
an application running in an application server, this property defines
the proximity of messaging engines relative to the application server.
For an application running outside an application server, this property
defines the proximity of messaging engines relative to the bootstrap
server.
- 匯流排
- 可建立連線來通往相同匯流排中的傳訊引擎。
A suitable messaging engine in the same server is selected ahead of a suitable messaging engine in the same host, and in turn ahead of a suitable messaging engine in another host.
- 叢集
- 可建立相同伺服器叢集中傳訊引擎的連線。 If
the application is not running in a clustered server, or the bootstrap
server is not in a cluster, then there are no suitable messaging engines.
A suitable messaging engine in the same server is selected ahead of a suitable messaging engine in the same host, and in turn ahead of a suitable messaging engine in another host.
- 主機
- 可建立連線來通往相同主機中的傳訊引擎。 A suitable messaging engine in the same server is selected ahead of a suitable messaging engine in the same host.
- 伺服器
- 可建立相同應用程式伺服器中傳訊引擎的連線。
- 叢集內的所有伺服器都可以從 MDB 應用程式接收訊息,以充分運用叢集的處理能力。
- 每次只有一部伺服器能夠接收來自 MDB 應用程式的訊息,以確保會循序處理訊息。
For more information, see 叢集中的訊息驅動 Bean 連接方式.