The recommended method for creating connections to Fuse Message Broker, or 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
folder.InstallDir
\lib
![]() | Note |
---|---|
The examples included with Fuse ESB 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:
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"
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.
Table 2.1. Attributes for Configuring the Simple AMQPool Connection Factory
Example 2.1 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>
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.
Table 2.2. Attributes for Configuring the XA AMQPool Connection Factory
Example 2.2 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>
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.
Table 2.3. Attributes for Configuring the JCA AMQPool Connection Factory
Example 2.3 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>