diff --git a/src/database/index.ts b/src/database/index.ts index 1d7af3f..cf24064 100644 --- a/src/database/index.ts +++ b/src/database/index.ts @@ -1,6 +1,7 @@ import Postgres from "@@npm/postgres" import { getLogger } from "@logtape/logtape" -import { exportJwk, generateCryptoKeyPair, KvStore } from "@fedify/fedify" +import { exportJwk, generateCryptoKeyPair, KvStore, MessageQueue } from "@fedify/fedify" +import { PostgresMessageQueue } from "@fedify/postgres" import { PostgresKvStore } from "@fedify/postgres/kv" @@ -50,6 +51,11 @@ export class Database { return new PostgresKvStore(this.sql, {}) } + useAsMessageQueue(): MessageQueue { + l.info`Creating Postgres message queue...` + return new PostgresMessageQueue(this.sql, {}) + } + async #doQueryFile(path: string, variables: Postgres.ParameterOrJSON[] = []): Promise> { try { l.debug`Running query at ${path}...` diff --git a/src/dv/index.ts b/src/dv/index.ts index 082f040..1b6da72 100644 --- a/src/dv/index.ts +++ b/src/dv/index.ts @@ -23,6 +23,7 @@ export class DotinoVeloce { this.federation = createFederation({ kv: db.useAsKvStore(), + queue: db.useAsMessageQueue(), }) this.federation