0 Replies Latest reply on Nov 19, 2009 2:32 PM by Frank Sherwood

    Clearing messages from a queue after a client dies and resta

    Frank Sherwood Newbie

      Using core API, I have constructed a set of clients that communicate via a thinly wrapped embedded server. Occasionally, the clients will throw an uncaught exception and die unexpectedly. The queue each client uses is a temporary queue with a TTL of 1 minute.

      If I wait until the TTL expires and the client is brought up, the old queue is gone and everything is fine and it proceeds as normal. However, if the reconnection attempt occurs before the TTL has expired, the queue has some accumulated messages from one of the nodes that pings the others (registry node) to keep a map of live clients.

      On attempting to re-create its queue by the same name, the client gets an exception (QUEUE_EXISTS), which is caught. It then queries the session for how many messages are in the queue, and it tries to consume them with a new consumer to empty the queue before it proceeds. It gets the messages, but then times out waiting for a reply from the registry node, using the original queue.

      If I retry the connection quickly again, the original messages have not been consumed. What should I do to clear that queue and be able to resume using it?

      Thanks for your past help.

      Frank Sherwood