Running JMS Bridge with HornetQ - jms

I have two standalone HornetQ servers on same the machine! I followed jms-bridge example in HornetQ examples for configuring source server and target server (I copied configurations from example to my servers). When i want running target server (that contains jms bridge) It can not find TransactionManager property of JMSBridge bean, because com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple is not in server classpath. What should i choose instead of this implementation of TransactionManager? Or what jar files required for com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple?
<!-- The JMS Bridge -->
<bean name="JMSBridge" class="org.hornetq.jms.bridge.impl.JMSBridgeImpl">
<constructor>
<!-- Source ConnectionFactory Factory -->
<parameter>
<inject bean="SourceCFF"/>
</parameter>
<!-- Target ConnectionFactory Factory -->
<parameter>
<inject bean="TargetCFF"/>
</parameter>
<!-- Source DestinationFactory -->
<parameter>
<inject bean="SourceDestinationFactory"/>
</parameter>
<!-- Target DestinationFactory -->
<parameter>
<inject bean="TargetDestinationFactory"/>
</parameter>
<!-- Source username (no username here) -->
<parameter><null /></parameter>
<!-- Source password (no password here)-->
<parameter><null /></parameter>
<!-- Target username (no username here)-->
<parameter><null /></parameter>
<!-- Target password (no password here)-->
<parameter><null /></parameter>
<!-- Selector -->
<parameter><null /></parameter>
<!-- Interval to retry in case of failure (in ms) -->
<parameter>5000</parameter>
<!-- Maximum number of retries to connect to the source and target -->
<parameter>10</parameter>
<!-- Quality of service -->
<parameter>ONCE_AND_ONLY_ONCE</parameter>
<!-- Maximum batch size -->
<parameter>1</parameter>
<!-- Maximum batch time (-1 means infinite) -->
<parameter>-1</parameter>
<!-- Subscription name (no subscription name here)-->
<parameter><null /></parameter>
<!-- client ID (no client ID here)-->
<parameter><null /></parameter>
<!-- concatenate JMS messageID to the target's message header -->
<parameter>true</parameter>
<!-- register the JMS Bridge in the JMX MBeanServer -->
<parameter>
<inject bean="MBeanServer"/>
</parameter>
<parameter>org.hornetq:service=JMSBridge</parameter>
</constructor>
<property name="transactionManager">
<inject bean="TransactionManager"/>
</property>
<!-- HornetQ JMS Server must be started before the bridge -->
<depends>JMSServerManager</depends>
</bean>
<!-- TransactionManager -->
<bean name="TransactionManager" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple">
</bean>

you could chek out the new HornetQ book at
HornetQ Messaging Developer's Guide

I added these jar files and error gone:
jta.jar
narayana-jta.jar

Related

Should this sysmon configuration be fine tuned more?

