@@ -293,6 +293,115 @@ const federation = createFederation({
293293[ `AmqpMessageQueue` ] : https://jsr.io/@fedify/amqp/doc/mq/~/AmqpMessageQueue
294294[ RabbitMQ ] : https://www.rabbitmq.com/
295295
296+ ### ` SqliteMessageQueue `
297+
298+ * This API is available since Fedify 2.0.0.*
299+
300+ To use [ ` SqliteMessageQueue ` ] , you need to install the * @fedify/sqlite * package
301+ first:
302+
303+ ::: code-group
304+
305+ ~~~~ bash [Deno]
306+ deno add jsr:@fedify/sqlite
307+ ~~~~
308+
309+ ~~~~ bash [npm]
310+ npm add @fedify/sqlite
311+ ~~~~
312+
313+ ~~~~ bash [pnpm]
314+ pnpm add @fedify/sqlite
315+ ~~~~
316+
317+ ~~~~ bash [Yarn]
318+ yarn add @fedify/sqlite
319+ ~~~~
320+
321+ ~~~~ bash [Bun]
322+ bun add @fedify/sqlite
323+ ~~~~
324+
325+ :::
326+
327+ [ ` SqliteMessageQueue ` ] is a message queue implementation that uses SQLite as
328+ the backend. It uses polling to check for new messages and is designed for
329+ single-node deployments. It's suitable for development, testing, and
330+ small-scale production use where simplicity is preferred over high throughput.
331+ It uses native sqlite modules, [ ` node:sqlite ` ] for Node.js and Deno,
332+ [ ` bun:sqlite ` ] for Bun.
333+
334+ Best for
335+ : Development and testing.
336+
337+ Pros
338+ : Simple, persistent with minimal configuration.
339+
340+ Cons
341+ : Limited scalability, not suitable for high-traffic production.
342+
343+ > [ !NOTE]
344+ > ` SqliteMessageQueue ` uses ` DELETE ... RETURNING ` to atomically fetch and
345+ > delete the oldest message that is ready to be processed. This requires
346+ > SQLite 3.35.0 or later.
347+
348+ ::: code-group
349+
350+ ~~~~ typescript twoslash [Deno]
351+ import type { KvStore } from " @fedify/fedify" ;
352+ // ---cut-before---
353+ import { DatabaseSync } from " node:sqlite" ;
354+ import { createFederation } from " @fedify/fedify" ;
355+ import { SqliteMessageQueue } from " @fedify/sqlite" ;
356+
357+ const db = new DatabaseSync (" :memory:" );
358+ const federation = createFederation <void >({
359+ // ...
360+ // ---cut-start---
361+ kv: null as unknown as KvStore ,
362+ // ---cut-end---
363+ queue: new SqliteMessageQueue (db ), // [!code highlight]
364+ });
365+ ~~~~
366+
367+ ~~~~ typescript twoslash [Node.js]
368+ import type { KvStore } from " @fedify/fedify" ;
369+ // ---cut-before---
370+ import { DatabaseSync } from " node:sqlite" ;
371+ import { createFederation } from " @fedify/fedify" ;
372+ import { SqliteMessageQueue } from " @fedify/sqlite" ;
373+
374+ const db = new DatabaseSync (" :memory:" );
375+ const federation = createFederation <void >({
376+ // ...
377+ // ---cut-start---
378+ kv: null as unknown as KvStore ,
379+ // ---cut-end---
380+ queue: new SqliteMessageQueue (db ), // [!code highlight]
381+ });
382+ ~~~~
383+
384+ ~~~~ typescript [Bun]
385+ import type { KvStore } from " @fedify/fedify" ;
386+ // ---cut-before---
387+ import { Database } from " bun:sqlite" ;
388+ import { createFederation } from " @fedify/fedify" ;
389+ import { SqliteMessageQueue } from " @fedify/sqlite" ;
390+
391+ const db = new Database (" :memory:" );
392+ const federation = createFederation <void >({
393+ // ...
394+ // ---cut-start---
395+ kv: null as unknown as KvStore ,
396+ // ---cut-end---
397+ queue: new SqliteMessageQueue (db ), // [!code highlight]
398+ });
399+ ~~~~
400+
401+ :::
402+
403+ [ `SqliteMessageQueue` ] : https://jsr.io/@fedify/sqlite/doc/mq/~/SqliteMessageQueue
404+
296405### ` WorkersMessageQueue ` (Cloudflare Workers only)
297406
298407* This API is available since Fedify 1.6.0.*
@@ -659,6 +768,9 @@ The following implementations do not yet support native retry:
659768[ ` AmqpMessageQueue ` ]
660769: Native retry support planned for future release.
661770
771+ [ ` SqliteMessageQueue ` ]
772+ : No native retry support (` ~MessageQueue.nativeRetrial ` is ` false ` ).
773+
662774` ParallelMessageQueue ` inherits the ` ~MessageQueue.nativeRetrial ` value from
663775the wrapped queue.
664776
0 commit comments