Skip to content

feat(table): add optional PG NOTIFY trigger for outbox tables - #31

Merged
OpenSourceAlchemist merged 3 commits into
mainfrom
feat/notify
Sep 6, 2026
Merged

feat(table): add optional PG NOTIFY trigger for outbox tables#31
OpenSourceAlchemist merged 3 commits into
mainfrom
feat/notify

Conversation

@OpenSourceAlchemist

Copy link
Copy Markdown
Member

Description

Add an optional PostgreSQL NOTIFY trigger that signals when new events are
written to the outbox table. This allows external subscribers to react to
outbox events in near real-time without polling.

Changes

  • New NotifyTrigger class creating a pg_notify function and
    statement-level AFTER INSERT trigger on the outbox table
  • Opt-in with notify: true option on pgt_outbox_setup
  • Channel defaults to <outbox_table>_notifications, overridable via notify_channel
  • Follows pgt_outbox_* naming convention for generated objects
  • Add --notify and --notify-channel CLI flags to outboxify

API

DB.pgt_outbox_setup(:accounts,
  notify: true,
  notify_channel: 'accounts_outbox_notifications'  # default
)

Closes #28

- Add NotifyTrigger class creating a pg_notify function and
  statement-level AFTER INSERT trigger on the outbox table
- Opt-in with notify: true option on pgt_outbox_setup
- Channel defaults to <outbox_table>_notifications, overridable
  via notify_channel option
- Follows pgt_outbox_* naming convention for generated objects
- Add --notify and --notify-channel CLI flags to outboxify
- Add tests for default off, notify on, custom channel, and insert
bougyman
bougyman previously approved these changes Sep 6, 2026
@OpenSourceAlchemist
OpenSourceAlchemist merged commit 218796b into main Sep 6, 2026
7 checks passed
@OpenSourceAlchemist
OpenSourceAlchemist deleted the feat/notify branch September 6, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add trigger (optional) for using PG NOTIFY

2 participants