|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Browsing beyond first message in C# |
« View previous topic :: View next topic » |
Author |
Message
|
jdmcfadden |
Posted: Fri Oct 10, 2003 3:10 pm Post subject: Browsing beyond first message in C# |
|
|
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 |
|
 |
oz1ccg |
Posted: Sat Oct 11, 2003 6:02 pm Post subject: |
|
|
 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 |
|
 |
jdmcfadden |
Posted: Mon Oct 13, 2003 3:26 am Post subject: |
|
|
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 |
|
 |
jdmcfadden |
Posted: Mon Oct 13, 2003 6:30 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
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
|
|
|
|