Custom providers
Bring your own broker, cloud service, or test double behind the same QueueProvider contract.
Use defineQueueProvider from the public custom entrypoint. A custom provider implements the public QueueProvider contract, advertises accurate capabilities, and can preserve arbitrary native option and response types. It must not import QueueKit internals.
ts
import { createQueueKit, defineQueueProvider } from '@mohamedhabibwork/queuekit/custom';
import type { QueueProvider } from '@mohamedhabibwork/queuekit';
// 1. Define the provider once, next to its SDK.
const httpWebhook = defineQueueProvider('http-webhook', {
capabilities: { kind: 'queue', publish: true, consume: true, ack: true },
create(config: { endpoint: string }) {
return new HttpWebhookProvider(config.endpoint) as QueueProvider<'http-webhook'>;
},
});
// 2. Build a typed factory from a map of definitions.
const kit = createQueueKit({ providers: { 'http-webhook': httpWebhook } });
// 3. Create queues with the same config-shape ergonomics as the built-ins.
const webhooks = await kit.create({ type: 'http-webhook', endpoint: 'https://example.com/hooks' });The in-memory provider at @mohamedhabibwork/queuekit/testing is a full reference implementation and is useful for contract-oriented application tests — see the testing examples.