Configuring the JMS Router
By Antony Reynolds-Oracle on Mar 19, 2007
JMS Router ConfigurationPart of the Oracle Enterprise Messaging System that ships with Oracle Containers for J2EE (OC4J) is the JMS Router. Last week I had occasion to talk to one of our support engineers who expressed confusion about why anyone would want to use the JMS Router. So what is it for and how do you use it.
Router Use CaseThere are others but a common use case is to connect two dissimilar routing technologies. For example we may want to move messages from an Oracle AQ domain into an IBM MQ domain. This is useful because AQ is strong at providing a secure message system inside the database. If AQ is unavailable then the database is probably down as well so the clients probably can't put messages onto the queue, so AQ is a great place to put messages before transferring them to other domains. MQ is often installed as a messaging backbone in a corporation, I remember using it 10 years ago on AIX and TPF.
Moving messages from AQ to MQ then provides an application a secure way to transfer messages from a database centric domain to a messaging backbone. If MQ is down then the router will keep trying to transfer the messages until MQ is back up. This is achieved without the need for costly MQ Server software on every application server, only AQ in the database server needs licensing, there are no license costs to use AQ from the mid-tier systems.
Setting up JMS RouterSo how do we set up the JMS router. Using the Oracle Enterprise Manager web based JMX console we navigate to the JMS configuration (select Administration and then JMS Destinations) and ensure that we have two queues. For initial testing I created a second queue located at jms/demoQueue2 - I made it a memory based queue.
I found that I also needed to set up a log queue called jms/Queues/OracleASRouter_LOGQ. This is used by the JMS Router.
I then navigated to the JMX Router configuration (select Administration, then Oracle JMS Router and finally operations) and created a new router job (addRouterJob). The name of the job is arbitary but it is mandatory to provide the following four properties.
- message-source (jms/demoQueue the from queue)
- source-connection-factory (jms/ConnectionFactory the from connection factory)
- message-target (jms/demoQueue2 the to queue)
- target-connection-factory (jms/ConnectionFactory the to connectin factory)
Any messages placed on jms/demoQueue will now be transferred to jms/demoQueue2.
The next trick is to replace jms/demoQueue2 with a non-Oracle messaging system. I will return to this later. in the eantime enjoy moving messages around.