Making RabbitMQ JMSClient work with my existing JMS application

329 views
Skip to first unread message

Niranjan Subramanian

unread,
Oct 27, 2015, 7:00:56 AM10/27/15
to rabbitmq-users, Mahadevan Lakshminarayanan
Hello folks, 

I have a generic JMS application which works with following JMS providers WebSphere, HornetQ and ActiveMq. I'm trying to use this application against RabbitMq adding the required RabbitMQ JMSClient dependency in the classpath of my application. I'm quite stuck at the place where I pass few parameters to my application like Context.INITIAL_CONTEXT_FACTORY, Context.PROVIDER_URL whose values I'm not able to determine for RabbitMQ. I understand RabbitMQ isn't a JMS provider so it doesn't have those InitialContext classes and Provider URL but RabbitMQ JMSClient documentation says to put the configuration parameters in a configuration file something like this 

<Resource   name="jms/ConnectionFactory" 
            type="javax.jms.ConnectionFactory" 
         factory="com.rabbitmq.jms.admin.RMQObjectFactory" 
        username="guest" 
        password="guest" 
     virtualHost="/" 
            host="localhost" 
             ssl="true"/>

What is this file? And how do I associate this file with my application? The closest thing I could find is putting this in a binding file and give its location as Provider URL and "com.sun.jndi.fscontext.RefFSContextFactory" as the InitialContext class. But I'm still not clear with the format of this file.

Can somebody throw light on how I can use RabbitMQ JMSClient with my application? Also if possible share some code snippets.

Regards,
Niranjan

Gary Russell

unread,
Oct 27, 2015, 3:07:24 PM10/27/15
to rabbitm...@googlegroups.com, Mahadevan Lakshminarayanan
That looks like a tomcat JNDI resource; if you're running in tomcat, just configure the resource according to the tomcat docs.

If you're running stand-alone, the RabbitMQ JMS client doesn't provide a JNDI implementation itself. It's pretty trivial to write your own, though.

You have to know a bit about JNDI internals to use the provided ObjectFactory, but you can write a really lightweight JNDI provider that creates the objects directly.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niranjan Subramanian

unread,
Oct 28, 2015, 1:02:41 AM10/28/15
to rabbitm...@googlegroups.com, Mahadevan Lakshminarayanan
Hi Gary,

Thanks for the pointers. So there is no straightforward way to use RabbitMQ's JMSClient directly with an existing JMS application? And yes in my case its a standalone application not a web application. 

Is there any reference that I can look up which uses this class com.rabbitmq.jms.admin.RMQObjectFactory based on which I can write my own JNDI provider implementation?

Regards,
Niranjan

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/Nub2kd91Y0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages