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 » How to delete messages from a queue based on date

Post new topic  Reply to topic Goto page 1, 2  Next
 How to delete messages from a queue based on date « View previous topic :: View next topic » 
Author Message
akidase
PostPosted: Mon Mar 26, 2012 4:18 am    Post subject: How to delete messages from a queue based on date Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

Hi Experts,

Is it possible that we will be able to delete messages from a queue, based on date ? I am planning to have a cron job for the same.

Similar to the one below. However this clear all messages in a queue.
http://www-01.ibm.com/support/docview.wss?uid=swg21249309
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 26, 2012 4:37 am    Post subject: Re: How to delete messages from a queue based on date Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

akidase wrote:
Is it possible that we will be able to delete messages from a queue, based on date ? I am planning to have a cron job for the same.


It's considered best practice, if a message has a given lifespan, to have that lifespan set by the sender as the expiry. Using this, the queue manager will clean up without intervention.

There isn't a command to remove messages by date. Some support pacs have this facility, and it's a trivial task to adapt one of the samples to do this.

But I still recommend expiry. No additional components and much greater flexibility on lifespan.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
akidase
PostPosted: Mon Mar 26, 2012 5:32 am    Post subject: Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

Quote:
I still recommend expiry.

That was my first option too.. But our requirement is to clear messages based on date. Since we are clearing backed out messages, we want to provide some time for application teams to see thro' them , for a stipulated time.

Quote:
Some support pacs have this facility, and it's a trivial task to adapt one of the samples to do this.


Could you please provide me with any link, which serves as an example to do this?
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 26, 2012 5:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

akidase wrote:
Could you please provide me with any link, which serves as an example to do this?


amqsget, q, qload, etc, etc, etc.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Mon Mar 26, 2012 6:23 am    Post subject: Reply with quote

Poobah

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

A samples directory is installed when you install WMQ. Amsget sample application should provide an app developer with skeleton source code.

The sample code needs to be modified to look at the date/time fields of the MQMD, to then decide whether to destructively consume the message (old/expired), or leave it in the queue.
_________________
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
md7
PostPosted: Mon Mar 26, 2012 3:17 pm    Post subject: Reply with quote

Apprentice

Joined: 29 Feb 2012
Posts: 49
Location: Sydney.AU

I did this before with QLoad (MO03). Moved all messages older than a certain date into a TEMP queue, double checked the dates it then emptied it
Back to top
View user's profile Send private message
akidase
PostPosted: Mon Mar 26, 2012 10:45 pm    Post subject: Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

Quote:
I did this before with QLoad (MO03).

That worked for me as well. Thanks!

Quote:
A samples directory is installed when you install WMQ.

I have installed MQ7.0 in Windows 7 System. I am not sure of the directory where it is present.
I remember previous versions having it at C:\Program Files (x86)\IBM\WebSphere MQ\tools.But this one doesn't ve.

Quote:
amqsget, q, qload, etc, etc, etc.

Thank you Vitor.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Mar 26, 2012 11:41 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

MA01 (queue program) can also do this kind of thing, arguably more suitable than MO03 (although both are by the same author).
Back to top
View user's profile Send private message
akidase
PostPosted: Tue Mar 27, 2012 3:19 am    Post subject: Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

Vitor and all,

I need to implement 'em, for backed out messages.
If I set the expiry to incoming message, can I be assured that same headers will be present for the backed out message?
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Mar 27, 2012 4:25 am    Post subject: Reply with quote

Poobah

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

akidase wrote:
Vitor and all,

I need to implement 'em, for backed out messages.
If I set the expiry to incoming message, can I be assured that same headers will be present for the backed out message?

What is 'em?

Messages are backed out by applications; and it is applications that manipulate MQMD and other headers.
_________________
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
mqjeff
PostPosted: Tue Mar 27, 2012 4:52 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Several IBM products will automatically back out messages for you, and these will make sure that the expiry is still set on the message. For example, MQ's JMS provider and Message Broker.

The base MQ API does not provide a function to automatically back out messages. It merely provides functions to identify when a message should be backed out and where to put it. It is then up to each application to decide how it handles this information.

So you won't know if the message headers and expiry will be honored unless you know the application that is doing the backout.

As always, it is a significantly better idea to TRY this BEFORE you ASK. It wastes less of your time, and you can rely on the answer much more.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 27, 2012 8:33 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

akidase wrote:
... That was my first option too.. But our requirement is to clear messages based on date. Since we are clearing backed out messages, we want to provide some time for application teams to see thro' them , for a stipulated time.

If it is not the responsibility of the application's admins to review the errors and fix the messages and deal with them, why would you want to send them in the first place? Just build an application that does not work and delete the messages every day???
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
yeyeman9
PostPosted: Mon Aug 20, 2012 12:48 pm    Post subject: Reply with quote

Newbie

Joined: 20 Aug 2012
Posts: 2

Hi,

I am curious...is there anyway to do this without the need of installing a support package?

For example, what we wish to accomplish is remove a message after X amount of time.

Any code line we can apply in the Manager to get this done?

Expiry seems like a good idea except we don't want to have to get it done for each message, instead we would like to have a "General" place where this order of "after X amount of time, remove from queue" is done. Which is why we would like to do it in the manager.

Any ideas?

Appreciate the time and help!
Back to top
View user's profile Send private message
bruce2359
PostPosted: Mon Aug 20, 2012 1:05 pm    Post subject: Reply with quote

Poobah

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

Have you read the replies to this post?

There is no such queue-manager setting.
_________________
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
yeyeman9
PostPosted: Mon Aug 20, 2012 1:15 pm    Post subject: Reply with quote

Newbie

Joined: 20 Aug 2012
Posts: 2

bruce2359 wrote:
Have you read the replies to this post?

There is no such queue-manager setting.


Well I saw that there is not one command that does that. But I am guessing then that there is no possible combination to get this done then? WE can only do it with a Support pack?

Thanks for the quick answer by the way.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General IBM MQ Support » How to delete messages from a queue based on date
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.