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 » Browse message

Post new topic  Reply to topic
 Browse message « View previous topic :: View next topic » 
Author Message
crayon_coco
PostPosted: Tue Mar 15, 2005 1:23 am    Post subject: Browse message Reply with quote

Apprentice

Joined: 08 Oct 2003
Posts: 33

I've written a method in C# to browse the message from the queue without removing using MessageID

I realise when the message is found in the Queue i will get the correct message, if the message doesn't exist in the queue i still get the last message in the queue, what could be the problem?

Below in my method

public void Browse(string queueName, byte[] messageID)
{

queue = queueManager.AccessQueue(queueName,MQC.MQOO_BROWSE + MQC.MQOO_INQUIRE + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_SHARED);
MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions();
queueGetMessageOptions.Options += MQC.MQGMO_BROWSE_FIRST + MQC.MQMO_MATCH_MSG_ID;
bool done = false;
do
{
try
{
MQMessage queueMessage = new MQMessage();
queueMessage.MessageId = messageID;
queue.Get(queueMessage,queueGetMessageOptions);
this.message = queueMessage.ReadString(queueMessage.MessageLength);
this.isExist = true;
this.isCompleted = true;
queueGetMessageOptions.Options = QGMO_BROWSE_NEXT + MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT + MQC.MQMO_MATCH_MSG_ID;
}
catch(MQException exp)
{
if(exp.Reason==MQC.MQRC_NO_MSG_AVAILABLE)
{
this.errorMessage = "Message Not Available";
this.isCompleted = true;
done = true;
}
else
{
this.isCompleted = false;
this.errorMessage = exp.Message;
throw new Exception(exp.ToString());
}
}
}while(!done);
}
Back to top
View user's profile Send private message
Nigelg
PostPosted: Tue Mar 15, 2005 10:48 pm    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

The match msg id option does not go in the GMO, but in the MD Matchoptions field.
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 API Support » Browse 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.