IMessageQueue.clear() method

Deletes this queue's pending messages — both the main list and the delayed set for <prefix>:<name>.

Signature:

clear(): Promise<IMessageQueue>;

Returns:

Promise<IMessageQueue>

this queue instance

Remarks

Other queues in the namespace, the watcher lock, and messages currently checked out to a worker under IMQOptions.safeDelivery are all untouched — such a message returns to the queue if its worker dies or overruns IMQOptions.safeDeliveryTtl, so this does not guarantee the queue stays empty. A message is checked out for as long as its handler runs, so that window is as long as your slowest handler.

It never rejects: with no writer connection it silently does nothing, and host failures are logged rather than raised, so success cannot be inferred from a resolved promise.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.