Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes JMS Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Example " Watch "JMS Example " New topic

JMS Example

Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Hi ,
Ranchers !! Please Give me a typical use of JMS. An example would help enhance my funda .. abt JMS.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Thanx for the link. But I have the tuorial with me and will go with it. I need to know some fundamental uses of JMS. So please gimme some real life example buddy.
Tiberiu Paun

Joined: Sep 02, 2003
Posts: 10
I don't really got what u asked, and please excuse my poor knowledge and skip this post, in case it's not u were looking for.
An example of JMS usage might be this: supposing u have 2 applications, one sends requests to the the other. If these requests are "getters", than u should use Java sesssion Beans, because u need that answer answer (get a customer address).
But if these requests are "updates" or "creates" (change customer's address), than u are not interested in the response of the second application, because if they fail, a system administrator can look at those fails, see why they failed, and resubmit them in some cases.
That would imply, of course, to have an error queue (or topic), but that's different topic.
These 2 applications might not have anything in common, so that's why you may not be interested if a flow failed or not. Maybe the second application is down for some time (but it will start again), but the first application might have no ideea about this, and you may not be able to change not even a line of code in these applications.
If you put a JMS server between those 2 applications, then your problems might be solved.
about an example of JMS, I would suggest u, from my poor knowledge, to use the examples from the example directory of your JMS server, because there are differences (it happened to me from Sun's J2EE server, different versions, as well as between Weblogic different versions).
Best regards, Tibi
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
A simple example is email notification. Let's say your application sends email to a group of 100,000 people when a certain event occurs, for example when a newletter is published. There are two choices for sending these emails:
1) Send them synchronously, and make the user block while all 100,000 emails are sent.
2) Send a JMS message and have the listener send the 100,000 emails. Since JMS is asynchronous, the user will not have to wait until all emails are sent before they can continue. Furthermore, the sending of our emails is not something that needs to occur in a time sensitive manner, we just need them to eventually go out. This is a perfect fit for JMS.
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Thanx guys for the example. My Fellow mate was wondering what would go in for the time-critical systems.Thanx.
I agree. Here's the link:
subject: JMS Example
Similar Threads
Running java-threads in JBoss
JMS Examples
jms example on publish/subscribe
JMS and Firewalls
notification pattern