View previous topic :: View next topic
|
Author |
Message |
veeruspi
New User
Joined: 29 Dec 2005 Posts: 16 Location: mysore
|
|
|
|
Hi All,
I have a requirement to delete the messages from reply queue. I need to check if the message put time is 15 mins prior to current time, I need to delete those messages. For ex. if there are 5 messages out of which 3 have arrived after 11 AM and 2 messages before 11 AM. If current time is 11.15AM, then I have to dlete the 2 messages which have arrived before 11AM. How can I do this?
Thanks
Veeru |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
This is a strange requirement.
Typically, the application which MQPUT(1)s the reply message would specify an expiry interval in the MQMD of the reply message. Once this expiry interval has elapsed, MQ will flag the message as unavailable and MQ's housekeeping will take care of deleting it.
Otherwise, your application processing the reply queue needs to MQGET every message (specify MQMI-NONE and MQCI_NONE) and check the MQMD.PutTime against the current time. Doing this, you then probably need some mechanism to correlate the replies that you will not simply delete with the corresponding request messages.
I'd rethink the application design to use MQ facilities.
Garry. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
See the manual
Pay particular attention to the sections labeled
"Removing a message that you have browsed" (note: a "normal" Browse is NON-destructive) and
"Browsing messages when the message length is unknown" (note: why read the entire message into a buffer when you aren't really going to look at its contents?)
under the section labeled
"Browsing messages on a queue"
You may have to follow the links to find the proper MQOPEN options, etc. |
|
Back to top |
|
|
|