How to delete Message from a queue using specific input (ex:Message ID)

Hello,

I have a requirement which is to delete a message from UM queue by Message ID using webMethods IS (9.9).
Normally we can purge the events from the queue, but I’m looking to delete a specific message using Message ID or any unique Id of the message by writing a service (Java or Flow).
Scenario: If there are 10 messages in a queue and the connection got abruptly stopped due to xyz reason, and may take a while to bring it up. In the meanwhile we have to manually process the Messages (1,2,3,4) and then later delete those processed messages (1,2,3,4) when the connection is restored.
How can we achieve this?
Appreciate any suggestion.

Thanks for your advice!

Hi Abhi,

There is an client API where you can specify selector to purge the events which matches that. Ideally this will traverse from first event to last event that are there on the queue.

nQueue myQueue = mySession.findQueue(nca);
myQueue.purge(selector);

Check if this API suites your requirement.

Regards,
Vijaya

Hi Vijaya,

Many thanks for the quick response.

I’ve understood the procedure of what you have mentioned above but actually I’m quite not familiar with the Client API. Could you please elaborate a bit on this if that’s fine for you?

Thanks in advance.

Best Regards,
Abhiram.

Proceed with extreme caution. I may be overly conservative in this regard but my policy over the years has been to treat the queues (Broker or UM) as a black box. Sure, one can browse them to see the events and their data but IMO one should resist, at almost all costs, to edit that queue in any way. At some point, the “helpful” utility to remove that one “bad” message will go horribly wrong and it will shoot you in the foot (or worse). :slight_smile: Purging a queue should also be a “virtually never” activity.

Removing messages from a queue should not be a standard recovery mechanism. Turn your attention instead to figuring out how to avoid “connection got abruptly stopped due to xyz reason.” That’s the issue to solve rather than how to remove messages from a queue.

As always, just one POV to consider. :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.