Hi,
I am using JBoss 3.2.3. I have an class which writes to a queue which is
listened by a MDB.
I am using :
queueSession =
queueConnection.createQueueSession(false,Session.CLIENT_ACKNOWLEDGE);
to create a queue session. When i write out a message to the queue, it is
picked by the MDB and control reaches the onMessage method.
Here's the code in my onMessage:
public void onMessage(Message message) {
| System.out.println("Hello in onMessage");
|
|
| try {
| message.acknowledge();
| System.out.println("Acknowledged msg");
| } catch (JMSException e) {
| System.out.println("exception acknowleding msg");
| e.printStackTrace();
| }
|
| System.out.println("Sleeping");
| try {
| Thread.sleep(20000);
| System.out.println("Woke up"); } catch
(InterruptedException e1) {
| System.out.println("Could not sleep");
| e1.printStackTrace();
| }
|
|
| }
I have acknowledged the message by invoking message.acknowledge().
What i am trying to do here is whenever the control reaches the onMessage(i.e.
the message is delivered) i want to acknowledge the same so that it WONT be
REDELIVERED even if some exception occurs later.
What i tried out was:
Once the control reached onMessage and the "Sleeping" message was displayed on
the console, i SHUTDOWN jboss(Note: The onMessage wasnt yet finished since it
had gone into sleep). Later i started jboss again.
What i found was the message WAS REDELIVERED and the control reached onMessage
again.
What i was expecting was once i acknowledged the message, it should NOT be
redelivered irrespective of what happens later in onMessage method.
Can anyone please tell me whether i am doing this right?
Thank you
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3899588#3899588
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3899588
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user