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 remove expire message from queue in AIX Platform

Post new topic  Reply to topic
 How to remove expire message from queue in AIX Platform « View previous topic :: View next topic » 
Author Message
wilsonho3
PostPosted: Tue Mar 23, 2010 1:12 am    Post subject: How to remove expire message from queue in AIX Platform Reply with quote

Voyager

Joined: 20 Nov 2001
Posts: 98
Location: Hong Kong

Hi, all

I just take up a MQ site and find that some queues contain a lot of
expire message and the messages day back to two years ago. What is
the best and safe way to delete those expire messages. Any command
or tool will delete those expire message from queue. For the long run,
How can those expire message can be deleted automatically.

Ths

Wilson
Back to top
View user's profile Send private message Send e-mail
Mr Butcher
PostPosted: Tue Mar 23, 2010 1:17 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

an expired message (in terms of mqseries) will be removed automatically by the queuemanager if someone tries to read them or at a specific point in time (depending on plattform or mq version).

i assume, what you mean is just "old" messages, and you need a utility to purge them by age? i think this has been discussed here many times before, so please search the forums.
what you need is a little utility, browsing the messages, checking the date / time and then perform mqget with message under cursor. something like that.

however, your application design should not leave "old" messages lying around. this should be reviewed.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Mar 23, 2010 5:42 am    Post subject: Re: How to remove expire message from queue in AIX Platform Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

wilsonho3 wrote:
What is the best and safe way to delete those expire messages.

I agree with Mr Butcher: the application has not worked properly (or is not designed properly).

It is your application owner's responsibility to deal with messages, old or new.

You should contact the application owner BEFORE thinking further about deleting the messages. (Maybe you already did this). Even then, is it really the best idea for the administrator to step in and do this piece of work?

IMHO the application owner should develop the application program needed to remove their old messages.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 23, 2010 6:23 am    Post subject: Re: How to remove expire message from queue in AIX Platform Reply with quote

Grand High Poobah

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

mvic wrote:
IMHO the application owner should develop the application program needed to remove their old messages.




Also change the application to set expiry if that's what's needed.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
csmith28
PostPosted: Sat Apr 03, 2010 12:17 pm    Post subject: Reply with quote

Grand Master

Joined: 15 Jul 2003
Posts: 1196
Location: Arizona

Vitor is right but I dont' think that solves the immediate problem. If you want to clear these messages off you will have to make sure that the application doesn't have the queue in question open for Input or Output and issue the "clear ql(QUEUE.NAME)" command. In most cases this will require the application to be stopped.

An alternative to this is using the amqsget sample script but unless you can recompile it or you can find someone who will recompile it for you the amqsget script will only get messages that have 200 characters or less.

A few years ago I had a friend of mine who was much more familiar with C++ than I recompile the amqsget sample script to get messages up to 4 meg and we called it amqsgetbig. It turned out to be a very useful tool on several occasions.

The amqsget script will do a destructive get on the queue and you can redirect the output to a file but since the messages are expired they are probably useless anyway, YMMV.
_________________
Yes, I am an agent of Satan but my duties are largely ceremonial.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Apr 03, 2010 1:30 pm    Post subject: Reply with quote

Grand High Poobah

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

csmith28 wrote:
Vitor is right but I dont' think that solves the immediate problem. If you want to clear these messages off you will have to make sure that the application doesn't have the queue in question open for Input or Output and issue the "clear ql(QUEUE.NAME)" command. In most cases this will require the application to be stopped.


This does of course assume the queue is not a mixture of new & outdated messages. In most cases a valid assumption, but still an assumption.

csmith28 wrote:
An alternative to this is using the amqsget sample script but unless you can recompile it or you can find someone who will recompile it for you the amqsget script will only get messages that have 200 characters or less.

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
SAFraser
PostPosted: Sat Apr 03, 2010 2:37 pm    Post subject: Reply with quote

Shaman

Joined: 22 Oct 2003
Posts: 742
Location: Austin, Texas, USA

This is really clunky, but I have done it in special circumstances. I don't generally tell developers about it, for fear they'll ask me to do it routinely.

Stop incoming messages, so you have a stable message count.

Use amqsbcg to browse the queue to see the message count of old messages to be deleted. Example: 100 messages in queue. amqsbcg shows that the first 30 of them are older than a year. So your goal is to delete the first 30 messages while protecting the remaining 70.

Use 'qload' from Support Pac MO03. Move all 100 messages to a holding queue.

Use 'qload' with the '-r' option to copy messages 31-100 back to the original queue.

Like I said, it's not pretty, but if you are desperate, it works.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Apr 03, 2010 2:46 pm    Post subject: Reply with quote

Grand High Poobah

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

SAFraser wrote:
Like I said, it's not pretty, but if you are desperate, it works.


Ingenious, and functional.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Apr 04, 2010 12:58 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

seems easier to move the first 30 to a holding queue and then clear the holding queue?
Back to top
View user's profile Send private message
SAFraser
PostPosted: Mon Apr 05, 2010 11:13 am    Post subject: Reply with quote

Shaman

Joined: 22 Oct 2003
Posts: 742
Location: Austin, Texas, USA

And thus we see why I am a mere Knight while you, sir, are a Jedi Knight.
Back to top
View user's profile Send private message
exerk
PostPosted: Mon Apr 05, 2010 11:35 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

SAFraser wrote:
And thus we see why I am a mere Knight while you, sir, are a Jedi Knight.


Thankfully the powers that be have not applied the female equivalent of knight to the rankings
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Mon Apr 05, 2010 12:07 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Use MO71 and it will delete the messages older than x directly, no need for a hold queue at all.
_________________
Peter Potkay
Keep Calm and MQ On
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 » How to remove expire message from queue in AIX Platform
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.