users@glassfish.java.net

Stop JMS client from picking any new message for some time period ....

From: <forums_at_java.net>
Date: Tue, 29 Nov 2011 22:23:24 -0600 (CST)

Hi,   I need your help in following scenario. I also want to know that is it
feasible to do it or not. *Background:* Message on queue is pushed by a
separate independent system. I have a system, which uses glassfish JMS with
client using the MessageListner and MessageDrivenBean. JMS processing
includes saving some data coming in message to the database. Data is
calculation intrisic, so the sequence of data pushed in JMS needs to be
processed in that way for any specific account no. Processing example can be
assumed as for an account no. we may get to add/resuce/mutiply/divide some
amount to balance. As per my knowledge, by dafault 32 sessions can be created
by glassfish for accessing the data. Sessions are created automatically based
on the load on queue. *Scenario:* As per the requirment, I need to stop
processing any furthur messages, once I found DB not available error while
saving data. I need to keep DB checking regularly, for its availability. If
available we will start pocessing data to it. *Question: *As 32 default
sessions (JMS Threads) will be created and each will be processing the
messages. My program will be check for the availability of db, before
starting the processing in onMessage method. In case once the thread knows
that there is a problem, it should stop picking any new message, and should
also indicate all threads about it, so that a new thread didn’t get
spawned. How I can stop my JMS client from picking any new message ? This
will help us in saving our resource engaged in 32 threads. Thanks & Regards,
Anand

--
[Message sent by forum member 'anand2379']
View Post: http://forums.java.net/node/869169