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 » Script Purging Messages from a Queue Based on MQMD.PutDateTi

Post new topic  Reply to topic
 Script Purging Messages from a Queue Based on MQMD.PutDateTi « View previous topic :: View next topic » 
Author Message
EricCox
PostPosted: Tue Feb 10, 2015 10:35 am    Post subject: Script Purging Messages from a Queue Based on MQMD.PutDateTi Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

To all,

I have a requirement to script a nightly autosys job to loop through all messages in a queue and purge each message that is more than 24hrs old.

What are the ways I can do this?

What is the easiest way to do this?

Thanks,
EMC
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 10, 2015 10:38 am    Post subject: Re: Script Purging Messages from a Queue Based on MQMD.PutDa Reply with quote

Grand High Poobah

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

EricCox wrote:
I have a requirement to script a nightly autosys job to loop through all messages in a queue and purge each message that is more than 24hrs old.

What are the ways I can do this?


Loop through all the messages in the queue and see if the put date & time is more than 24 hours in the past, using the programming language of your choice.

EricCox wrote:
What is the easiest way to do this?


Have the application putting the message set the expiry to 24 hours and eliminate the need to remove them with a separate process.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Feb 10, 2015 10:39 am    Post subject: Reply with quote

Poobah

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

You could write a program that browses each message, looks at the create date/time in the MQMD; and for each message older than 24hrs, destructively consume those messages.
_________________
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
PaulClarke
PostPosted: Tue Feb 10, 2015 10:55 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

My SupportPac MO03 (QLOAD) can do this. You can select messages older or younger than a certain time and either remove them or move them to a different queue.

Cheers,
Paul
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
RogerLacroix
PostPosted: Tue Feb 10, 2015 11:44 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

MQ Batch Toolkit can also do this (see "Clearing a Queue by Time" in the manual).

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
EricCox
PostPosted: Tue Feb 10, 2015 12:54 pm    Post subject: QLOAD Reply with quote

Master

Joined: 08 Apr 2011
Posts: 292

For QLOAD I see I can use it to move a message to a file or another queue. I don't see an option for deleting or purging a message.

Do you see the switch to perform the delete?

Thanks
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Tue Feb 10, 2015 1:06 pm    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

If I remember rightly there isn't really the notion of 'delete'. There is merely the notion of remove from queue and then you decide what you want to do with it.

So, suppose we want to remove all the message older than 1 hour from Q1 we could issue the following command

qload -IQ1 -f stdout -T1:0

Of course it is safer to put them to a queue so you can double check what you are deleting

qload -IQ1 -o OLDMESSAGEQUEUE -T1:0

However if you really don't want anything out then just put them to a NULL MQ Queue

qload -IQ1 -o NULLQ -T1:0

Where NULLQ is just a topic alias to an unused topic.

I do remember being asked to support the syntax -f NULL at one time but I don't believe I ever got around to is and, sadly, IBM won't allow me to continue to enhance QLOAD. Otherwise I would have put quite a few additions into it by now.

Cheers,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Tue Feb 10, 2015 1:32 pm    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

PaulClarke wrote:
I do remember being asked to support the syntax -f NULL at one time


Usually, there is a platform trick like "-f NUL" for Windows or "-f /dev/null" for Unix to discard data output that you don't care about. I would of thought the users would have just done that, but maybe there was something else they were getting at.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Tue Feb 10, 2015 1:35 pm    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

Yes that should work too although, as you say, it is platform (and environment) specific.

Cheers,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed Feb 11, 2015 2:03 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

PaulClarke wrote:
IBM won't allow me to continue to enhance QLOAD.


You mean https://github.com/ibm-messaging/mq-q-qload
?

I think you can enhance it again...
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Wed Feb 11, 2015 2:10 pm    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

Ha! Ok, they've made it public domain now have they?

Well, I guess anyone can enhance it now and I no longer have to field any questions about them.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed Feb 11, 2015 2:13 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

PaulClarke wrote:
I no longer have to field any questions about them.



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 » Script Purging Messages from a Queue Based on MQMD.PutDateTi
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.