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 » General IBM MQ Support » Delete Message while waiting in a MQCB

Post new topic  Reply to topic
 Delete Message while waiting in a MQCB « View previous topic :: View next topic » 
Author Message
yasaboy
PostPosted: Tue Oct 28, 2014 11:29 pm    Post subject: Delete Message while waiting in a MQCB Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Wed Oct 29, 2014 4:49 am    Post subject: Reply with quote

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
View user's profile Send private message
bruce2359
PostPosted: Wed Oct 29, 2014 5:44 am    Post subject: Re: Delete Message while waiting in a MQCB Reply with quote

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
View user's profile Send private message
yasaboy
PostPosted: Wed Oct 29, 2014 8:13 pm    Post subject: Re: Delete Message while waiting in a MQCB Reply with quote

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
View user's profile Send private message
PaulClarke
PostPosted: Wed Oct 29, 2014 11:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
bruce2359
PostPosted: Thu Oct 30, 2014 6:00 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9469
Location: US: west coast, almost. Otherwise, enroute.

You might want to review the callback function here: http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.wmq_v7/wmq/7.0/MQI/iea_350_wmqv7_API_5_CallBack/player.html

With callback, when a message arrives in the named queue, your routine is passed control (loaded into a processor and given control), and the message is already in the buffer. With callback, there is no need to do an MQGET call.

One of the advantages of callback is that the calling app can continue to do whatever processing is chooses to do.
_________________
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
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 » General IBM MQ Support » Delete Message while waiting in a MQCB
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.