RedisQueue.send() method
Sends a given message to a given queue (by name).
Signature:
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 |
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. A delay of |
|
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-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.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.