wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Persistent Messages, What heppens if a system is started! 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 "Persistent Messages, What heppens if a system is started!" Watch "Persistent Messages, What heppens if a system is started!" New topic
Author

Persistent Messages, What heppens if a system is started!

Mike Boota
Ranch Hand

Joined: Jul 18, 2002
Posts: 82
Hi,

I am new to JMS and trying to understand. I have a Web Service that put messges on a queue. Now on the consumer side I have a Message Driven Bean. What if my MDB is not available and the WS puts some messages in a queue. The messages are still in a queue but not consumed as MDB is not available. Now I restarted the whole system and server and redeployed the MDB but I don't see any messages being consumed by MDB even though there are some messages that are put by Web Service before starting the System. Are the messages lost if in a queue but not yet consumed and a system or server is restarted.

How can I make the messages available in a queue all the time even after a restart. Here is a snippet of code that ques the messages.



If messages gets lost if the system or server is restarted then what's the point of Persistent Messages. Any help is appreciated.

Thanks


MB<br />Sun Certified Programmer for Java2 Platform
Mike Boota
Ranch Hand

Joined: Jul 18, 2002
Posts: 82
Using Oracle App. Server

Thanks
Jorge Ribeiro
Ranch Hand

Joined: Oct 18, 2005
Posts: 40
Something strange with your scenario- if the messages are persistent then they must survive an application server restart. What application server are you using? And which JMS Provider- the one coming with the App Server or something else like MQSeries or Oracle Streams?
Mike Boota
Ranch Hand

Joined: Jul 18, 2002
Posts: 82
Using Oracle App. Server and using the povider that comes with the App. Server.

Thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

But what is your back-end data store, is it a database.

As an example, JBoss stores messages in a database. By default it uses the DefaultDS DataSource, which out of the box is Hypersonic, which is an in-memory database, so if the server crashes or is restarted you lose the messages that are in the database. If you change the DefaultDS to point to a database like Oracle, then the messages are persisted even if the server crashes. and on restart reget those saved messages and deliver them.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mike Boota
Ranch Hand

Joined: Jul 18, 2002
Posts: 82
I haven't set the default datasource and am not sure where exactly that needs to be set. I assumed if not using DB the messages will be store to a file.

Following is what I have in my MDB ejb-jar.xml


and here is my orion-ejb.jar


I don't see any default datasource settings any idea where I hav to define that. Thanks
 
 
subject: Persistent Messages, What heppens if a system is started!
 
Similar Threads
MDB onMessage() not firing....Help needed please!
MQJE001: Completion Code 2, Reason 2085
Queue problem
context.lookup
JMS on JBOSS- Asynchronous Queue Receiver