I am creating a sysmon configuration to implement in my lab environment. This environment is used to build replica networks for troubleshooting problems and testing different software. I have created this sysmon configuration file to monitor the lab.
<Sysmon schemaversion="4.50">
<HashAlgorithms>md5,sha256</HashAlgorithms>
<EventFiltering>
<RuleGroup name="" groupRelation="or">
<!-- Process Creation -->
<ProcessCreate onmatch="include">
<CommandLine condition="contains"> </CommandLine>
</ProcessCreate>
<!-- Process Termination -->
<ProcessTerminate onmatch="include" />
<!-- File Creation -->
<FileCreateStreamHash onmatch="include">
<Image condition="is">*</Image>
</FileCreateStreamHash>
<!-- File Deletion -->
<FileDelete onmatch="include">
<TargetFilename condition="is">*</TargetFilename>
</FileDelete>
<!-- Network Connection -->
<NetworkConnect onmatch="include" />
<!-- Registry Changes -->
<RegistryEvent onmatch="include">
<TargetObject condition="contains">HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces</TargetObject>
<Details condition="contains">SetValueKey</Details>
</RegistryEvent>
<!-- Process Tampering Events -->
<ProcessTampering onmatch="include" />
<!-- Driver Loaded -->
<DriverLoad onmatch="include" />
<!-- Create Remote Thread -->
<CreateRemoteThread onmatch="include" />
<!-- Raw Access Read -->
<RawAccessRead onmatch="include" />
<!-- Pipe Created Event -->
<PipeEvent onmatch="include" />
<!-- WMI Event -->
<WmiEvent onmatch="include" />
<!-- DNS Events -->
<DnsQuery onmatch="include" />
<!-- File Creation Time -->
<FileCreateTime onmatch="include" />
<!-- Process Changed -->
<ProcessTampering onmatch="include" />
<!-- Monitoring Logs -->
<FileCreate onmatch="include">
<TargetFilename condition="contains">log</TargetFilename>
</FileCreate>
<!-- Monitoring Registry files -->
<RegistryEvent onmatch="include">
<TargetObject condition="contains">HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces</TargetObject>
<Details condition="contains">SetValueKey</Details>
</RegistryEvent>
<!-- Monitoring common malware hiding places -->
<FileCreate onmatch="include">
<TargetFilename condition="contains">AppData\Local\Temp</TargetFilename>
</FileCreate>
<FileCreate onmatch="include">
<TargetFilename condition="contains">ProgramData\Microsoft\Crypto\RSA\MachineKeys</TargetFilename>
</FileCreate>
</RuleGroup>
</EventFiltering>
</Sysmon>
Can any Microsoft wizards out there look it over for me and let me know if this looks sufficient and point me in a direction of how I should fine tune this config for my use case if not.
Thanks all!

ActiveMQ authentication on Spring Boot

