Skip to main content
Home
Works with
This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score94%
License
MIT
Downloads50/wk
Publisheda week ago (2.3.4)

PostgreSQL drivers for Fedify

class PostgresMessageQueue
implements MessageQueue

A message queue that uses PostgreSQL as the underlying storage.

Examples

Example 1

import { createFederation } from "@fedify/fedify";
import { PostgresKvStore, PostgresMessageQueue } from "@fedify/postgres";
import postgres from "postgres";

const sql = postgres("postgres://user:pass@localhost/db");

const federation = createFederation({
  kv: new PostgresKvStore(sql),
  queue: new PostgresMessageQueue(sql),
});

Constructors

new PostgresMessageQueue(
sql: Sql<{ }>,
)

Methods

Drops the message queue table if it exists.

enqueue(
message: any,
): Promise<void>
enqueueMany(
messages: readonly any[],
): Promise<void>

Initializes the message queue table if it does not already exist.

listen(
handler: (message: any) => void | Promise<void>,
): Promise<void>

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/postgres

Import symbol

import { PostgresMessageQueue } from "@fedify/postgres";
or

Import directly with a jsr specifier

import { PostgresMessageQueue } from "jsr:@fedify/postgres";