File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Doubt in JMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Doubt in JMS" Watch "Doubt in JMS" New topic

Doubt in JMS

inr mohan
Ranch Hand

Joined: May 11, 2005
Posts: 61

* MQ --> JMS(MDB) --> Oracle DB *

The above is the scenario, the data will be read by MQ and MDB will do some processing, then updates the data in to the oracle.

But the restriction here is the DB might go down for 6-7 hours daily, at that time the MDB should not run ( read the message & process it).

Please help me suggesting some design for the above scenario like

1. How to deploy & Undeploy the MDB on timely basis
2. Can I have some scheduler in JMS service

Thanks in Advance
Sunil Dixit
Ranch Hand

Joined: Sep 22, 2005
Posts: 46
I think you can do that,As you know that we have TimerService in EJB 2.1 ownward,which can run automatically on given time period.
So you can use TimeService as background process which keep testing your data base status,if the data base is down that you can undeploy the MDB.
You need to pack your MDB as a seperate JAR file,so that when you deploy/un-deploy other component will not get effected.
And you need to explorer how you can deploy/undeploy JAR files on different conatiners.
But I can give to some start point so that you can start as far as deployment/un-deployment is concern.
If you go to your application server amin page,where you can deploy/un-deploy your EJB,just place the mouse over the link than It will show what url is being invoked.
e.g. in Tomcat if you want to stop any context than http://<host>:<port>/manager/html/stop?path=<context name> is used
and we can achive using simple java code which make connection to given url and stop the context.
So when the timer service came to know that database is down than it will undeploy your MDB and when DB is back than it will deploy the MDB.

Hope that this will help you.

Sunil Dixit
I agree. Here's the link:
subject: Doubt in JMS
jQuery in Action, 3rd edition