# RedisQueue.send() method · @imqueue/core

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

Sends a given message to a given queue (by name).

**Signature:**

```typescript
send(toQueue: string, message: JsonObject, delay?: number, errorHandler?: (err: Error) => void): Promise<string>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| toQueue | string | name of the destination queue |
| message | [JsonObject](https://imqueue.org/api/core/latest/core.jsonobject/) | message payload; must be a JSON object |
| delay | number | _(Optional)_ if specified, the message becomes available in the target queue only after this many milliseconds. This is a minimum, not a schedule — the message is released by the watcher, so availability may lag by up to [IMQOptions.watcherCheckDelay](https://imqueue.org/api/core/latest/core.imqoptions.watchercheckdelay/). A delay of `0` or `undefined` sends immediately. |
| errorHandler | (err: Error) => void | _(Optional)_ invoked when the write to Redis fails; this is the only way to observe such a failure, since the returned promise does not reject for it |


**Returns:**

Promise<string>

the identifier assigned to the message. It is generated locally before the write is issued, so it is available even if the write later fails.

## Exceptions

TypeError when the queue is in [IMQMode.WORKER](https://imqueue.org/api/core/latest/core.imqmode/)-only mode, or when a writer connection cannot be established

## Remarks

The returned promise resolves as soon as the write has been dispatched — the Redis reply is not awaited — so a resolved promise is not evidence that the message was enqueued.

Starts the queue implicitly when it has not been started yet, which has process-wide side effects: it may install signal handlers and make this instance the watcher owner.

