Skip to content

Feature: Postgres signalling#9

Open
TikiTDO wants to merge 4 commits into
anycable:mainfrom
TikiTDO:feature/postgres-signalling
Open

Feature: Postgres signalling#9
TikiTDO wants to merge 4 commits into
anycable:mainfrom
TikiTDO:feature/postgres-signalling

Conversation

@TikiTDO
Copy link
Copy Markdown

@TikiTDO TikiTDO commented May 22, 2026

Summary

Adds a Postgres broadcast adapter to AnyCable Ruby:

  • broadcast_adapter: postgres
  • calls the SQL functions owned by anycable-go: anycable_publish(stream, payload, meta) and anycable_remote_command(payload, meta)
  • preserves the full AnyCable JSON envelope as opaque text for the server-owned schema
  • supports normal stream broadcasts, remote commands, and batched broadcasts by decomposing the batch into one SQL function call per message
  • documents the adapter/config and adds RBS signatures, focused specs, and a changelog entry

The adapter pairs with anycable-go's Postgres implementation. PostgreSQL LISTEN/NOTIFY stays in anycable-go as a wake-up path; the Ruby producer does not manage signalling tables, triggers, or schema validation.

Config

New config key:

  • postgres_url (ANYCABLE_POSTGRES_URL, defaults through DATABASE_URL before falling back to localhost)

Validation

  • bundle exec rspec spec/anycable/broadcast_adapters/postgres_spec.rb spec/anycable/config_spec.rb
  • bundle exec rubocop lib/anycable/broadcast_adapters/postgres.rb lib/anycable/config.rb spec/anycable/broadcast_adapters/postgres_spec.rb spec/anycable/config_spec.rb
  • git diff --check

Follow-Up

  • The anycable-go PR owns schema creation/validation and consumes the SQL-function writes.
  • The anycable-rails PR configures generated apps for this server-owned schema.

Development Note

This PR was prepared with AI assistance and then reviewed, tested, and validated by TikiTDO before submission.

Related PRs

Checklist

  • I've added tests for this change
  • I've added a Changelog entry
  • I've updated documentation

@TikiTDO TikiTDO changed the title Feature/postgres signalling Feature: Postgres signalling May 22, 2026
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.

1 participant