Author |
Message
|
abhay09 |
Posted: Mon Jan 02, 2017 3:59 am Post subject: Message lost with no error with MQJMS XA Txn & weblogic |
|
|
Acolyte
Joined: 31 May 2016 Posts: 66
|
Scenario:
My code is reading message from MQ queue (request Q) and processing it, then putting in different queue (response Q) using MQJMS API and all are under user XA Transactions,
using weblogic as TM.
So,
1.) Registers MQ queue 1 XA resource to Weblogic TM
2.) Registers MQ queue 2 XA resource to Weblogic TM
3.) Started a new transaction
4.) Enlisted both resources
5.) Transaction commit
This flow is working fine.
While testing, Got one use case to set "MessageType" as Request(1) and replyToQ is not set.
this combination should throw error as :
'com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2027' ('MQRC_MISSING_REPLY_TO_Q')"
Created same env and sending following message to queue under XA transaction and weblogic as TM to get exception but messages are getting lost with no error reported in logs.
Message:
reqMsg :
JMSMessage class: jms_bytes
JMSType: null
JMSDeliveryMode: 2
JMSDeliveryDelay: 0
JMSDeliveryTime: 0
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: null
JMSTimestamp: 0
JMSCorrelationID: null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
JMS_IBM_Character_Set: UTF8
JMS_IBM_Encoding: 273
JMS_IBM_Format:
JMS_IBM_MQMD_AccountingToken: 0000000000000000000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_ApplIdentityData:
JMS_IBM_MQMD_ApplOriginData:
JMS_IBM_MQMD_CodedCharSetId: 1208
JMS_IBM_MQMD_CorrelId: 000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_Encoding: 273
JMS_IBM_MQMD_Expiry: -1
JMS_IBM_MQMD_Feedback: 0
JMS_IBM_MQMD_GroupId: 000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_MsgFlags: 0
JMS_IBM_MQMD_MsgId: 414D5120514D5F3134313620202020209A3A6A5803270020
JMS_IBM_MQMD_MsgSeqNumber: 1
JMS_IBM_MQMD_MsgType: 1
JMS_IBM_MQMD_Offset: 0
JMS_IBM_MQMD_OriginalLength: -1
JMS_IBM_MQMD_Persistence: 0
JMS_IBM_MQMD_Priority: 4
JMS_IBM_MQMD_PutApplName:
JMS_IBM_MQMD_PutApplType: 0
JMS_IBM_MQMD_PutDate: 20170102
JMS_IBM_MQMD_PutTime: 114241097
JMS_IBM_MQMD_ReplyToQ:
JMS_IBM_MQMD_ReplyToQMgr: QM_1416
JMS_IBM_MQMD_Report: 64
JMS_IBM_MQMD_UserIdentifier:
3c3f786d6c207665727312e302220656e636f64696e673d225554462d38223f3e0a3c
6c2f3e
This message when sending to Queue under XA Txn and weblogic TM are getting lost and no error reported.
Also, enabled MQJMS trace in weblogic server via:
com.ibm.msg.client.commonservices.trace.status=ON
com.ibm.msg.client.commonservices.trace.outputName=mq-jms-trace.log
com.ibm.msg.client.commonservices.trace.level=8
then also not getting any error in log file.
When debugged more, understood that if I change the JMS_IBM_MQMD_Persistence value to 1, then it is throwing XA Exception on commit.
But, my client can send JMS_IBM_MQMD_Persistence: 0 messages to queue and we don't want any loss of messages.
Please guide how to prevent this situation and why IBM is not throwing any exception to weblogic TM.
Please help, its urgent.
Thanks! |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 02, 2017 6:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you don't want any loss of messages you need to ensure that the message persistence is set to persistent. There is no way around that.
Now if the response is routed to a different queue manager... it is entirely possible that the message went to the DLQ of the destination queue manager or died in the channel if not persistent...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
abhay09 |
Posted: Mon Jan 02, 2017 6:39 am Post subject: |
|
|
Acolyte
Joined: 31 May 2016 Posts: 66
|
ok, but why IBM MQ trace logs, doesnot have any exception/errors for the message loss.
Its very strange to see message is loss, though MQ server is not restarted or n/w failure ..
Message is getting lost for any exception in non persistent messages using MQJMS API under XA txn .
is it designed same way? can you pls point to documentation that states that? so , that i can give same reference to my client. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 02, 2017 10:06 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
abhay09 wrote: |
ok, but why IBM MQ trace logs, doesnot have any exception/errors for the message loss.
Its very strange to see message is loss, though MQ server is not restarted or n/w failure ..
Message is getting lost for any exception in non persistent messages using MQJMS API under XA txn .
is it designed same way? can you pls point to documentation that states that? so , that i can give same reference to my client. |
It does not matter whether the message is persistent or not, if the MQI call resulted in an exception the message did not get processed. On a put that means that MQ never had the message, so it could not possibly loose it... Now if the application does not handle the exception properly this might look like a lost message... but it is the application's responsibility to make sure the hand-off to MQ actually happened... (no exceptions thrown)...
The MQ trace logs would show nothing as the information is supposed to be written to the application logs as this is where the error happened... and the exception was thrown...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
abhay09 |
Posted: Mon Jan 02, 2017 8:44 pm Post subject: |
|
|
Acolyte
Joined: 31 May 2016 Posts: 66
|
The message is non persistent and under XA txn with weblogic TM.
Now, for any issue in message like msgType=1 and replyToQ is not set, we are expecting an exception from MQ side.
But under XA transaction we are not getting any exception nor can see message in MQ queue. So, it seems message lost without giving any information to client,
Please help in finding out why MQ is not throwing any exception for non-persistent messages under XA transaction.
Message format:
JMSMessage class: jms_bytes
JMSType: null
JMSDeliveryMode: 2
JMSDeliveryDelay: 0
JMSDeliveryTime: 0
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: null
JMSTimestamp: 0
JMSCorrelationID: null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
JMS_IBM_Character_Set: UTF8
JMS_IBM_Encoding: 273
JMS_IBM_Format:
JMS_IBM_MQMD_AccountingToken: 0000000000000000000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_ApplIdentityData:
JMS_IBM_MQMD_ApplOriginData:
JMS_IBM_MQMD_CodedCharSetId: 1208
JMS_IBM_MQMD_CorrelId: 000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_Encoding: 273
JMS_IBM_MQMD_Expiry: -1
JMS_IBM_MQMD_Feedback: 0
JMS_IBM_MQMD_GroupId: 000000000000000000000000000000000000000000000000
JMS_IBM_MQMD_MsgFlags: 0
JMS_IBM_MQMD_MsgId: 414D5120514D5F3134313620202020209A3A6A5803270020
JMS_IBM_MQMD_MsgSeqNumber: 1
JMS_IBM_MQMD_MsgType: 1
JMS_IBM_MQMD_Offset: 0
JMS_IBM_MQMD_OriginalLength: -1
JMS_IBM_MQMD_Persistence: 0
JMS_IBM_MQMD_Priority: 4
JMS_IBM_MQMD_PutApplName:
JMS_IBM_MQMD_PutApplType: 0
JMS_IBM_MQMD_PutDate: 20170102
JMS_IBM_MQMD_PutTime: 114241097
JMS_IBM_MQMD_ReplyToQ:
JMS_IBM_MQMD_ReplyToQMgr: QM_1416
JMS_IBM_MQMD_Report: 64
JMS_IBM_MQMD_UserIdentifier:
3c3f786d6c207665727312e302220656e636f64696e673d225554462d38223f3e0a3c
6c2f3e
Please help, how to rollback this message as it should throw an exception but we are not getting any exception not message in Mq queue. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 03, 2017 5:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
abhay09 wrote: |
Please help in finding out why MQ is not throwing any exception for non-persistent messages under XA transaction. |
Because by setting the message to be non-persistent you're telling MQ that message loss doesn't matter. Your code should be trapping that 2027 and reporting it as it occurs within your code, probably on the put. So from an MQ point of view, it's not "lost" anything. You never put the reply successfully (because MQ refused the put with a 2027) and the fact that the request message was read and not replied to is no big deal because it's not persistent.
abhay09 wrote: |
Please help, how to rollback this message as it should throw an exception but we are not getting any exception not message in Mq queue. |
Have your code issue an XA rollback if it gets an error rather than an XA commit. An XA commit is a signal to all registered participants that the transaction completed successfully and they should finish up. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
abhay09 |
Posted: Tue Jan 03, 2017 10:58 pm Post subject: |
|
|
Acolyte
Joined: 31 May 2016 Posts: 66
|
>>Have your code issue an XA rollback if it gets an error rather than an XA commit. An XA commit is a signal to all registered participants that the transaction completed successfully and they should finish up.
Yes, but I am not getting any error that why transaction is not getting rollbacked.
I was expecting an error but no error reported for this wrong message.
Please help what to do in this case? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 04, 2017 5:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
abhay09 wrote: |
Yes, but I am not getting any error that why transaction is not getting rollbacked.
I was expecting an error but no error reported for this wrong message. |
So your code doesn't get a 2027 when it replies to a non-persistent request using a non-existent reply to queue? If the original message is non-persistent the MQPut / MQPut1 / JMS send returns a CC & RC of 0 even though you're putting with a blank queue name?
abhay09 wrote: |
Please help what to do in this case? |
Raise a PMR. Even if you don't get a 2027 you should be getting a 2085. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 04, 2017 5:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Possibly no 2085 because the reply to qmgr is remote.
Check if there is any message in the DLQ of the remote queue manager.
And remember that if the message is non persistent, any hick-up in the channel may get the message discarded...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 04, 2017 6:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Also check, as with any transactional message, that the messages aren't sitting uncommitted on the relevant output queues.
I.e. check that UNCOMM on the queue status isn't set. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
abhay09 |
Posted: Tue Jan 17, 2017 12:12 am Post subject: |
|
|
Acolyte
Joined: 31 May 2016 Posts: 66
|
Hi All,
Raised a PMR against IBM and understood it is a expected behavior.
"If an application sends persistent messages within a transacted session, and one or more of the messages are not received safely, the transaction fails to commit and produces an exception. However, if an application sends nonpersistent messages within a transacted session, and one or more of the messages are not received safely, the transaction commits successfully. The application does not receive any feedback that the nonpersistent messages did not arrive safely."
Reference : https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q032560_.htm
Under txn for any issue in non-persistent , no exception reported |
|
Back to top |
|
 |
|