Setup Postgres-based message queue
This commit is contained in:
parent
b29211c387
commit
0df82ac931
2 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import Postgres from "@@npm/postgres"
|
import Postgres from "@@npm/postgres"
|
||||||
import { getLogger } from "@logtape/logtape"
|
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"
|
import { PostgresKvStore } from "@fedify/postgres/kv"
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ export class Database {
|
||||||
return new PostgresKvStore(this.sql, {})
|
return new PostgresKvStore(this.sql, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useAsMessageQueue(): MessageQueue {
|
||||||
|
l.info`Creating Postgres message queue...`
|
||||||
|
return new PostgresMessageQueue(this.sql, {})
|
||||||
|
}
|
||||||
|
|
||||||
async #doQueryFile<T>(path: string, variables: Postgres.ParameterOrJSON<any>[] = []): Promise<Postgres.RowList<T[]>> {
|
async #doQueryFile<T>(path: string, variables: Postgres.ParameterOrJSON<any>[] = []): Promise<Postgres.RowList<T[]>> {
|
||||||
try {
|
try {
|
||||||
l.debug`Running query at ${path}...`
|
l.debug`Running query at ${path}...`
|
||||||
|
|
|
@ -23,6 +23,7 @@ export class DotinoVeloce {
|
||||||
|
|
||||||
this.federation = createFederation<ContextData>({
|
this.federation = createFederation<ContextData>({
|
||||||
kv: db.useAsKvStore(),
|
kv: db.useAsKvStore(),
|
||||||
|
queue: db.useAsMessageQueue(),
|
||||||
})
|
})
|
||||||
|
|
||||||
this.federation
|
this.federation
|
||||||
|
|
Loading…
Reference in a new issue