Skip to content

@queuert/nats

const notifyAdapter = await createNatsNotifyAdapter({
nc: NatsConnection, // NATS connection from the 'nats' package
kv?: KV, // Optional JetStream KV for thundering herd optimization (see below)
subjectPrefix?: string, // Subject prefix (default: "queuert")
});

Returns Promise<NotifyAdapter>.

No provider type is exported — NATS accepts the NatsConnection directly. There is only one NATS client in the Node.js ecosystem, so no adapter layer is needed.

When kv is provided, the adapter uses a JetStream KV store to deduplicate notifications so that only one worker wakes up per scheduled job instead of all workers simultaneously (thundering herd prevention).