I can consume and publish a message to queue without authentication in Spring App via ActiveMQ.
server.port=9999
spring.activemq.broker-url=tcp://localhost:61616
spring.activemq.user=admin
spring.activemq.password=admin
spring.activemq.packages.trust-all=true
I deleted user and password line. It works. But I want to take error when deleted following line or when wrong password and username.
spring.activemq.user=admin
spring.activemq.password=admin
My authentication is true but it doesn't work.
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
<bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
How to get an error when Password or username is entered incorrectly? How can I open username and password for Spring boot? (I'm not asking about ActiveMQ web console authentication)
activemq.xml :
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:
http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
The conf/jetty.xml configuration is for the webconsole. The conf/users.properties is generally where user and group information is stored for the standardized messaging protocols (JMS/STOMP/MQTT/AMQP etc) user authentication with the Apache ActiveMQ distribution.
Please sharing your conf/activemq.xml for confirmation.

How to set primary rabbit template and rabbit connection factory

I am facing some errors in a spring boot project where I am using spring integration to connect to RabbitMQ. I am doing the configuration for RabbitMQ in XML files like this:
<!-- RabbitMQ configuration -->
<rabbit:connection-factory
id="rabbitConnectionFactory_2"
host="${queuing.events.host}"
port="${queuing.events.port}"
username="${queuing.events.username}"
password="${queuing.events.password}"
virtual-host="${queuing.events.virtual-host}"
publisher-returns="true"/>
<rabbit:template id="amqpTemplate_2" connection-factory="rabbitConnectionFactory_2" />
<rabbit:admin id="rabbitAdmin_2" connection-factory="rabbitConnectionFactory_2"/>
<rabbit:listener-container connection-factory="rabbitConnectionFactory_2" auto-startup="true" requeue-rejected="false" />
<bean id="rabbitListenerContainerFactory_2" class="org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory">
<property name="connectionFactory" ref="rabbitConnectionFactory_2"/>
</bean>
<!-- -->
But I am creating two of each component. How to set the primaries ones?
Now the problem comes here, I was using this version for spring cloud:
<spring-cloud.version>Dalston.SR2</spring-cloud.version>
And everything was working fine, but if I update the version to:
<spring-cloud.version>Edgware.RELEASE</spring-cloud.version>
This error is coming:
Description:
Parameter 0 of method rabbitSender in org.springframework.cloud.sleuth.zipkin2.sender.ZipkinRabbitSenderConfiguration required a single bean, but 2 were found:
- rabbitConnectionFactory: defined in null
- rabbitConnectionFactory_2: defined in null
Action:
Consider marking one of the beans as #Primary, updating the consumer to accept multiple beans, or using #Qualifier to identify the bean that should be consumed
And the error comes because of this dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
If I remove this dependency the error is not coming.
You can find an example project to reproduce this scenario. In the pom file you'll see this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR2</spring-cloud.version> <!-- it works with this version-->
<!-- <spring-cloud.version>Edgware.RELEASE</spring-cloud.version> --> <!-- doesn't work with this version-->
</properties>
<dependencies>
<!-- SPRING BOOT -->
<!-- it fails because of this dependency in that we are using Edgware.RELEASE version -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
...
https://github.com/fjmpaez911/spring-integration-zipkin-cloud
So I need to know how to set a primary configuration for RabbitMQ and in addition I think that could be an issue because this error only comes if I use this version Edgware.RELEASE
Am I missing something?
fran, in Edgware.RELEASE the <artifactId>spring-cloud-sleuth-zipkin</artifactId> will resolve Zipkin 2 dependencies try using <artifactId> spring-cloud-starter-zipkin-legacy</artifactId> instead
To define the primary connection factory for RabbitMQ in XML files, you can do something like this:
<!-- Here the primary connection -->
<bean id="rabbitConnectionFactory" primary="true" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<constructor-arg value="${spring.rabbitmq.host}"/>
<property name="username" value="${spring.rabbitmq.username}"/>
<property name="password" value="${spring.rabbitmq.password}"/>
<property name="virtualHost" value="${spring.rabbitmq.virtual-host}"/>
</bean>
<!-- RabbitMQ configuration -->
<rabbit:connection-factory
id="rabbitConnectionFactory_2"
host="${queuing.events.host}"
port="${queuing.events.port}"
username="${queuing.events.username}"
password="${queuing.events.password}"
virtual-host="${queuing.events.virtual-host}"
publisher-returns="true"/>
<rabbit:template id="amqpTemplate_2" connection-factory="rabbitConnectionFactory_2" />
<rabbit:admin id="rabbitAdmin_2" connection-factory="rabbitConnectionFactory_2"/>
<rabbit:listener-container connection-factory="rabbitConnectionFactory_2" auto-startup="true" requeue-rejected="false" />
<bean id="rabbitListenerContainerFactory_2" class="org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory">
<property name="connectionFactory" ref="rabbitConnectionFactory_2"/>
</bean>

ActiveMQ broker to connect to Tibco EMS over SSL

Im trying to setup a broker between ActiveMQ and Tibco EMS with SSL Connectivity.
I have copied jms-2.0.jar, tibcrypt.jar, tibjms.jar and slf4j-api-1.7.13.jar under activemq/lib
I have following activemq.xml config
Issue: Broker starts fine. However its not able to capture New messages from EMS. neither it raises any error.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<!-- Allows accessing the server log -->
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<!-- JMS ConnectionFactory to use for local bridging -->
<bean id="tibco" class="com.tibco.tibjms.TibjmsQueueConnectionFactory">
<property name="serverUrl" value="ssl://10.88.66.225:7243" />
<property name="userName" value="admin" />
<property name="userPassword" value="admin123" />
<property name="SSLIdentity" value="/home/activemq/activemq/conf/client_identity.p12" />
<property name="SSLAuthOnly" value="true" />
</bean>
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:
http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />
<!-- Dependencies: tibjms.jar must be in the activemq lib directory -->
<!-- bridging definitions for traffic to/from remote activemq instance -->
<jmsBridgeConnectors>
<jmsQueueConnector outboundQueueConnectionFactory="#tibco">
<inboundQueueBridges>
<inboundQueueBridge
inboundQueueName = "queue.Sample"
localQueueName = "queue.incomingMsgs.Sample"/>
</inboundQueueBridges>
<outboundQueueBridges>
<outboundQueueBridge
outboundQueueName = "queue.activemqtoems"
localQueueName = "queue.incomingMsgs.Sample"/>
</outboundQueueBridges>
</jmsQueueConnector>
</jmsBridgeConnectors>
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans>
<!-- END SNIPPET: example -->
I strongly recommend using a bridge instead of wiring up broker-to-broker JMS with ActiveMQ. The broker-to-broker approach is complicated by error handling scenarios, which a bridge can be better customized to handle for your use case.

HornetQ JMS Bridge between two HornetQ servers fails to deliver

(Edited on 11.11.11, edits at bottom)
I have two JBoss AS 6.1 servers running HornetQ (version 2.2.5 AS7) servers.
Lets call the other one CLIENT and other one MASTER.
CLIENT has a Queue ("sourceQueue"), which is written to by our web application.
There is a JMS bridge set up between CLIENT and MASTER servers,
which consumes messages from sourceQueue on CLIENT and should produce them on
the targetQueue on MASTER. The bridge is running on the CLIENT JBoss.
PROBLEM: Instead of consuming from source and producing messages on target, superficially nothing seems to happen: the source has 1 message, target has none. It is also possible that the source is being fed that message over and over.
Network connection using netty connectors is working, this has been tested restarting the bridge and observing the netstat -n -c output.
What kind of issues could cause this kind of problems?
Network issues?
Transaction manager?
Connector errors?
How would you go about diagnosing problems with HornetQ bridge?
Below is the bridge definition on hornetq-jboss-beans.xml (on CLIENT /jboss/server/default/deploy/hornetq ). Definition is close variation of the JMS bridge example on HornetQ manual:
<bean name="JMSBridge" class="org.hornetq.jms.bridge.impl.JMSBridgeImpl">
<!-- HornetQ must be started before the bridge -->
<depends>HornetQServer</depends>
<constructor>
<!-- Source ConnectionFactory Factory -->
<parameter>
<inject bean="SourceCFF"/>
</parameter>
<!-- Target ConnectionFactory Factory -->
<parameter>
<inject bean="TargetCFF"/>
</parameter>
<!-- Source DestinationFactory -->
<parameter>
<inject bean="SourceDestinationFactory"/>
</parameter>
<!-- Target DestinationFactory -->
<parameter>
<inject bean="TargetDestinationFactory"/>
</parameter>
<!-- Source User Name (no username here) -->
<parameter><null /></parameter>
<!-- Source Password (no password here)-->
<parameter><null /></parameter>
<!-- Target User Name (no username here)-->
<parameter><null /></parameter>
<!-- Target Password (no password here)-->
<parameter><null /></parameter>
<!-- Selector -->
<parameter><null /></parameter>
<!-- Failure Retry Interval (in ms) -->
<parameter>5000</parameter>
<!-- Max Retries -->
<parameter>10</parameter>
<!-- Quality Of Service -->
<parameter>ONCE_AND_ONLY_ONCE</parameter>
<!-- Max Batch Size -->
<parameter>1</parameter>
<!-- Max Batch Time (-1 means infinite) -->
<parameter>-1</parameter>
<!-- Subscription name (no subscription name here)-->
<parameter><null /></parameter>
<!-- Client ID (no client ID here)-->
<parameter><null /></parameter>
<!-- Add MessageID In Header -->
<parameter>true</parameter>
<!-- register the JMS Bridge in the AS MBeanServer -->
<parameter>
<inject bean="MBeanServer"/>
</parameter>
<parameter>org.hornetq:service=MyJMSBridge</parameter>
</constructor>
<property name="transactionManager">
<inject bean="RealTransactionManager"/>
</property>
</bean>
<!-- SourceCFF describes the ConnectionFactory used to connect to the
source destination -->
<bean name="SourceCFF"
class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
<constructor>
<parameter>
<inject bean="sourceJNDI" />
</parameter>
<parameter>/XAConnectionFactory</parameter>
</constructor>
</bean>
<!-- TargetCFF describes the ConnectionFactory used to connect to the
target destination -->
<bean name="TargetCFF"
class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">
<constructor>
<parameter>
<inject bean="targetJNDI" />
</parameter>
<parameter>/integration/XAConnectionFactory</parameter>
</constructor>
</bean>
<!-- SourceDestinationFactory describes the Destination used as the source -->
<bean name="SourceDestinationFactory"
class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
<constructor>
<parameter>
<inject bean="sourceJNDI"/>
</parameter>
<parameter>/jms/notificationRequestQueue</parameter>
</constructor>
</bean>
<!-- TargetDestinationFactory describes the Destination used as the target -->
<bean name="TargetDestinationFactory"
class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">
<constructor>
<parameter>
<inject bean="targetJNDI" />
</parameter>
<parameter>/integration/jms/notificationRequestQueue</parameter>
</constructor>
</bean>
<!-- JNDI is a Hashtable containing the JNDI properties required -->
<!-- to connect to the sources and targets JMS resrouces -->
<bean name="sourceJNDI" class="java.util.Hashtable">
<constructor class="java.util.Map">
<map class="java.util.Hashtable" keyClass="java.lang.String"
valueClass="java.lang.String">
<entry>
<key>java.naming.factory.initial</key>
<value>org.jnp.interfaces.NamingContextFactory</value>
</entry>
<entry>
<key>java.naming.provider.url</key>
<value>jnp://localhost:1099</value>
</entry>
<entry>
<key>java.naming.factory.url.pkgs</key>
<value>org.jboss.naming:org.jnp.interfaces"</value>
</entry>
<entry>
<key>jnp.timeout</key>
<value>5000</value>
</entry>
<entry>
<key>jnp.sotimeout</key>
<value>5000</value>
</entry>
</map>
</constructor>
</bean>
<bean name="targetJNDI" class="java.util.Hashtable">
<constructor class="java.util.Map">
<map class="java.util.Hashtable" keyClass="java.lang.String"
valueClass="java.lang.String">
<entry>
<key>java.naming.factory.initial</key>
<value>org.jnp.interfaces.NamingContextFactory</value>
</entry>
<entry>
<key>java.naming.provider.url</key>
<value>jnp://TARGET-URL.example.com:1099</value>
</entry>
<entry>
<key>java.naming.factory.url.pkgs</key>
<value>org.jboss.naming:org.jnp.interfaces"</value>
</entry>
<entry>
<key>jnp.timeout</key>
<value>5000</value>
</entry>
<entry>
<key>jnp.sotimeout</key>
<value>5000</value>
</entry>
</map>
</constructor>
</bean>
The queue definitions on CLIENT side hornetq-jms.xml:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<connection-factory name="NettyConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
<entry name="/XAConnectionFactory"/>
</entries>
<xa>true</xa>
</connection-factory>
<queue name="DLQ">
<entry name="/queue/DLQ"/>
</queue>
<queue name="ExpiryQueue">
<entry name="/queue/ExpiryQueue"/>
</queue>
<queue name="notificationQueue">
<entry name="/jms/notificationRequestQueue"/>
</queue>
</configuration>
And on the MASTER side hornetq-jms.xml:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<connection-factory name="NettyConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
<entry name="/XAConnectionFactory"/>
</entries>
<xa>true</xa>
</connection-factory>
<connection-factory name="NettyRemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty-remote"/>
</connectors>
<entries>
<entry name="/integration/XAConnectionFactory"/>
</entries>
<xa>true</xa>
</connection-factory>
<queue name="DLQ">
<entry name="/queue/DLQ"/>
</queue>
<queue name="ExpiryQueue">
<entry name="/queue/ExpiryQueue"/>
</queue>
<queue name="targetQueue">
<entry name="/integration/jms/notificationRequestQueue"/>
</queue>
<topic name="unrelatedTopic">
<entry name="/topic/cacheFlushNotification"/>
</topic>
</configuration>
EDIT:
For some reason, the bridge starts transfering messages if I stop and restart the bridge once both servers are completely deployed. This is a manual process, and I loathe to use a hack to periodically restart the bridge. I welcome any suggestions to this issue.
I also improved the startup sequence by making the bridge depend on the queue it reads from - otherwise the bridge is started before the queue, causing errors to log.
Check this post :
https://issues.jboss.org/browse/HORNETQ-247
it gives some insight about how to expose core queue and use them in core bridge.
Why don't you use a core-bridge?

Resources