Skip to main content
Deno.Kv.prototype.listenQueue - Deno documentation
method Deno.Kv.prototype.listenQueue
Kv.prototype.listenQueue(handler: (value: any) => Promise<void> | void): Promise<void>

Listen for queue values to be delivered from the database queue, which were enqueued with Deno.Kv.enqueue. The provided handler callback is invoked on every dequeued value. A failed callback invocation is automatically retried multiple times until it succeeds or until the maximum number of retries is reached.

const db = await Deno.openKv();
db.listenQueue(async (msg: unknown) => {
  await db.set(["foo"], msg);
});

Parameters

handler: (value: any) => Promise<void> | void

Return Type

Promise<void>