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 » MQMessage Message Ids

Post new topic  Reply to topic
 MQMessage Message Ids « View previous topic :: View next topic » 
Author Message
Richard McCarthy
PostPosted: Tue Apr 23, 2002 5:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
bower5932
PostPosted: Tue Apr 23, 2002 11:30 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQMessage Message Ids
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.