freyr / message-broker-storage-postgresql
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
Requires
- php: >=8.4
- ext-pdo: *
- ext-pdo_pgsql: *
- freyr/message-broker: ^0.15
- symfony/clock: ^8.1
- symfony/uid: ^7.4|^8.1
Requires (Dev)
- infection/infection: ^0.35.11
- phpunit/phpunit: ^13.4
- symfony/console: ^7.4|^8.1
Suggests
- phpunit/phpunit: Required for Freyr\MessageBroker\Storage\PostgreSql\Testing\*, the PostgreSQL test set-up
Provides
Conflicts
None
Replaces
None
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-postgresqlis a read-only copy of the folderstorage/postgresql/of freyr/message-broker. Development, issues and pull requests are in freyr/message-broker. A release has the tagstorage-postgresql-v<version>in freyr/message-broker and the tagv<version>infreyr/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-pdoandext-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
- Storage: tables, schema setup, classes
- Retention: partitions,
outbox:maintain, pg_partman - Connection pooling
- Webhook delivery storage:
webhook_deliveries, the delivery store, retention, pg_partman, and the flow control tables withPostgreSqlRateLimiterandPostgreSqlCircuitBreaker - Ports of the core