Skip to content

Feature: Postgres signalling#223

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

Feature: Postgres signalling#223
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 an opt-in Rails generator path for Postgres signalling:

  • rails generate anycable:setup --postgres-signalling
  • configures Rails AnyCable to use broadcast_adapter: postgres
  • configures generated anycable.toml with broadcast_adapters = ["http", "postgres"] and pubsub_adapter = "postgres"
  • sets the Postgres broadcast/pubsub table names and two wake-up channels expected by anycable-go
  • does not generate a Rails migration; anycable-go owns and ensures the signalling schema on startup

The generated config matches the anycable-go server-owned schema and the anycable-rb Postgres broadcast adapter.

Design Notes

  • Rails publishes through the anycable-rb Postgres adapter, which calls SQL functions owned by anycable-go.
  • anycable-go manages the signalling schema, including anycable_broadcasts, anycable_pubsub, and stream-offset metadata.
  • generated config uses the two stable wake-up channels; anycable-go owns their final payload format.
  • payload stays text, not jsonb, so AnyCable's exact JSON envelope is preserved and large messages are not constrained by NOTIFY.
  • ensure_schema = true keeps setup simple for generated apps while still leaving schema ownership on the server side.

Validation

  • bundle exec rspec spec/generators/setup/setup_generator_spec.rb
  • bundle exec rubocop lib/generators/anycable/setup/setup_generator.rb spec/generators/setup/setup_generator_spec.rb
  • git diff --check

Follow-Up

  • The anycable-go PR owns schema creation/validation and consumes this config.
  • The anycable-rb PR adds the producer-side postgres broadcast adapter.

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 Add Postgres signalling generator 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