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 Index » IBM MQ API Support » .NET get a JMS message

Post new topic  Reply to topic Goto page 1, 2  Next
 .NET get a JMS message « View previous topic :: View next topic » 
Author Message
spinkbickle
PostPosted: Tue Nov 01, 2005 8:11 am    Post subject: .NET get a JMS message Reply with quote

Newbie

Joined: 01 Nov 2005
Posts: 7

I am using the Websphere .NET client to get a message put by a JMS client. The message is posted in MQHRF2 format. I cannot get the provider to change the TargetClient property. I am attempting to use the MQGO_CONVERT to change the message to a MQSTR on get. Here is my code snippet:

MQMessage mqMsg;
MQGetMessageOptions mqGetMsgOpts;

mqMsg = new MQMessage();
mqGetMsgOpts = new MQGetMessageOptions();
mqGetMsgOpts.WaitInterval = 15000;
mqGetMsgOpts.Options = MQC.MQGMO_CONVERT +
MQC.MQGMO_ACCEPT_TRUNCATED_MSG +
MQC.MQGMO_BROWSE_FIRST;
mqMsg.CharacterSet = 1200;
mqMsg.Encoding = 546;
mqMsg.Format = MQC.MQFMT_STRING;

mqQueue.Get(mqMsg, mqGetMsgOpts, 1000000);
Output = qMsg.ReadString(mqMsg.MessageLength);

on the .Get I get an error (2190) MQRC_CONVERTED_STRING_TOO_BIG. I have search the IBM docs but cannot figure out how to get this to work. Any help with this is greatly appreciated.

Thanks
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Nov 01, 2005 8:34 am    Post subject: Re: .NET get a JMS message Reply with quote

Jedi Knight

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

Hi,
spinkbickle wrote:
mqQueue.Get(mqMsg, mqGetMsgOpts, 1000000);

on the .Get I get an error (2190) MQRC_CONVERTED_STRING_TOO_BIG.

First-off, you should read the WMQ Application Programming Guide manual.

Secondly, why are you telling MQ that your 'receive message buffer' should be 1MB. Obviously, the receive buffer needs to be larger. Why don't you let MQ determine the size?
Code:
mqQueue.Get(mqMsg, mqGetMsgOpts);


Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Nov 01, 2005 8:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Third, you probably DO NOT want to be using MQC.MQGMO_BROWSE_FIRST.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Nov 01, 2005 9:09 am    Post subject: Reply with quote

Jedi Knight

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

Ah. Good point. And of course now that I looked hard at the code, I see more errors and a couple don'ts.

Code:
MQMessage mqMsg;
MQGetMessageOptions mqGetMsgOpts;

mqMsg = new MQMessage();
mqGetMsgOpts = new MQGetMessageOptions();
mqGetMsgOpts.WaitInterval = 15000;

// non-destructive Get (browse)
mqGetMsgOpts.Options = MQC.MQGMO_BROWSE_FIRST + MQC.MQGMO_WAIT + MQC.MQGMO_CONVERT + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQGMO_ACCEPT_TRUNCATED_MSG;

// destructive Get
//mqGetMsgOpts.Options = MQC.MQGMO_WAIT + MQC.MQGMO_CONVERT + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQGMO_ACCEPT_TRUNCATED_MSG;

mqQueue.Get(mqMsg, mqGetMsgOpts);
Output = qMsg.ReadString(mqMsg.MessageLength);

Of course, spinkbickle needs to decide if he REALLY wants to browse or read (consume) the messages. Also, I wonder if spinkbickle understands 'Accept Truncated Messages' means?

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Nov 01, 2005 9:13 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'm guessing, actually, that spinkbickle is attempting to filter the queue, and so does know what BROWSE and ACCEPT_TRUNCATED_MESSAGE do.

But I'm guessing also that spinkbickle is attempting to filter the queue for the wrong reasons.

But none of that has anything to do with his error message, which is all about trying to convert single byte characters into multi-byte characters, and not having enough room to do it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
spinkbickle
PostPosted: Tue Nov 01, 2005 9:25 am    Post subject: Reply with quote

Newbie

Joined: 01 Nov 2005
Posts: 7

Quote:
First-off, you should read the WMQ Application Programming Guide manual.

I have read the whole manual and the specific answer to this question is not in there. If it was I wouldn't be posting. Pointing out that someone should read 665 page manual is not all that helpful.

Quote:
Secondly, why are you telling MQ that your 'receive message buffer' should be 1MB. Obviously, the receive buffer needs to be larger. Why don't you let MQ determine the size?


Sorry, I made a mistake when I posted my code, as I was trying anything I could think of and giving it a really large buffer size was one thing I attempted. The message I am getting is actually quite small. And I get the same error code without specifing the buffer.

MQC.MQGMO_BROWSE_FIRST does not have any effect on whether the message is converted or not, it has to do with which message I retrieve, right?

I appreciate both of you pointing out the inconsistencies with my code, but neither of those answer the question of why I can't get the message converted.

Here is my updated code, which still returns a MQRC_CONVERTED_STRING_TOO_BIG.

Code:
               MQMessage mqMsg;
               MQGetMessageOptions mqGetMsgOpts;

               mqMsg = new MQMessage();
               mqGetMsgOpts = new MQGetMessageOptions();
               mqGetMsgOpts.WaitInterval = 15000;
               mqGetMsgOpts.Options =  MQC.MQGMO_CONVERT + MQC.MQGMO_ACCEPT_TRUNCATED_MSG;
               mqMsg.CharacterSet = 1200;
               mqMsg.Encoding = 546;
               mqMsg.Format = MQC.MQFMT_STRING;
               mqQueue.Get(mqMsg, mqGetMsgOpts);



Thanks Eric
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Nov 01, 2005 9:29 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Setting the format on a MQGET - what does that do?

Does it override a lack of a MQMD.format (it would be handy if it did)?

Does the message have a format (MQSTR) in the MQMD?

Is the message data in the codepage described by the MQMD.CCSID?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 01, 2005 9:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Messages Manual, API Completion and Reason Codes wrote:
2190 (X'088E')MQRC_CONVERTED_STRING_TOO_BIG
Explanation:
On an MQGET call with the MQGMO_CONVERT option included in the
GetMsgOpts parameter, a string in a fixed-length field in the message
expanded during data conversion and exceeded the size of the field.
When this happens, the queue manager tries discarding trailing blank
characters and characters following the first null character in order to
make the string fit, but in this case there were insufficient characters that
could be discarded.

This reason code can also occur for messages with a format name of
MQFMT_IMS_VAR_STRING. When this happens, it indicates that the IMS
variable string expanded such that its length exceeded the capacity of the
2-byte binary length field contained within the structure of the IMS
variable string. (The queue manager never discards trailing blanks in an
IMS variable string.)

The message is returned unconverted, with the CompCode parameter of
the MQGET call set to MQCC_WARNING. If the message consists of
several parts, each of which is described by its own character-set and
encoding fields (for example, a message with format name
MQFMT_DEAD_LETTER_HEADER), some parts may be converted and other
parts not converted. However, the values returned in the various
character-set and encoding fields always correctly describe the relevant
message data.

This reason code does not occur if the string could be made to fit by
discarding trailing blank characters.

Completion Code:
MQCC_WARNING

Programmer Response:
Check that the fields in the message contain the correct values, and that
the character-set identifiers specified by the sender and receiver of the
message are correct. If they are, the layout of the data in the message
must be modified to increase the lengths of the field(s) so that there is
sufficient space to allow the string(s) to expand when converted.


The format of your incoming message is NOT MQFMT_STRING, if it's got
an MQRFH2 on it. I would leave mqMsg.Format alone before you Get.

spinkbickle wrote:
MQC.MQGMO_BROWSE_FIRST does not have any
effect on whether the message is converted or not, it has to do with which
message I retrieve, right?

Not exactly. It also tells the system not to remove the message, but
leave it on the queue.

Which almost nobody wants to do, usually - even when they think they do!
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
spinkbickle
PostPosted: Tue Nov 01, 2005 9:40 am    Post subject: Reply with quote

Newbie

Joined: 01 Nov 2005
Posts: 7

If I get the message without the MQGMO_CONVERT option here are the pertinent values I receive for the message I'm getting:

CharacterSet 819
Encoding 273
Format "MQHRF2 "

During testing I prefer not to have to keep posting messages so I used the MQGMO_BROWSE_FIRST option for a non-destructive get. Maybe there is a better way to do that?

I added the MQGMO_ACCEPT_TRUNCATED_MSG thinking that if the message was larger than the buffer then at least I would get part of the message and could go from there (at least that what the manual says that option will do). But alas that doesn't make any difference either.

Thanks again. Eric
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Nov 01, 2005 10:19 am    Post subject: Reply with quote

Jedi Knight

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

spinkbickle wrote:
Quote:
First-off, you should read the WMQ Application Programming Guide manual.

I have read the whole manual and the specific answer to this question is not in there. If it was I wouldn't be posting. Pointing out that someone should read 665 page manual is not all that helpful.

Well, if you don't want to read the manual then at least use the table of contents to look stuff up. Because we are not here to do that for you.

Did you try the piece of code that I posted?? It should work unless your message is 4MB in size.

spinkbickle wrote:
Code:
mqMsg.CharacterSet = 1200;
mqMsg.Encoding = 546;
mqMsg.Format = MQC.MQFMT_STRING;

Why are you insisting of setting these fields? Back to reading the manual: don't do it unless it is absolutely required and I see nothing in your situation that requires it.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
wschutz
PostPosted: Tue Nov 01, 2005 10:21 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Perhaps I don't understand...are you trying to get rid of the RFH2 header? You can't do that with MQ conversion. You just have to skip over the header to get to your data payload.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
spinkbickle
PostPosted: Tue Nov 01, 2005 10:27 am    Post subject: Reply with quote

Newbie

Joined: 01 Nov 2005
Posts: 7

wschutz wrote:
Perhaps I don't understand...are you trying to get rid of the RFH2 header? You can't do that with MQ conversion. You just have to
skip over the header to get to your data payload.


Thanks that answer my original question, which maybe wasn't all that obvious ....

Quote:
I am using the Websphere .NET client to get a message put by a JMS client. The message is posted in MQHRF2 format. I cannot get the provider to change the TargetClient property. I am attempting to use the MQGO_CONVERT to change the message to a MQSTR on get


Thanks
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Nov 01, 2005 10:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Also, re: MQRC_CONVERTED_STRING_TOO_BIG .. I don't think this means his buffer is too small, I think this means MQ can't push the double-byte character fields back into the RFH2 header structure elements.

For example, the eyecatcher "RFH " can't be converted into dbcs and then placed back into the four byte field.....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
wschutz
PostPosted: Tue Nov 01, 2005 10:36 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

So, get the message, read the first 8 bytes (skipping eyecather and version #), read the next four bytes as an integer (structure length), subtract 12 (for the 12 bytes you already read), and then read that many bytes... that should put you at your data payload.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
spinkbickle
PostPosted: Tue Nov 01, 2005 10:56 am    Post subject: Reply with quote

Newbie

Joined: 01 Nov 2005
Posts: 7

THANKS wayne! I think that gets me in the right direction, sorry for the confusion over my original question .... I realize this must be obvious to you all.

The reason I thought that I needed to convert the message is that when I do a ReadString my message looks like this:

RFH \0\0\0\0\0\0¬\0\0\0\0¸MQSTR \0\0\0\0\0\0¸\0\0\0 <mcd><Msd>jms_text</Msd></mcd> \0\0\0`<jms><Dst>queue://XXXXXX/QUEUE_NAME</Dst>
<Tms>1130788874477</Tms><Dlv>2</Dlv></jms><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<GenericAck TargetSystem=\"BETS\" TransactionProcess=\"RPRRb\" TransactionStatus=\"\" .........

I thought some combination of CharacterSet and Encoding might get message back to something that was easily worked on in .NET ....

Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » .NET get a JMS message
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.