Author |
Message
|
meetgaurav |
Posted: Wed Oct 29, 2008 2:57 am Post subject: Messages Missing from MQ |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
HI
I have one MDB running in OC4J that just picking the Messages from third party Queue and doing some business Logic and after that am putting the same message in Websphere MQ. Using XA transactions (CMT)..I checked no exceptions thrown by MDB..
Problem is
As soon as my MDB is processing am checking the currdepth of the Queue and it was showing 60 then 65 then 70. Once MDB complete the the Queue is showing 40 as currdepth am loosing some messages here..
Please assist me  |
|
Back to top |
|
 |
atheek |
Posted: Wed Oct 29, 2008 3:04 am Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
Are you sure no application is consuming messages off the MQ  |
|
Back to top |
|
 |
meetgaurav |
Posted: Wed Oct 29, 2008 3:11 am Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
Yes am sure... I checked.. Now am checking it was 35 messages only. |
|
Back to top |
|
 |
atheek |
Posted: Wed Oct 29, 2008 3:53 am Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
Are you setting expiry for the messages? Messages sitting on a queue won't get disappear as such unless
1. its consumed by an application
2. it got expired
3. its a non persistent message and there was a qmgr bounce
double check these for surety |
|
Back to top |
|
 |
meetgaurav |
Posted: Wed Oct 29, 2008 4:18 am Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
1. Am sure no other application consumes.
2. Del Mode:2 Priority:0 [b]Exp Time:5000000[/b]
3. How to make messages persistent ???
DELIVERY_OPTION = 2. I guess '2' mean Persistent ?? |
|
Back to top |
|
 |
atheek |
Posted: Wed Oct 29, 2008 12:04 pm Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
So you are actually setting expiry to 5000 seconds. The message will expire and get removed from the queue if not consumed within 83 minutes. |
|
Back to top |
|
 |
meetgaurav |
Posted: Wed Oct 29, 2008 9:38 pm Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
HI
1 more clarification, Am using XA transaction in my MDB and am creating the session like
connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
whether i need to close the session by code or the CMT will take care of closing the session. Please assist me, Am using OC4J. |
|
Back to top |
|
 |
atheek |
Posted: Wed Oct 29, 2008 10:15 pm Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
Close all the JMS objects in the finally block |
|
Back to top |
|
 |
meetgaurav |
Posted: Wed Oct 29, 2008 10:54 pm Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
HI atheek,
Yes now every thing Fine..
My MDB picking a message from AQ and doing reservation and program logic and finally put the message in Webspehere MQ.
After putting the Message in MQ
In my MDB on message am throwing
throw new CreateException("TESTING XA");
But the MQ message is still there. But it was suppose to rollback rite..
MDB running in OC4J and am using CMT. |
|
Back to top |
|
 |
atheek |
Posted: Thu Oct 30, 2008 1:17 am Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
within the catch block call setRollbackOnly() of userTransaction. This will indicate to the container that the transaction has to be rolled back.
Between how did you address the sequencing ( cancelling ahead of reservation) scenario? |
|
Back to top |
|
 |
meetgaurav |
Posted: Thu Oct 30, 2008 3:57 am Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
Atheek,
Am creating the queue sessiosn like this, queueConnection.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
Am closing Queue connection only. Not sender or session
Also am calling this in Catch block
MessageDrivenContext hex_context.setrollbackonly();
But still the MQ message is in the Queue..
We are discussing abt the cancellation still |
|
Back to top |
|
 |
atheek |
Posted: Thu Oct 30, 2008 7:44 am Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
ok..you are doing the right thing by calling setRollbackonly() of the message driven context.Use a non transacted session for your mqput
queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE); |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 30, 2008 5:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Depending on the appserver this will not work.
In WebSphere per example the global transaction will overwrite your session settings.
So using J2EE make sure you are using the right transactional attributes for your method/session. Requires new is good to do request response...
So if you do request/response scenario I suggest following
Global transaction call MDB. MDB calls method with requires new transaction to send the message and return the messageId.
Call a different method that can participate (or not) in the global transaction to receive the response message.
Remember that any resource (MQ / JMS) acquired by a thread should also be freed by this thread as soon as it is no longer needed.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
meetgaurav |
Posted: Fri Oct 31, 2008 3:43 am Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
But in OC4J the global transaction is not overridding the session settings. So am using code call to session.rollback() and session.commit() |
|
Back to top |
|
 |
meetgaurav |
Posted: Sat Nov 01, 2008 10:55 am Post subject: |
|
|
Voyager
Joined: 08 Sep 2008 Posts: 94
|
Now am controlling my AQ in Global transaction and MQ in Session settings. And this will resolve my issues for now..Also we are discussing about the reservation cancellation.
Thanks a lot to Atheek and FJB saber.. |
|
Back to top |
|
 |
|