views:

607

answers:

3

Is that possible to run HornetQ (JBoss JMS implementation) on Tomcat?

The HornetQ documentation is all about JBoss AS or standalone scenarios...

Update:
This is from HornetQ feature list: "HornetQ is architected as a set of Plain Old Java Objects, it can therefore be run in JBoss Microcontainer, Spring, Google Guice or embedded in any third party product and instantiated directly".

So I would be glad to to know how the Web Application (WAR) running on plain Tomcat can embed HornetQ?

+1  A: 

Tomcat is the same as standalone, you just have Tomcat running in a JVM and all you need to do is put the proper classes in the classpath.

Everything here is in the manual

1) You need to have a HornetMQ server running.
2) Put the jar files in the Tomcat classpath. 3) Put the proper Queue Connection factories and Queue Connections into your JNDI provider.

You are now ready to run...

1) Get QCF and Q properties from JNDI. 2) Access in Servlet.

Romain Hippeau
Romain, thanks for reply. Have you managed to run this configuration? I am not sure I understand how will HornetQServer be started? What's the trigger? It looks as standalone HornetQServer comes with built-in JNDI implementation, but Tomcat has its own one, can it be re-used?
Gennady Shumakher
@Gennady Shumakher is a separate server that you run just like Tomcat. The whole purpose of Message Queueing is that it is a reliable system and you application does not need to be running to have messages going back and forth. Like a database it is independent of TomCat.
Romain Hippeau
@Gennady Shumakher it runs as a service on your server, just like you would setup Tomcat
Romain Hippeau
@Romain Hippeau, but then it misses the point... Maybe I need to update the question. I want to run HornetQ as embedded broker in Web Application (WAR) running on Tomcat. This from HornetQ feature list: "HornetQ is architected as a set of Plain Old Java Objects, it can therefore be run in JBoss Microcontainer, Spring, Google Guice or embedded in any third party product and instantiated directly". So I would like to know how that can be achieved in WAR running on plain Tomcat...
Gennady Shumakher
@Gennady Shumakher Look at Chapter 43 of the manual, they have how to embed it into an application
Romain Hippeau
A: 

Has anyone put the resources of HornetQ (connection factory / destination) into Tomcat JNDI rather than the JBoss JNP?

Rajiv
A: 

To Rajiv HornetQ can be integrated with Tomcat JNDI and can be used from from spring beans. Description here http://wash-inside-out.blogspot.com/2010/08/hornetq-jms-integration-with-tomcat.html

Igor