|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQMessage Message Ids |
« View previous topic :: View next topic » |
Author |
Message
|
Richard McCarthy |
Posted: Tue Apr 23, 2002 5:39 am Post subject: |
|
|
Newbie
Joined: 17 Mar 2002 Posts: 2
|
After a message has been read from a queue should you be able to see the valid messageId in the MQMessage object even if you have not specifically read on a message Id ?
My reason for asking is that I have read a message ok and I know it had a messageId as I saw it via MQ explorer but I always get back a byte [] which only contains zeroes.
Also if the messageId should be correct would the same also be true of the correlationId and groupId's ?
Any help would be much appreciated,
Thanks,
Richard |
|
Back to top |
|
 |
bower5932 |
Posted: Tue Apr 23, 2002 11:30 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I used the following code fragment:
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT;
MQMessage myMessage = new MQMessage();
try {
/*****************************************/
/* Reset the message and IDs to be empty */
/*****************************************/
myMessage.clearMessage();
myMessage.correlationId = MQC.MQCI_NONE;
myMessage.messageId = MQC.MQMI_NONE;
/**************************************************/
/* Browse the message, display it, and ask if the */
/* message should actually be gotten */
/**************************************************/
myQueue.get(myMessage, gmo);
String msg = myMessage.readString(myMessage.getMessageLength());
for (int i=0; i<24; i++) {
System.out.print((char)myMessage.messageId[i] + " ");
}
System.out.println();
System.out.println("MsgId: " + myMessage.messageId);
System.out.println("corId: " + myMessage.correlationId);
} catch (MQException ex) {
/**************************************************/
/* Probably encountered our no message available: */
/* write out error and mark loop to be exited */
/**************************************************/
System.out.println("MQ exception: CC = " + ex.completionCode
+ " RC = " + ex.reasonCode);
} catch (java.io.IOException ex) {
System.out.println("Java exception: " + ex);
}
and I can get out the message id of the message that I got. The message id is actually a byte string, so it isn't 100% valid to print it out in char format. I wasn't sure how to use a hex qualifier on the print.
[ This Message was edited by: bower5932 on 2002-04-23 13:46 ] |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|