Author |
Message
|
jasmin |
Posted: Thu Nov 10, 2005 4:30 am Post subject: Convert message to String |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Nov 10, 2005 4:36 am Post subject: |
|
|
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 |
|
 |
fschofer |
Posted: Thu Nov 10, 2005 4:43 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Hi,
please post your get message options => gmo
Greetings
Frank |
|
Back to top |
|
 |
jasmin |
Posted: Thu Nov 10, 2005 6:00 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Nov 10, 2005 6:02 am Post subject: |
|
|
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 |
|
 |
jasmin |
Posted: Thu Nov 10, 2005 6:36 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Nov 10, 2005 6:54 am Post subject: |
|
|
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 |
|
 |
jasmin |
Posted: Thu Nov 10, 2005 7:03 am Post subject: |
|
|
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 |
|
 |
EddieA |
Posted: Thu Nov 10, 2005 11:11 am Post subject: |
|
|
 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 |
|
 |
webspherical |
Posted: Thu Nov 10, 2005 6:08 pm Post subject: |
|
|
Acolyte
Joined: 15 Aug 2005 Posts: 50
|
exactly.
looks like it's bytes.. |
|
Back to top |
|
 |
|