Search by

freyr / message-broker-storage-postgresql

Freyr

PostgreSQL storage adapter for freyr/message-broker: outbox, deduplication and dead-letter stores, schema installer and retention

Package info

github.com/freyr/message-broker-storage-postgresql

pkg:composer/freyr/message-broker-storage-postgresql

Statistics

Installs: 2

Dependents: 3

Suggesters: 1

Stars: 0

v0.1.0 2026-11-23 21:31 UTC

This package is auto-updated.

Last update: 2026-11-23 21:48:54 UTC


README

This package is the PostgreSQL storage adapter of the Freyr Message Broker library, namespace Freyr\MessageBroker\Storage\PostgreSql\.

The repository freyr/message-broker-storage-postgresql is a read-only copy of the folder storage/postgresql/ of freyr/message-broker. Development, issues and pull requests are in freyr/message-broker. A release has the tag storage-postgresql-v<version> in freyr/message-broker and the tag v<version> in freyr/message-broker-storage-postgresql.

The adapter implements the storage ports of the core with plain PDO: the outbox store, the deduplication store, the dead-letter store, the transaction, the schema installer and the outbox retention. The outbox table is partitioned by day.

Requirements

  • PHP 8.4 or later, with ext-pdo and ext-pdo_pgsql
  • PostgreSQL 14 or later
  • freyr/message-broker ^0.15 (the core), symfony/clock ^8.1, symfony/uid ^7.4 or ^8.1

Install

composer require freyr/message-broker-storage-postgresql

Minimal wiring

use Freyr\MessageBroker\Storage\PostgreSql\PdoTransaction;
use Freyr\MessageBroker\Storage\PostgreSql\PostgreSqlDeadLetterStore;
use Freyr\MessageBroker\Storage\PostgreSql\PostgreSqlDeduplicationStore;
use Freyr\MessageBroker\Storage\PostgreSql\PostgreSqlOutboxStore;
use Freyr\MessageBroker\Storage\PostgreSql\PostgreSqlSchemaInstaller;
use Freyr\MessageBroker\Console\SetupSchemaCommand;

$pdo = new PDO($dsn, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

$application->add(new SetupSchemaCommand(new PostgreSqlSchemaInstaller($pdo)));

$outbox = new PostgreSqlOutboxStore($pdo);
$transaction = new PdoTransaction($pdo);
$deduplication = new PostgreSqlDeduplicationStore($pdo);
$deadLetters = new PostgreSqlDeadLetterStore($pdo);

The relay store can delete published rows instead of the published_at mark: new PostgreSqlOutboxStore($workerPdo, PublishedRows::Delete) (default PublishedRows::Mark). See docs/STORAGE.md.

Documents