# IMessageQueue.clear() method · @imqueue/core

Source: https://imqueue.org/api/core/latest/core.imessagequeue.clear/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/core 3.3.2 — generated reference, not hand-written

Deletes this queue's pending messages — both the main list and the delayed set for `<prefix>:<name>`.

**Signature:**

```typescript
clear(): Promise<IMessageQueue>;
```
**Returns:**

Promise<[IMessageQueue](https://imqueue.org/api/core/latest/core.imessagequeue/)>

this queue instance

## Remarks

Other queues in the namespace, the watcher lock, and messages currently leased to a worker under [IMQOptions.safeDelivery](https://imqueue.org/api/core/latest/core.imqoptions.safedelivery/) are all untouched — a leased message can be re-queued by the watcher once its lease expires, so this does not guarantee the queue stays empty.

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.

