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 » IBM MQ Java / JMS » How can I delete messages from queue at runtime

Post new topic  Reply to topic
 How can I delete messages from queue at runtime « View previous topic :: View next topic » 
Author Message
PankajS
PostPosted: Wed Feb 09, 2005 3:33 am    Post subject: How can I delete messages from queue at runtime Reply with quote

Voyager

Joined: 27 Dec 2004
Posts: 82

Hi Friends,

I need to develop the code in java which will
a) browse the queue b) Sort out the messages that have exceeded some time limit (say 5 seconds)and still are in the queue c) Then delete the message from the queue so that the queue is free for more messages to come. d) I need to invoke this program after some specified time interval

My queries are ..

1) How can I count the time of the message in the Queue(time for which
the message is there in the queue)
2) Do we have any method to get the time of the message in Queue.
3) wil expiry of message will help me in any way


Waiting for reply !!!!
Back to top
View user's profile Send private message
KeeferG
PostPosted: Wed Feb 09, 2005 4:01 am    Post subject: Reply with quote

Master

Joined: 15 Oct 2004
Posts: 215
Location: Basingstoke, UK

You should use message expiry when pyutting the messages on the queue. Then when you browse the queue any messages that have expired will be removed. You can also set up report options to inform you of expired messages if you wish though I'd leave that alone until you have this part working.
_________________
Keith Guttridge
-----------------
Using MQ since 1995
Back to top
View user's profile Send private message Visit poster's website
zpat
PostPosted: Wed Feb 09, 2005 5:05 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

But if you can't change the MQMD expiry value when creating the messages - you could compare the MQMD PUTTIME of the queued messages to the current system time, for each message and delete if older than your limit.

Never hard-code time or expiry values in programs as someone is bound to want to change them later. Remember though that expired messages don't get purged automatically - something has to attempt to browse or get them (which can be a simple program run at intervals).

You might trigger such a program on a queue depth being reached perhaps.
Back to top
View user's profile Send private message
KeeferG
PostPosted: Wed Feb 09, 2005 5:14 am    Post subject: Reply with quote

Master

Joined: 15 Oct 2004
Posts: 215
Location: Basingstoke, UK

Agreed, all values should be, where possible, passed in via paramters or configuration files as this gives the greatest portability/flexibility
_________________
Keith Guttridge
-----------------
Using MQ since 1995
Back to top
View user's profile Send private message Visit poster's website
cnu
PostPosted: Sun Feb 13, 2005 10:33 am    Post subject: Reply with quote

Apprentice

Joined: 15 May 2004
Posts: 34

What method we can use to delete the messages from the queue?

Thanks in advance
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Feb 13, 2005 1:23 pm    Post subject: Reply with quote

Grand High Poobah

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

A simple get will do a destructive read and remove expired messages.
A browse will do a non destructive read but will remove expired messages.

Enjoy
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Feb 14, 2005 5:23 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

And if you're browsing first, and then want to delete...

You should look at the sample code available

http://www.developer.ibm.com/tech/sampmq.html
_________________
I am *not* the model of the modern major general.
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 » IBM MQ Java / JMS » How can I delete messages from queue at runtime
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.