ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ Java / JMSMessage lost, with MQJMS under XA Transaction & weblogic

Post new topicReply to topic
Message lost, with MQJMS under XA Transaction & weblogic View previous topic :: View next topic
Author Message
abhay09
PostPosted: Fri Sep 02, 2016 2:13 am Post subject: Message lost, with MQJMS under XA Transaction & weblogic Reply with quote

Acolyte

Joined: 31 May 2016
Posts: 50

Guys,


I ran into 1 more issue, pls help.
I tried searching and reading docs but couldn't find.

Scenario:

My code is reading message from MQ queue and processing it, then putting in different queue 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.

Now, when a message with Encoding set as "546" came to MQ queue1
then :
1.) My code is able to read that message
2.) Able to separate out payload and properties
3.) Getting all MQMD properties from message

At sending side to MQqueu2

1.) creating a new message
2.) writing all properties , read from MQ queue 1
example :
message.setIntProperty(WMQConstants.JMS_IBM_MQMD_ENCODING, 546);
3.) writing playload to message and sending

In this case, when tx.commit() happened, then it commits successfully without any errors but can see any message in MQ queue 2

tried again same scenario and same thing happend.
transaction commits with no errors/exceptions in logs and still not able to browse message in MQ queue2.

Not able to understand where my message has gone?
no errors, exceptions and not abel to see message in MQ queue 2

Please suggest , who swallowed exceptions or why is message get lost.




Tried similar thing with no transactions and TM.

Sample code:

MQXAConnectionFactory connectionFactory = new MQXAConnectionFactory();
connectionFactory.setHostName(hostname);
connectionFactory.setChannel(channel);
connectionFactory.setPort(port);
connectionFactory.setQueueManager(qManager);
connectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
JmsXAContext context = (JmsXAContext) connectionFactory.createXAContext();
MQQueue queue = (MQQueue) context.createQueue(qName);
queue.setMQMDWriteEnabled(true);
queue.setMQMDReadEnabled(true);
queue.setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);
JMSProducer producer = context.createProducer();
message.setIntProperty(WMQConstants.JMS_IBM_MQMD_ENCODING, 546);
producer.send(queue, message);


when ran this code, getting following exception:

Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2142' ('MQRC_HEADER_ERROR').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:202)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1226)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1183)
at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:75)



It seems header issue.

I cannot skip XA here and all message processing should be under XA and any message with any encoding (set to message) can come to my request queue.
In this case, i cannot afford message loss, either need to report exception or commit messsge(browse in other queue)


Now my question is :
1.) Why we are not getting any error/exceptions when message flows are under XA transactions?
2.) How to prevent message loss in XA Transaction case?


Please share any input.

Any help will be appreciated.

Thanks!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Sep 02, 2016 4:07 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17187

The first step when dealing with transactions is to determine if the commit actually failed.

This is done by looking at the queue depth and comparing it with the number of messages you can browse using amqsbcg (or some other tool that lets you browse messages).

If the queue depth is different than the number of messages you can see, then messages are in an uncommitted state.

You can also look at the UNCOM property when you display queue status (DIS QSTATUS).
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Fri Sep 02, 2016 2:22 pm Post subject: Re: Message lost, with MQJMS under XA Transaction & webl Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 2988
Location: London, ON Canada

abhay09 wrote:
In this case, when tx.commit() happened, then it commits successfully without any errors but can see any message in MQ queue 2

tried again same scenario and same thing happend.
transaction commits with no errors/exceptions in logs and still not able to browse message in MQ queue2.

Well, It sounds like your code did not catch the RC 2142. MQ does not log these type of application errors.

abhay09 wrote:
Code:
queue.setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);

Do you know what this does??? It means YOU (your code) must set certain fields of the MQMD but I don't see that code anywhere. Read this page: https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q032350_.htm

abhay09 wrote:
Code:
message.setIntProperty(WMQConstants.JMS_IBM_MQMD_ENCODING, 546);

This is a VERY bad idea. Is encoding 546 for big endian or little endian? Do you even know what I'm talking about? You should be letting MQ do the conversion. If you are running on a little endian platform and the encoding is for big endian (or vice versa) then YOU MUST convert all integers to be in big endian format. If none of this makes any sense then do not set the encoding. Use the default encoding for your platform and MQ will handle the conversion for you.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
abhay09
PostPosted: Sat Sep 03, 2016 4:38 am Post subject: Re: Message lost, with MQJMS under XA Transaction & webl Reply with quote

Acolyte

Joined: 31 May 2016
Posts: 50

RogerLacroix wrote:
abhay09 wrote:
In this case, when tx.commit() happened, then it commits successfully without any errors but can see any message in MQ queue 2


tried again same scenario and same thing happend.
transaction commits with no errors/exceptions in logs and still not able to browse message in MQ queue2.

Well, It sounds like your code did not catch the RC 2142. MQ does not log these type of application errors.

abhay09 wrote:
Code:
queue.setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);

