Author |
Message
|
PankajS |
Posted: Wed Feb 09, 2005 3:33 am Post subject: How can I delete messages from queue at runtime |
|
|
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 |
|
 |
KeeferG |
Posted: Wed Feb 09, 2005 4:01 am Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Wed Feb 09, 2005 5:05 am Post subject: |
|
|
 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 |
|
 |
KeeferG |
Posted: Wed Feb 09, 2005 5:14 am Post subject: |
|
|
 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 |
|
 |
cnu |
Posted: Sun Feb 13, 2005 10:33 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Feb 13, 2005 1:23 pm Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Mon Feb 14, 2005 5:23 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
|