|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Reliable MDBs with WebLogic and MQ without using ETC XA |
« View previous topic :: View next topic » |
Author |
Message
|
denis85 |
Posted: Wed Jul 20, 2011 1:11 pm Post subject: Reliable MDBs with WebLogic and MQ without using ETC XA |
|
|
Newbie
Joined: 20 Jul 2011 Posts: 2
|
Good day!
Hope you can shed a light on a problem I've stuck at.
Configuration:
MQ V6 on a one host
WebLogic 10.3.3 on another host, e.g. client connection
Target:
Create an MDB that will process a message from the MQ and put it into the database. Should the MDB onMessage() fail, the message must be left in MQ (e.g. "Reliable delivery") and processed again. Distributed transactions (XA) are not necessarily, it is tolerable to submit duplicate messages into the database.
Issues:
1. Use of XA transactions is not possible because of high licensing cost of MQ ETC client (mqetclient.jar) when using client connection. I could turn XA off, but ...
2. If a general MQ JMS connection factory (and not XA) is configured for MDBs, WebLogic does not allow to use CMT MDBs (container transactions). I could switch CMT off, but ...
3. Switching CMT transactions off I would expect a message to be backed to MQ queue should onMessage method fail. However, I noticed that if a client fails during the session.recover() after an exception in onMessage(), the message gets lost. I suspect this is happening because of MQGMO_NO_SYNCPOINT in the underlying WMQ API (which I cannot control). It must be AUTO_ACKNOWLEDGE mode that sets MQGMO_NO_SYNCPOINT, and CLIENT_ACKNOWLEDGE should help, but ...
4. WebLogic (and probably MDB spec) does not allow to specify CLIENT_ACKNOWLEDGE mode for MDBs - only AUTO or DUPS_OK. So I'm stuck here.
I guess it is possible to implement it in a no-MDB way, but this would be non-standard and leave me without any WebLogic MDB monitoring, configuration and deployment bounties.
Any advice on this is much appreciated. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 20, 2011 7:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You need to implement your MDB in 2 methods
- the onMessage method => requires new transaction
- doDBWork method =>requires new transaction
This way you can stay with container controlled transaction.
In the onMessage method you must call the doDBWork method to do your DB work.
You need to trap in the onMessage method any exceptions including transaction exceptions and throw the correct exception for the MDB to roll MQ back.
You run the risk of an MQ rollback between the time of the DB commit and MQ commit but it should be minimal.
Now you may need to check as well with your J2EE provider if using an MDB forces XA or not...
Hope this helps some  _________________ MQ & Broker admin |
|
Back to top |
|
 |
denis85 |
Posted: Fri Jul 22, 2011 1:39 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2011 Posts: 2
|
Hi, fjb_saper
thanks for advice. I tried wiping out all database code from the MDB and enabling CMT (so it just receives a message and prints it, no datasources injected), however WebLogic still requires XA transactions to be enabled. It seems that CMT implies an externally managed transaction for MQ which XA exactly is.
Also I found a property (XMSC_WMQ_SYNCPOINT_ALL_GETS) of JMS connection factory which should mandate using MQGMO_SYNCPOINT. After digging into trace files of the MQ client I found that sync get is used but the message gets committed after an MDB fail!
It turns out that WebLogic catches an exception from an MDB, tries to session.recover(), fails... and swallows the exception. The underlying MQ message consumer does not get any hint of exception from WebLogic MessageListener and commits the session successfully.
Fortunately, I tried the same test with our UAT MQ instance deployed on z/os (mine is on Windows) and the session.recover() error is gone. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|