Skip to content

ulak

Transactional Outbox extension for PostgreSQL with reliable asynchronous delivery

ulak · Transactional Outbox extension for PostgreSQL with reliable asynchronous delivery

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2680ulakulak0.3.0FEATApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--NoYesYesYesnono
preload required; rm README from RPM/DEB

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.3.019 18 17 16 15ulak-
RPMPIGSTY0.3.019 18 17 16 15ulak_$v-
DEBPIGSTY0.3.019 18 17 16 15postgresql-$v-ulak-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el8.aarch64N/APIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el9.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el9.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el10.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el10.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d12.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d12.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d13.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d13.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u22.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u22.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u24.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u24.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u26.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u26.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
PackageVersionOSORGSIZEFile URL
ulak_190.3.0el9.x86_64pigsty357.6 KiBulak_19-0.3.0-1PGSTY.el9.x86_64.rpm
ulak_190.3.0el9.aarch64pigsty353.4 KiBulak_19-0.3.0-1PGSTY.el9.aarch64.rpm
ulak_190.3.0el10.x86_64pigsty360.5 KiBulak_19-0.3.0-1PGSTY.el10.x86_64.rpm
ulak_190.3.0el10.aarch64pigsty355.5 KiBulak_19-0.3.0-1PGSTY.el10.aarch64.rpm
postgresql-19-ulak0.3.0d12.x86_64pigsty306.3 KiBpostgresql-19-ulak_0.3.0-1PGSTY~bookworm_amd64.deb
postgresql-19-ulak0.3.0d12.aarch64pigsty299.2 KiBpostgresql-19-ulak_0.3.0-1PGSTY~bookworm_arm64.deb
postgresql-19-ulak0.3.0d13.x86_64pigsty337.1 KiBpostgresql-19-ulak_0.3.0-1PGSTY~trixie_amd64.deb
postgresql-19-ulak0.3.0d13.aarch64pigsty329.3 KiBpostgresql-19-ulak_0.3.0-1PGSTY~trixie_arm64.deb
postgresql-19-ulak0.3.0u22.x86_64pigsty321.3 KiBpostgresql-19-ulak_0.3.0-1PGSTY~jammy_amd64.deb
postgresql-19-ulak0.3.0u22.aarch64pigsty316.8 KiBpostgresql-19-ulak_0.3.0-1PGSTY~jammy_arm64.deb
postgresql-19-ulak0.3.0u24.x86_64pigsty344.1 KiBpostgresql-19-ulak_0.3.0-1PGSTY~noble_amd64.deb
postgresql-19-ulak0.3.0u24.aarch64pigsty340.0 KiBpostgresql-19-ulak_0.3.0-1PGSTY~noble_arm64.deb
postgresql-19-ulak0.3.0u26.x86_64pigsty342.6 KiBpostgresql-19-ulak_0.3.0-1PGSTY~resolute_amd64.deb
postgresql-19-ulak0.3.0u26.aarch64pigsty337.8 KiBpostgresql-19-ulak_0.3.0-1PGSTY~resolute_arm64.deb

Source

pig build pkg ulak;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install ulak;		# install by package name

pig install ulak -v 19;   # install for PG 19
pig install ulak -v 18;   # install for PG 18
pig install ulak -v 17;   # install for PG 17
pig install ulak -v 16;   # install for PG 16
pig install ulak -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'ulak';

Create this extension with:

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');

Table reader