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 » Browsing beyond first message in C#

Post new topic  Reply to topic
 Browsing beyond first message in C# « View previous topic :: View next topic » 
Author Message
jdmcfadden
PostPosted: Fri Oct 10, 2003 3:10 pm    Post subject: Browsing beyond first message in C# Reply with quote

Newbie

Joined: 10 Oct 2003
Posts: 3
Location: Calhoun, GA

Based on rampant Googling, this seems like an old question, but nothing I've run across has worked yet . . .

Using C# and the AMQMDNET library, I would like to be able to browse beyond the first message in a queue. But I always get the first message back regardless. My code looks like this (assume a connection to the manager is already established):

MQMessage mqMsg = new MQMessage();
MQGetMessageOptions mqMsgOpts = new MQGetMessageOptions();

int openOptions = IBM.WMQ.MQC.MQOO_INPUT_AS_Q_DEF +
IBM.WMQ.MQC.MQOO_FAIL_IF_QUIESCING +
IBM.WMQ.MQC.MQOO_BROWSE;

MQQueue q = null;

q = m_qMgr.AccessQueue(m_queueName, openOptions +
QC.MQOO_INQUIRE);
mqMsgOpts.Options += IBM.WMQ.MQC.MQGMO_BROWSE_NEXT;

mqGetMsgOpts.WaitInterval = 15000;

q.Get(mqMsg, mqMsgOpts);
Back to top
View user's profile Send private message Send e-mail
oz1ccg
PostPosted: Sat Oct 11, 2003 6:02 pm    Post subject: Reply with quote

Yatiri

Joined: 10 Feb 2002
Posts: 628
Location: Denmark

Hmm ....

what are you meaning.... ????

Every time you start the program it starts from the beginning of the queue. Then it's up to you (using a loop) to browse thru the queue, right ?

Second, before every get you have to clear msgid and corrid to prevent WMQ to get using these options. If WMQ uses the mqgid/corrid of the first message the it will take message number o..

this should work... but keep
Quote:
mqMsgOpts.Options += IBM.WMQ.MQC.MQGMO_BROWSE_NEXT

outside your loop (I've seen it inside a loop and the developer couldn't see what was wong but tshe got some unexpected errors)

Just my $0.02
_________________
Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
jdmcfadden
PostPosted: Mon Oct 13, 2003 3:26 am    Post subject: Reply with quote

Newbie

Joined: 10 Oct 2003
Posts: 3
Location: Calhoun, GA

OK, I will try clearing the messageID before calling BROWSE_NEXT. I don't know what the corrid is; is it the same thing as the messageID?

The reason I'm not using a loop, per se, is that the app needs to browse the queue interactively; the user might want to go one message deep or 5 messages. I was hoping to be able to just let them click a "Next Message" button and keep bringing back stuff until they were done. I don't have a need to get bunches of messages at once. If I have to, I suppose I could do so and cache them, but it seems like a lot of potentially wasted transactions.

Thanks for the help.
Back to top
View user's profile Send private message Send e-mail
jdmcfadden
PostPosted: Mon Oct 13, 2003 6:30 am    Post subject: Reply with quote

Newbie

Joined: 10 Oct 2003
Posts: 3
Location: Calhoun, GA

OK, problem solved.

I was opening the queue and closing it again each time, and, as you quite properly said, opening the queue sets everything to the beginning. Once I stopped that and used a single browse connection, I could peek at all the messages I wanted.

The reason the loop idea confused me is that I hadn't needed a loop to move from one message to the next while peeking when I used the ActiveX control. And, as it turns out, I don't need one here: Some internal cursor in MQ's library keeps track of moving me forward, so that I can just call the BROWSE_NEXT until I run out of messages or get bored, whichever comes first.

Thanks for your help.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Browsing beyond first message in C#
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.