JBoss Messaging Bridge Configuration
The function of the bridge is to consume messages from a source queue or topic, and send them to target queue or topic, typically on a different server. The following will guide you to setup a bridge to route messages to a remote queue.
This full bridge documentation is available on the project page or in the distribution.
If you are bridging between two JBM instances, JBM-A and JBM-B you have three choices of where to deploy the bridge:
You can deploy the bridge in the JBM-A instance, the JBM-B instance or in another JBM instance altogether - JBM-C.
If you are deploying in JBM-A you will need to set up a remote JMS Provider that references JBM-B, if you are deploying in JBM-B you will need to set up a remote JMS provider that references JBM-A, or if you are deploying in JBM-C you will need to set up two remote JMS providers - once for JBM-A and one for JBM-B.
Note
There were some issues using the bridge under high load with XA transactions in earlier versions. If you're trying to implement this on an older version, please upgrade it to JBM-1.4.0.GA.
http://jira.jboss.com/jira/browse/JBMESSAGING-1068
Configure Remote JMS Provider
The easiest way is accommodating this in your jms-ds.xml file. Jms-ds.xml file can be found at : $JBOSS_HOME/server/$YOUR_JBM_CONFIG/deploy
<!- Remote JMS Provider --> <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.jms:service=JMSProviderLoader,name=MyRemoteJMSProvider"> <attribute name="ProviderName">RemoteXAConnectionFactory</attribute> <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute> <!-- The combined connection factory --> <attribute name="FactoryRef">XAConnectionFactory</attribute> <!-- The queue connection factory --> <attribute name="QueueFactoryRef">XAConnectionFactory</attribute> <!-- The topic factory --> <attribute name="TopicFactoryRef">XAConnectionFactory</attribute> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=192.168.1.172:1099 </attribute> </mbean>
You have to specify the remote host's IP address in place of 192.168.1.172 along with the JNDI port. The default JNDI port is 1099, if you have changed the remote host's JNDI port, you have to specify it instead of 1099
Create a bridge service
Sample Bridge Configuration :
xyz-bridge-service.xml
<mbean code="org.jboss.jms.server.bridge.BridgeService" name="jboss.jms:service=Bridge,name=TestBridge" xmbean-dd="xmdesc/Bridge-xmbean.xml"> <depends optional-attribute-name="SourceProviderLoader">jboss.jms:service=JMSProviderLoader,name=JMSProvider</depends> <depends optional-attribute-name="TargetProviderLoader">jboss.jms:service=JMSProviderLoader,name=MyRemoteJMSProvider</depends> <attribute name="SourceDestinationLookup">/queue/A</attribute> <attribute name="TargetDestinationLookup">/queue/my-remote-queue</attribute> <attribute name="SourceUsername">src-usr</attribute> <attribute name="SourcePassword">src-pwd</attribute> <attribute name="TargetUsername">trg-usr</attribute> <attribute name="TargetPassword">trg-pwd</attribute> <attribute name="QualityOfServiceMode">2</attribute> <attribute name="Selector">specify-jms-selector-here</attribute> <attribute name="MaxBatchSize">5</attribute> <attribute name="MaxBatchTime">-1</attribute> <attribute name="SubName">mysub</attribute> <attribute name="ClientID">myClientID</attribute> <attribute name="FailureRetryInterval">5000</attribute> <attribute name="MaxRetries">-1</attribute> <attribute name="AddMessageIDInHeader">false</attribute> </mbean>
SourceProviderLoader
The JMS provider loader that is used to lookup the source destination, the bridge will use to lookup the source connection factory and source destination
TargetProviderLoader
The JMS provider loader that is used to lookup the target destination
SourceDestinationLookup
The JNDI lookup for the source destination
TargetDestinationLookup
The JNDI lookup for the target destination
SourceUsername
The username to use for the source connection
SourcePassword
The password to use for the source connection
TargetUsername
The username to use for the target connection
TargetPassword
The password to use for the target connection
QualityOfServiceMode
The Quality Of Service mode to use
QOS_AT_MOST_ONCE = 0;
QOS_DUPLICATES_OK = 1;
QOS_ONCE_AND_ONLY_ONCE = 2;
Selector
JMS selector to use for consuming messages from the source
MaxBatchSize
The maximum number of messages to consume from the source before sending to the target
MaxBatchTime
The maximum time to wait (in ms) before sending a batch to the target even if MaxBatchSize is not exceeded. -1 means wait forever
SubName
If consuming from a durable subscription this is the subscription name
ClientID
If consuming from a durable subscription this is the client ID to use
FailureRetryInterval
The number of ms to wait between connection retries in the event connections to source or target fail
MaxRetries
The maximum number of connection retries to make in case of failure, before giving up. -1 means try forever
AddMessageIDInHeader
If true then the message id of the message before bridging will be added as a header to the message so it is available to the receiver. Can then be sent as correlation id to correlate in a distributed request-response
Project Page : JBossMessaging
Comments