tags:

views:

41

answers:

1

Hello,

Can someone point me to a tutorial or similar code where JMS is used by a web app to execute a long running background process? (instead of using threads), I'm fairly familiar with the concepts of JMS messaging, but never used any JMS API or brokers (i'm looking at learning Apache ActiveMQ)

I'd like to be able to: submit a message to the queue to run a process check the status (progress) on that process at arbitrary times

Thanks!

+1  A: 

The real point of using JMS in your context is to start tasks asynchronously. This is called fire and forget in middleware lingo. JMS has guaranteed delivery semantics, meaning that once the message has been put on the queue it is guaranteed to get there ... eventually.

The idea is you do any tasks you need to do and if you have any tasks in the process that can be done at a later time, then you put a message on a queue and later it will execute. This allows you to cut down processing by a significant amount while somebody is waiting for a response.

Another benefit of JMS is that the different parts of the system do not need to be running at the same time. The part that consumes messages can be down for maintenance while your front end still works.

Romain Hippeau
Thanks, are there any examples on using JMS for message oriented architectures?
wsb3383
Also, for this approach would you recommend using a publish/subscribe method or a queueing method, why?
wsb3383