このコンテンツは選択した言語では利用できません。

Chapter 2. Configuring the Connection Factory


Abstract

The JMS binding component needs to have access to your JMS provider's connection factory. This is configured in the XML file and the specifics depend on the JMS provider in use.
Important
The Java Business Integration components of Red Hat JBoss Fuse are considered deprecated. You should consider migrating any JBI applications to OSGi.
When working with a JMS broker, a client application needs a ConnectionFactory object to create connections to the broker. The ConnectionFactory object is a JMS object that is provided along with the JMS broker. Each JMS provider has a unique ConnectionFactory object that uses properties specific to a particular JMS implementation.
When using the Red Hat JBoss Fuse JMS binding component, you must configure each service unit with the information it needs to load a ConnectionFactory object. Often the ConnectionFactory object is looked up through JNDI. However, the information needed depends on the JMS provider you are using.
Commonly used JMS providers include Red Hat JBoss A-MQ, Apache ActiveMQ, IBM's WebShere® MQ, BEA's WebLogic®, and Progress Software's SonicMQ®. JBoss A-MQ and Apache ActiveMQ can be configured using simple Spring XML. Other JMS providers must be configured using either JNDI or using custom Spring beans. This chapter provides basic information for configuring the ConnectionFactory objects for each of these platforms.

2.1. Using Apache ActiveMQ Connection Factories

Overview

The recommended method for creating connections to Apache ActiveMQ, is by using the Jencks AMQPool. It provides support for using a scalable pool of connections for managing overhead. You can download the needed jar from http://repo1.maven.org/maven2/org/jencks/jencks-amqpool/2.0/jencks-amqpool-2.0.jar. Once the jar is downloaded, you need to add it to your classpath. The easiest way to do this is to place the jar into your InstallDir\lib folder.
Note
The examples included with Red Hat JBoss Fuse use the standard Apache ActiveMQ connection factory. This is fine for testing purposes, but is not robust enough for enterprise deployments.
The Jencks AMQPool supplies three connection factories:

Namespace

To add the AMQPool configuration elements to your endpoint's configuration, you need to add the following XML namespace declaration to your beans element:
xmlns:amqpool="http://jencks.org/amqpool/2.0"
Copy to Clipboard Toggle word wrap

Simple pool

The simple pooling connection factory supports pooling, but does not support transactions. It is specified using the amqpool:pool element. The attributes used to configure the simple pooled connection factory are described in Table 2.1, “Attributes for Configuring the Simple AMQPool Connection Factory”.
Expand
Table 2.1. Attributes for Configuring the Simple AMQPool Connection Factory
AttributeDescriptionRequired
id Specifies a unique identifier by which other elements refer to this element.yes
url Specifies the URL used to connect to the JMS broker.yes
maxConnections Specifies the maximum number of simultaneous connections to the broker. The default value is 1, but you can safely increase it to 8 in all conditions.no
maximumActive Specifies the maximum number of active sessions for a particular connection. The default value is 500.no
Example 2.1, “Configuring a Simple AMQPool Connection Factory” shows a configuration snippet for configuring the simple AMQPool connection factory.

Example 2.1. Configuring a Simple AMQPool Connection Factory

<beans xmlns:amqpool="http://jencks.org/amqpool/2.0"
       ... >
  ...
  <amqpool:pool id="connectionFactory" 
                url="tcp://localhost:61616" 
                maxConnections="8" />
</beans>
Copy to Clipboard Toggle word wrap

XA pool

The XA pooling connection factory supports XA transactions and late enlistment. It is specified using the amqpool:xa-pool element. The attributes used to configure the XA pooled connection factory are described in Table 2.2, “Attributes for Configuring the XA AMQPool Connection Factory”.
Expand
Table 2.2. Attributes for Configuring the XA AMQPool Connection Factory
AttributeDescriptionRequired
id Specifies a unique identifier by which other elements refer to this element.yes
url Specifies the URL used to connect to the JMS broker.yes
transactionManager Specifies a reference to an element that configures an XA transaction manager.yes
maxConnections Specifies the maximum number of simultaneous connections to the broker. The default value is 1, but you can safely increase it to 8 in all conditions.no
maximumActive Specifies the maximum number of active sessions for a particular connection. The default value is 500.no
Example 2.2, “Configuring an XA AMQPool Connection Factory” shows a configuration snippet for configuring an XA AMQPool connection factory.

Example 2.2. Configuring an XA AMQPool Connection Factory

<beans xmlns:amqpool="http://jencks.org/amqpool/2.0"
       xmlns:jencks="http://jencks.org/2.0"
       ... >
  ...
  <amqpool:xa-pool id="connectionFactory" 
                   url="tcp://localhost:61616" 
                   maxConnections="8" 
                   transactionManager="#transactionManager" />

  <jencks:transactionManager id="transactionManager"
                             transactionLogDir="./data/txlog"
                             defaultTransactionTimeoutSeconds="600" />

</beans>
Copy to Clipboard Toggle word wrap

JCA pool

The JCA pooling connection factory is intended to be used inside of J2EE environments or in conjunction with the Jencks JCA environment. It is specified using the amqpool:jca-pool element. The attributes used to configure the JCA pooled connection factory are described in Table 2.3, “Attributes for Configuring the JCA AMQPool Connection Factory”.
Expand
Table 2.3. Attributes for Configuring the JCA AMQPool Connection Factory
AttributeDescriptionRequired
id Specifies a unique identifier by which other elements refer to this element.yes
url Specifies the URL used to connect to the JMS broker.yes
transactionManager Specifies a reference to an element that configures an XA transaction manager.yes
name Specifies a unique name by which the JMS broker can be identified.yes
maxConnections Specifies the maximum number of simultaneous connections to the broker. The default value is 1, but you can safely increase it to 8 in all conditions.no
maximumActive Specifies the maximum number of active sessions for a particular connection. The default value is 500.no
Example 2.3, “Configuring a JCA AMQPool Connection Factory” shows a configuration snippet for configuring the JCA AMQPool connection factory.

Example 2.3. Configuring a JCA AMQPool Connection Factory

<beans xmlns:amqpool="http://jencks.org/amqpool/2.0"
       xmlns:jencks="http://jencks.org/2.0"
       ... >
  ...
  <amqpool:jca-pool id="connectionFactory" 
                   url="tcp://localhost:61616" 
                   maxConnections="8" 
                   transactionManager="#transactionManager"
                   name="joeFred" />

  <jencks:transactionManager id="transactionManager"
                             transactionLogDir="./data/txlog"
                             defaultTransactionTimeoutSeconds="600" />

</beans>
Copy to Clipboard Toggle word wrap
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat