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 Java / JMS » Convert message to String

Post new topic  Reply to topic
 Convert message to String « View previous topic :: View next topic » 
Author Message
jasmin
PostPosted: Thu Nov 10, 2005 4:30 am    Post subject: Convert message to String Reply with quote

Novice

Joined: 04 Nov 2005
Posts: 15

Hello,

I've written a Java program, trying to get Messages from a queue and storing the
message in a String.

See following code fragment:
Code:

MyQueue_GET.get(MyMessage_GET, gmo);

String MyMQMsg = MyMessage_GET.readString(MyMessage_GET.getMessageLength());

When I try to run this code I receive the following Error code.

MQJE001: Completion code 1 Reason code 2110

I think the problem is, that the message formate is not String. Can anybody
tell me what I have to do to convert the message to String?

Thanks,
Jasmin.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 10, 2005 4:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

First you have to determine what the message looks like.

The sample program amqsbcg, which will be installed if you installed the samples, is very helpful for this. If you're on a client installation, you can use amqsbcgc.

Then you have to determine if the message is broken because it can't be converted, or it's okay if it can't be converted (maybe it's already converted...). If it's okay, then you can code another GET that doesn't specify the convert option.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fschofer
PostPosted: Thu Nov 10, 2005 4:43 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

please post your get message options => gmo

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
jasmin
PostPosted: Thu Nov 10, 2005 6:00 am    Post subject: Reply with quote

Novice

Joined: 04 Nov 2005
Posts: 15

Hi fschofer,

here are the get message options:

Code:

MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_ACCEPT_TRUNCATED_MSG |     MQC.MQGMO_CONVERT;


Hi jefflowrey:

I can't figure out what you mean. Do you mean that I should use the amgsgetc.exe? That doens't work because the buffer is too small for the message (header and so on...)
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 10, 2005 6:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No, not amqsgetc.exe or amqsget.exe.

AMQSBCG.exe or AMQSBCGC.exe.

This will browse the messages on the queue, and display the contents. It's very handy.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jasmin
PostPosted: Thu Nov 10, 2005 6:36 am    Post subject: Reply with quote

Novice

Joined: 04 Nov 2005
Posts: 15

Ok, found them. So what do I have to do now? How can I check the messages?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 10, 2005 6:54 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jasmin wrote:
Ok, found them. So what do I have to do now? How can I check the messages?


You have to run the program, and tell it what queue manager to connect to and what queue to read.


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jasmin
PostPosted: Thu Nov 10, 2005 7:03 am    Post subject: Reply with quote

Novice

Joined: 04 Nov 2005
Posts: 15

Ok, now I've just changed the GetMessageOptions and it's working.
Thanks for helping.
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Nov 10, 2005 11:11 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
I've just changed the GetMessageOptions and it's working

Except now you are not converting the message. Which may, or may not, be what you want.

Did you actually look up the reason for 2110:
Quote:
The format name in the message is MQFMT_NONE.
A user-written exit with the name specified by the Format field in the message cannot be found.
The message contains data that is not consistent with the format definition.

I would guess that the MQMD Format has not been set, in which case, fix the application that PUTs the message.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
webspherical
PostPosted: Thu Nov 10, 2005 6:08 pm    Post subject: Reply with quote

Acolyte

Joined: 15 Aug 2005
Posts: 50

exactly.
looks like it's bytes..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Convert message to String
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.