Author |
Message
|
lodha13 |
Posted: Thu May 17, 2012 3:05 am Post subject: reading message throwing 2115 |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
Hi
I have 8 messages in a group. 4(good message)+2(bad message)+2(good message)
My application reads first 4 good messages and as soon as it reads 5 bad messages it throws an exception 2111 "data conversion". My application calls backout when error is thrown. After calling backout it puts all the messages back to the queue(even the first 4 messages which were successfully read since it is group message). My application again reads the queue all over again.
Note: At this time queue again contains the same messages which were initially present 4 good + 2 bad + 2 good.
My application again read the queue. As soon as it reads the first good message it throws 2115 MQRC_TARGET_CCSID_ERROR error. Please note that the same message was read successfully in the first attempt.
Can you please help here.
Thanks
Abhishek |
|
Back to top |
|
 |
JasonE |
Posted: Thu May 17, 2012 4:42 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
If its a C application, are you ensuring you reset the MD to its defaults prior to recalling the MQGET for the start of the 2nd time through? I wonder if you have residual information in the MD |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 17, 2012 4:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's also possible that the messages are being put back to the queue incorrectly after the failure.
You should use amqsbcg and take an export of the messages before you run the program, and then take another export when you see the error.
Look for things like a change in the CCSID on the message itself or a change in the contents of the message due to conversion WITHOUT a similar change in the CCSID. That is, you might be inadvertently writing the message out with the CCSID being converted and not the data or the data being converted and not the CCSID.
It's not clear from what you've said if you're using a single transaction for all the messages or not. |
|
Back to top |
|
 |
lodha13 |
Posted: Thu May 17, 2012 5:41 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
Thanks for the reply
Its a Java application.
I have cross checked the CCSID and encoding of the good message being put again(after backout) in the queue is same as before.
It's not clear from what you've said if you're using a single transaction for all the messages or not.
Its a one transaction.
It's also possible that the messages are being put back to the queue incorrectly after the failure.
It is expected that message will be put back to the same queue(before threshold) if error occurs.
One more question
When a message is bad in a group then what should be the behavior.
1) Should it backout complete group to a backout queue
2) Should it consume good message and backout bad message to backout queue from the group.
3) It depends on how we want to handle
I mean What does RFC says |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 17, 2012 5:56 am Post subject: Re: reading message throwing 2115 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lodha13 wrote: |
My application calls backout when error is thrown. |
What backout? WMQ backout? XA backout? A custom backout? Describe your mechanism.
lodha13 wrote: |
After calling backout it puts all the messages back to the queue |
What's "it"? Your application? WAS? An XA controller?
lodha13 wrote: |
(even the first 4 messages which were successfully read since it is group message). |
Do you really mean a group message or do you mean they're individual messages all in the same transaction? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 17, 2012 5:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Whether or not you use a single transaction and back out the whole group for one bad message is very much "it depends".
If you are using a transaction, then it's MQ that's backing everything out and not your code, so then it's not the problem that the message on the queue has changed.
Which puts it back to JasonE's point about clearing MQMD and parms that you pass to MQGet. |
|
Back to top |
|
 |
lodha13 |
Posted: Thu May 17, 2012 6:10 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
Its a WMQ backout. The messages are in group not indivdual messages |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu May 17, 2012 8:36 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
lodha13 wrote: |
Its a WMQ backout. The messages are in group not indivdual messages |
Specifically, all messages are in a WMQ message group - with a single GroupId?
And the consuming app MQGETs every message in the group MQGMO_SYNCPOINT? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
lodha13 |
Posted: Fri May 18, 2012 6:07 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
I am still a leaner of WSMQ.
Why it is changing the charset when put again to the queue as part of qMgr.backout(). |
|
Back to top |
|
 |
lodha13 |
Posted: Fri May 18, 2012 6:13 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
This is the code
Code: |
gmo.options = MQC.MQGMO_LOGICAL_ORDER | MQC.MQGMO_ALL_MSGS_AVAILABLE;
gmo.options += MQC.MQGMO_CONVERT;
gmo.options += MQC.MQGMO_SYNCPOINT;
gmo.matchOptions = MQC.MQMO_MATCH_GROUP_ID;
while (true)
{
try
{
byte b[] = new byte[10000];
do
{
myQueue.get(myMessage, gmo);
System.out.println(myMessage.characterSet+" "+myMessage.encoding+" "+myMessage.format);
System.out.println("group id "+myMessage.groupId.toString().getBytes());
myMessage.readFully(b,0,myMessage.getDataLength());
String s = new String(b, "US-ASCII");
System.out.println("message "+s);
gmo.matchOptions = MQC.MQMO_MATCH_GROUP_ID;
}
while(gmo.groupStatus != MQC.MQGS_NOT_IN_GROUP && gmo.groupStatus != MQC.MQGS_LAST_MSG_IN_GROUP);
}
catch(MQException e)
{
if(e.reasonCode == 2111)
{
System.out.println(myMessage.characterSet+" "+myMessage.encoding+" "+myMessage.format);
System.out.println("Conversion error "+e);
backout_message();
}
if(e.reasonCode == 2033)
{
System.out.println("queue is empty "+e);
break;
}
if(e.reasonCode == 2115)
{
System.out.println(myMessage.characterSet+" "+myMessage.encoding+" "+myMessage.format);
}
backout_message() is the function which calls qMgr.backout() until threshold is reached. If threshold is reached it puts the message to the backout queue |
|
|
Back to top |
|
 |
Vitor |
Posted: Fri May 18, 2012 6:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lodha13 wrote: |
I am still a leaner of WSMQ. |
Clearly. As you've not yet learned to spell it. One of the regulars will pop up like a jack in the box to espouse formal training so I'll not spoil his thunder. I'll just reiterate that this forum is not a place to get training, or used to replace training.
lodha13 wrote: |
Why it is changing the charset when put again to the queue as part of qMgr.backout(). |
How have you proved that it is? Or if you prefer, how have you disproved the theory expounded further up this thread? Given the additional evidence you've now scattered across the forum, I suspect that theory is all or part of the case. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lodha13 |
Posted: Fri May 18, 2012 6:19 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
Please give the answer atleast at one thread. How will read the message second time. |
|
Back to top |
|
 |
Vitor |
Posted: Fri May 18, 2012 6:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lodha13 wrote: |
Please give the answer atleast at one thread. |
You first. You've been asked a couple of questions you've not answered, and been given a potential answer to your problem a while back. I think it's fairly reasonable for me to ask why that's not the answer to your issue before trying to determine another one. Especially as your explaination of why the first answer is not correct will illuminate what the correct answer is.
Remember, we can't see your set up, your situation or any code you've not posted. All we know is what you tell us. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri May 18, 2012 6:24 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Please stop opening new threads for the same issue.
Please confirm that the all of the messages arrive on the queue with the same CCSID - BEFORE your consuming app attempts to get them.
Please answer questions that you are asked. For example, I asked if the group of messages were actually a WMQ Message Group (with a unique GroupId)?
Does the same app create the all of the messages in the group?
Does it create all of the messages in a single Unit of Work? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
lodha13 |
Posted: Fri May 18, 2012 6:26 am Post subject: |
|
|
Novice
Joined: 17 May 2012 Posts: 24
|
Please see above. I have pasted the code |
|
Back to top |
|
 |
|