Do you know what this does??? It means YOU (your code) must set certain fields of the MQMD but I don't see that code anywhere. Read this page: https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q032350_.htm

abhay09 wrote:
Code:
message.setIntProperty(WMQConstants.JMS_IBM_MQMD_ENCODING, 546);

This is a VERY bad idea. Is encoding 546 for big endian or little endian? Do you even know what I'm talking about? You should be letting MQ do the conversion. If you are running on a little endian platform and the encoding is for big endian (or vice versa) then YOU MUST convert all integers to be in big endian format. If none of this makes any sense then do not set the encoding. Use the default encoding for your platform and MQ will handle the conversion for you.

Regards,
Roger Lacroix
Capitalware Inc.



This is just a sample code, not my actual code..
Actually In real scenario, I am putting message to request queue using MQ Explorer, my system reading this message, processing and when putting in response queue( all get/put under XA), found a message loss.

Then when compared properties with other message , found that it's a Encoding problem.
When putting from MQ Explorer encoding coming as 546.

So, wrote a sample code to check how it is working for encoding 546.


Now, as per my env all processing are under XA. and when i put message to request queue using MQ Explorer and then my system reading & sending to diff queue, my message is getting lost. But when putting message in request queue from sample java/jms code and then my system reading & sending to diff queue, then no message loss.




Please suggest why message are getting lost in case of XA if I put message in request queue from mq explorer, no error message reported no exception , txn committed as well..

Only difference found between putting msg from MQ Explorer and java client is encoding value.

Please share your input.
how can i resolve this issue? or debug this issue as no exceptions reported and message getting lost.


Last edited by abhay09 on Sat Sep 03, 2016 4:46 am; edited 1 time in total
Back to top
View user's profile Send private message
abhay09
PostPosted: Sat Sep 03, 2016 4:42 am Post subject: Reply with quote

Acolyte

Joined: 31 May 2016
Posts: 50

mqjeff wrote:
The first step when dealing with transactions is to determine if the commit actually failed.

This is done by looking at the queue depth and comparing it with the number of messages you can browse using amqsbcg (or some other tool that lets you browse messages).

If the queue depth is different than the number of messages you can see, then messages are in an uncommitted state.

You can also look at the UNCOM property when you display queue status (DIS QSTATUS).


I checked Q depth via MQ Explorer, and cant see any increase in my response queue but can notice decrements in request queue.

Means message have been read from request queue, processed but when sending to response queue, txn committed, no error reported and cant browse in response queue as well.
So , message getting lost.

Please help how to debug this issue?
Who is swallowing exception MQ? or weblogic?

No idea, even I am also getting lost.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Sep 03, 2016 4:52 am Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6070
Location: Somewhere over the Rainbow this side of Never-never land.

Why are you putting the message using MQExplorer?
Why not use a tool that allows you to control the CCSID and Encoding etc?
i.e. something like RFHUTIL.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
abhay09
PostPosted: Sat Sep 03, 2016 4:53 am Post subject: Reply with quote

Acolyte

Joined: 31 May 2016
Posts: 50

smdavies99 wrote:
Why are you putting the message using MQExplorer?
Why not use a tool that allows you to control the CCSID and Encoding etc?
i.e. something like RFHUTIL.


Just for testing, putting message via:

1.) MQ JMS Client
2.) MQ Java Client
3.) MQ explorer


So, in MQ explorer case, message getting lost.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Sep 03, 2016 5:52 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19100
Location: LI,NY

abhay09 wrote:

I checked Q depth via MQ Explorer, and cant see any increase in my response queue but can notice decrements in request queue.

Means message have been read from request queue, processed but when sending to response queue, txn committed, no error reported and cant browse in response queue as well.
So , message getting lost.

Please help how to debug this issue?
Who is swallowing exception MQ? or weblogic?

No idea, even I am also getting lost.

Wrong. The decrease happens when the message is consumed. Not when it is committed. If the message is rolled back you'd see an increase in the queue depth again...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Sat Sep 03, 2016 8:02 am Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6070
Location: Somewhere over the Rainbow this side of Never-never land.

abhay09 wrote:
smdavies99 wrote:
Why are you putting the message using MQExplorer?
Why not use a tool that allows you to control the CCSID and Encoding etc?
i.e. something like RFHUTIL.


Just for testing, putting message via:

1.) MQ JMS Client
2.) MQ Java Client
3.) MQ explorer


So, in MQ explorer case, message getting lost.


That didn't answer my question.
So you use MQ Explorer and it fails. Good. Don't use it again.
This won't be the way that the data it put on the queue in production now will it????
The thing with RFHUTIl is that you can not only browse messages, set message properties and all that, you can save messages that are on a queue in a form that makes the operation repeatable.
It is used all the time in MQ and IIB (and more) integration environments.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 05, 2016 8:29 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19100
Location: LI,NY

There might be a hint there. The message with MQExplorer is a non persistent message. Do you have some network problems? Non persistent messages may get discarded in case of network trouble.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Java / JMSMessage lost, with MQJMS under XA Transaction & weblogic
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.