Skip to content

ulak

Transactional Outbox extension for PostgreSQL with reliable asynchronous delivery

Overview

PackageVersionCategoryLicenseLanguage
ulak0.3.0FEATApache-2.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
2680ulakNoYesYesYesNoNoulak

preload required; rm README from RPM/DEB

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.3.01817161514ulak-
RPMPIGSTY0.3.01817161514ulak_$v-
DEBPIGSTY0.3.01817161514postgresql-$v-ulak-
OS / PGPG19PG18PG17PG16PG15
el8.x86_64N/A
el8.aarch64N/A
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
u22.x86_64
u22.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
u24.x86_64
u24.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
u26.x86_64
u26.aarch64

Build

You can build the RPM / DEB packages for ulak using pig build:

pig build pkg ulak         # build RPM / DEB packages

Install

You can install ulak directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

Install
pig install ulak;          # Install for current active PG version
pig
pig ext install -y ulak -v 19  # PG 19
pig ext install -y ulak -v 18  # PG 18
pig ext install -y ulak -v 17  # PG 17
pig ext install -y ulak -v 16  # PG 16
pig ext install -y ulak -v 15  # PG 15
dnf
dnf install -y ulak_19       # PG 19
dnf install -y ulak_18       # PG 18
dnf install -y ulak_17       # PG 17
dnf install -y ulak_16       # PG 16
dnf install -y ulak_15       # PG 15
apt
apt install -y postgresql-19-ulak   # PG 19
apt install -y postgresql-18-ulak   # PG 18
apt install -y postgresql-17-ulak   # PG 17
apt install -y postgresql-16-ulak   # PG 16
apt install -y postgresql-15-ulak   # PG 15

Preload:

shared_preload_libraries = 'ulak';

Create Extension:

CREATE EXTENSION ulak;

Usage

Sources:

ulak implements a transactional outbox: enqueue messages in the same transaction as application data, then deliver them through background workers. Delivery to remote systems is at least once; consumers must tolerate duplicates.

Enablement

PostgreSQL 14–18 is supported. Set shared_preload_libraries and ulak.database, restart PostgreSQL, then create the extension in that database. HTTP is built in; Kafka, MQTT, Redis Streams, AMQP and NATS require their optional compiled adapters and client libraries.

shared_preload_libraries = 'ulak'
ulak.database = 'appdb'
CREATE EXTENSION ulak;

Enqueue and publish

Create endpoints as an administrator; grant application access through ulak_application. ulak_admin manages endpoints and operations; ulak_monitor reads monitoring data. Use ulak.endpoint_status for endpoint status without exposing endpoint credentials. A rolled-back transaction leaves no message.

SELECT ulak.create_endpoint('orders-http', 'http',
  '{"url":"https://example.com/webhook","method":"POST"}'::jsonb);
BEGIN;
SELECT ulak.send('orders-http', '{"event":"order.created","id":123}'::jsonb);
COMMIT;

SELECT ulak.send_batch('orders-http', ARRAY['{"id":1}'::jsonb, '{"id":2}'::jsonb]);
SELECT ulak.create_event_type('order.created', 'Order created');
SELECT ulak.subscribe('order.created', 'orders-http');
SELECT ulak.publish('order.created', '{"id":123}'::jsonb);

Delivery limits and retries

ulak.send_with_options adds priority, scheduling, idempotency, expiry and ordering controls. In 0.3.0 all enqueue APIs enforce ulak.max_payload_size; oversized payloads raise 54000. Batch APIs count each row against ulak.max_queue_size and raise 53400 on overflow. Stale processing rows consume retry budget and eventually enter the dead-letter queue. Workers use synchronous_commit = local and lock_timeout = 10s.

Protocol and upgrade changes

0.3.0 retries HTTP 408/425, Redis OOM/READONLY and unroutable mandatory AMQP messages. Redis TLS now checks hostnames. ulak.mqtt_default_qos defaults to 1; multiple workers suffix configured MQTT client IDs with their worker number. NATS message IDs include cluster and database identity; AMQP message IDs use the queue row ID. Review downstream deduplication assumptions. Install the matching library and SQL, restart to load the worker library, and upgrade the extension. External listeners need ulak.wake_notify = on to receive ulak_new_msg; native workers use shared-memory wakeups.

ALTER EXTENSION ulak UPDATE TO '0.3.0';

Monitoring and recovery

Tune ulak.workers, ulak.poll_interval, ulak.batch_size, retry and circuit-breaker settings for the workload. Inspect failures before redriving; redrive and replay can deliver an already-observed message again. HTTP SSRF restrictions apply unless explicitly relaxed.

SELECT * FROM ulak.health_check();
SELECT * FROM ulak.get_worker_status();
SELECT * FROM ulak.get_endpoint_health();
SELECT * FROM ulak.dlq_summary();
SELECT ulak.redrive_endpoint('orders-http');

Was this page helpful?

Table reader