I'm very new to Tomcat and JMS, but I would like to do the following:
1. Send POST to servlet from a web form (I have this working)
2. Have the servlet send a message to a JMS queue (PTP) (I want ActiveMQ running within Tomcat here)
3. Have a separate Java process listen to the queue and consume the message (PTP)
Pretty simple yes? I'm having a lot of trouble because there is a seemingly infinite amount of configuration to do with Tomcat, ActiveMQ, JNDI, etc etc. I can't swallow the tutorials out there on the web, because most of them are not for my particular situation (some use Spring, some use Topics not PTP queues, some aren't using ActiveMQ, yada yada). Not to mention the JMS/JNDI API's are scary for a total newbie.
Can anyone point me in the right direction? I can't seem to find a straightforward tutorial for PTP JMS on Tomcat/ActiveMQ for absolute beginners.
The JMS API sequence in a servlet is basically the same as it would be for a standalone Java application. Getting a separate process to run in response with the JMS request is something that the JMS server has to deal with.
The only major caveat is that the servlet shouldn't be spending a long time waiting for the JMS server to post a response back, since HTTP (including servlets and JSPs) is expected to respond relatively quickly. If the process in question takes a long time, you should offload the JMS request/wait to a background processor rather than attempt to handle it directly in the servlet doPost method.
Customer surveys are for companies who didn't pay proper attention to begin with.
The example in the article uses an HTML form to post a message to an ActiveMQ queue which is consumed by the Spring message listener container. Pretty simple stuff really. The article provides a brief description of using ActiveMQ and Tomcat which was excerpted from the forthcoming book ActiveMQ In Action which contains much more detail on this topic in chapter 8.
Hi Anthony Rowlands,
I am also working on almost same use case:
1. I need to POST data to Tomcat using servlets over HTTP (This is working).
2. Then, need to send and receive messages to ActiveMQ over JMS Queue.
3. ActiveMQ process the message received and send response back.
I dont know how to do the 2nd and third step. I am very new to all. I hope you are done with this usecase upto now. Can you direct me for the configurations neededand steps involved.
Or Is there anyone else can help me out for the same.
Thanks in advance