Integrate Open MQ Messaging
In this procedure, you will learn how to integrate Kaazing Gateway and Open Message Queue (Open MQ), a community sponsored, messaging middleware product that implements and extends the Java Message Service (JMS) standard.
To Integrate Open MQ Messaging
- Download and install Open MQ following the instructions in the Open MQ documentation. The directory that contains the Open MQ installation (for example,
C:\Program Files\Sun\MessageQueue
on Windows) is referred to asOPENMQ_HOME
. - Using the Open MQ administration console, add an object store and create a connection factory named
ConnectionFactory
in it. Refer to the Open MQ documentation for more information. - Copy the following JAR files from
OPENMQ_HOME/mq/lib
toGATEWAY_HOME/lib/ext
.- imq.jar
- fscontext.jar
- Open the file
GATEWAY_HOME/conf/gateway-config.xml
in a text editor and locate thejms
service element (search for jms). -
Update the
jms
service element properties section as shown in the following example (changes shown in lines 6-14). Note that the naming provider URL (the value of theenv.java.naming.provider.url
property in line 13) can be determined from the imqadmin console of OpenMQ</span>.<service> <accept>ws://localhost:8001/jms</accept> <accept>wss://localhost:9001/jms</accept> <type>jms</type> <properties> <connection.factory.name>ConnectionFactory</connection.factory.name> <context.lookup.topic.format>%s</context.lookup.topic.format> <context.lookup.queue.format>%s</context.lookup.queue.format> <env.java.naming.factory.initial> com.sun.jndi.fscontext.RefFSContextFactory </env.java.naming.factory.initial> <env.java.naming.provider.url>file://tmp</env.java.naming.provider.url> </properties> <cross-site-constraint> <allow-origin>http://localhost:8001</allow-origin> </cross-site-constraint> <cross-site-constraint> <allow-origin>https://localhost:9001</allow-origin> </cross-site-constraint> </service>
Notes:
- On UNIX or Linux, use
file:///tmp
as the value for ` env.java.naming.provider.url`. - You can also connect to your Open MQ Messaging server using SSL and the
env.java.naming.provider.url
element. For more information, see Open MQ Messaging documentation.
- On UNIX or Linux, use
JMS Integration Verification
To verify that the JMS integration is working, perform the following steps:
- Start Open MQ.
- Start the Gateway as described in Setting Up the Gateway.
- In a browser, navigate to the out of the box demos at
http://localhost:8001/demo/
. - Click the JavaScript demo.
- Change the value for Location to
ws://localhost:8001/jms
. - Provide a valid user name and password for the values of User Name and Password. By default, Open MQ will have a
guest
user account with the passwordguest
. -
Click Connect.
The message “
CONNECT: ws://localhost:8001/jms
” should appear in the log window followed by the message “CONNECTED: undefined
” - Enter a destination to an existing topic or queue (for example,
/topic/destination
) and click Subscribe. - Click Send. You should see the message that you sent in the message log.
Notes
- To learn how to secure your JMS configuration, see Secure Your JMS Configuration.
- Because you are using a JMS provider that does not support individual message acknowledgement, you must ensure your client applications acknowledge each message received from a queue or durable subscriber. Otherwise, the client will receive only one message from that queue or durable subscriber.
See Also
- For information on troubleshooting JMS integration, see Troubleshoot JMS Integration.
- For information on troubleshooting JMS clients, see Troubleshoot Your Clients.
- For general troubleshooting information, see Troubleshoot Kaazing Gateway.