This configuration will allow you to migrate your systems using JBossMQ to JBM(JBoss Messaging). Many Enterprise systems are complex and have multiple applications and can’t be migrated from JBossMQ to JBM all at one time.
Made up Use Case: For instance, your business is selling items, some you make directly and some you farm out to other distributors. Your ordering system is JBossMQ based. Customers place orders that are then queued up to be processed(via JBossMQ). You also use MQ to queue up the orders that you need to produce and you also queue up the orders that will go to your other distributors. You use MDB’s in three separate places in your operation. You want to do a staged migration from JBossMQ to JBM. That requires that JBossMQ and JBM work together. This is exactly what the JBM bridge was meant to do. It’s meant to take messages from one queue/topic and transfer them to another queue/topic. This helps with the migration by allowing you to pull messages from your JBossMQ queues automatically and push them into your JBM Queues. You can also do the opposite, you can push messages from your JBM system to your JBossMQ system. In our example, we want to replace the ordering side(producer) with JBM. We push messages into the JBM Order queue, but we set the bridge up to send all of those messages to the JBossMQ Order queue. The rest of your processing happens as normal. Lets say you want to leave your ordering system intact, but you want to have JBM and EJB3 MDBs process the orders. You can have your old client put messages in JBossMQ as normal, but you set the bridge up to pull the messages from JBossMQ Order queue and push them into the JBM Order queue.
This allows JBM and JBossMQ to interact together by pushing messages back and forth between different systems.
1. You have one JBoss instance set up for JBoss Messaging and One Jboss instance set up that has your old JBoss MQ on it.
2. We are copying messages from JBossMQ(Source) to JBM(Target)
Steps to Set up the bridge
Step 1 Copy the jbossmq.jar from the Source Machine(JBossMQ) under the server/default/lib/ to the messaging configuration on the Target JBM machine(server/messaging/lib)
note: substitute what ever your messaging server configuration is above. I used the default stand alone messaging server configuration note: This is required to dereference the JBossMQ objects that are dereferenced on the JBM side. If you don’t copy the jar over, you will get a “java.lang.ClassCastException?: javax.naming.Reference” exception and the bridge will not be able to start
Step 2 Add the remote JBossMQ provider to the jms-ds.xml file in the server/messaging/deploy directory on your target(JBM) machine.
Here is an example of the provider to add.
Please note that you will need to change the java.naming.provider.url so that it points to your JBossMQ machine. Everything else should remain the same. Keep your jms-ds.xml file open, because you will be addning another entry in it for the next step.
Step 3 Add the Bridge provider to the jms-ds.xml file in the server/messaging/deploy directory on your target(JBM) machine.
Here is an example bridge configuration
Please note that my target is the current JBM JMS Provider and the source is the JBossMQ remote provider. If you have a pretty stock system and you want to move messages from JBossMQ to JBM, you will not have to change this example except for the queue Names. If you wish to move from JBM to JBossMQ, just switch the soure and target definitions.
Start the JBossMQ system and then just start the JBM system and the messages will begin to move over.
Note: I have attached the example jms-ds.xml file that I used for the test. If you want to test the brige first and you have a stock JBM system(JBM has been installed using the default configuration), then you can just copy the jms-ds.xml file over the one in server/messaging/deploy and begin to put messages in the JBossMQ system under the /queue/TestQueue. The messages will then be moved over to your JBM queue /queue/A. Both of these queues exist in the stock versions of JBM and JBossMQ.
Note: You can also merge topics back and forth from JBM to JBossMQ, by setting the subscription name and client id. You can see these arguments in the JBM Bridge information link.