|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Reading all the messages in MQ |
« View previous topic :: View next topic » |
Author |
Message
|
arun.buddha |
Posted: Thu May 22, 2008 3:24 am Post subject: Reading all the messages in MQ |
|
|
Newbie
Joined: 22 May 2008 Posts: 1
|
Hi all , I am a new bie to MQ. I am having a piece of code
while( myQueue->currentDepth() )
{
myQueue->get( imsg , gmo );
cout << "Recv : " << buf ;
}
to read the messages in MQ sequentially. But, my get() method gets
blocked while processing next request. ( Queue has lot of messages and
initial read is successful. )
My options set at get is,
gmo.setOptions(MQGMO_WAIT | MQGMO_ACCEPT_TRUNCATED_MSG );
gmo.setWaitInterval( MQWI_UNLIMITED );
Anybody can help me to know about this? |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 22, 2008 3:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Ok:
- use the search facility. All your points have been asked and answered before.
- read the documentation. The Application Programmer Guide covers all these points, if not explicitly then in general.
- Get yourself on a training course. A programming one might be good looking at your code.
- your get call is blocking because you don't reset the object id it's looking for. The documentation will explain why you need to do this.
- do not use currentDepth to find how many messages there are. It doesn't do what you think it does, and your loop will not run the right number of times.
- include the fail if quescing option if you're using unlimited wait, or you'll prevent the queue manager closing cleanly.
Aside from that it was fine.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu May 22, 2008 4:02 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'll also add that you might want to go look at some of the samples..... |
|
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
|
|
|
|