|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Delete Message while waiting in a MQCB |
« View previous topic :: View next topic » |
Author |
Message
|
yasaboy |
Posted: Tue Oct 28, 2014 11:29 pm Post subject: Delete Message while waiting in a MQCB |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
Hi,
I am waiting in a MQOP_START_WAIT status for a particular thread for a particulate Queue.
I am using MQGMO_BROWSE_NEXT option to get the messages from the queue. So messages are not deleted from it and queue grows.
Suppose at a particular moment I want to clear this Queue. Is there any method that I can use to delete the messages from the queue while waiting in a CallBack in the same thread ?
callback function is,
Code: |
gmo.Options = MQGMO_BROWSE_NEXT;
//cout << " Connected to Input queue -> " << pzQueueName << endl;
MQCB(m_Hcon,
MQOP_REGISTER,
&cbd,
pMQSQueue->m_Hobj ,
&md,
&gmo,
&pMQSQueue->m_OpenCode,
&pMQSQueue->m_Reason);
MQCTL(m_Hcon, MQOP_START_WAIT, &ctlo, &CompCode, &m_Reason); |
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 29, 2014 4:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm not aware of any particular reason you wouldn't be able to issue a destructive GET on the same message.
That doesn't mean there isn't a reason. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Oct 29, 2014 5:44 am Post subject: Re: Delete Message while waiting in a MQCB |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
yasaboy wrote: |
Is there any method that I can use to delete the messages from the queue while waiting in a CallBack in the same thread ? |
Odd mix of terminology - waiting in a CallBack.
The calling application may continue to do whatever is wants or needs to do.
Unlike the synchronous MQGET with Wait, the called routine is not in a processor until a message arrives on the named queue, and it is called.
While your called routine is in processor, it may destructively consume messages, rather than browse. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
yasaboy |
Posted: Wed Oct 29, 2014 8:13 pm Post subject: Re: Delete Message while waiting in a MQCB |
|
|
Voyager
Joined: 23 Jun 2014 Posts: 90
|
Quote: |
While your called routine is in processor, it may destructively consume messages, rather than browse |
Not exactly isn't it ? If we give the gmo options as
gmo.Options = MQGMO_BROWSE_NEXT;
it will only browse messages not delete them from the Queue isn't it ?
Quote: |
Unlike the synchronous MQGET with Wait, the called routine is not in a processor until a message arrives on the named queue, and it is called. |
Exactly this is the point I was taking I want know whether my called routine can do something else while it's not in a processor ?
In our configuration MQCB gmo must be BROWSE not GET. Get should be called after a while after the browse messages are processed by the system and transmitted to the clients. |
|
Back to top |
|
 |
PaulClarke |
Posted: Wed Oct 29, 2014 11:33 pm Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
First of all, just to be clear, you should never just 'wait' in a callback function. MQ calls you when there is potentially something to do but you shouldn't just hang on to the thread othewise sooner or later bad things will happen.
What you do though is use the GetWaitInterval to get periodically call even when there is no messages to process. Is this what you want ? MQ will call you after the timeout and you can, of course, do whatever you liike in the callback including clearing the queue by getting off all the messages if that is what you wish.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Oct 30, 2014 6:00 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
|
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
|
|
|
|