cdc-debezium-rails
Installation
SKILL.md
CDC with Debezium
CDC publishes every row change in your Rails DB as a Kafka event. Downstream consumers (search index, data warehouse, audit log, downstream services) get them without your app emitting anything. Powerful and dangerous — every Rails write becomes a public contract.
The opinion
Use Debezium with Postgres logical replication when you have multiple downstream consumers needing eventually-consistent DB state (search, warehouse, cache invalidation). Do NOT use CDC as your domain event bus — emit explicit domain events from the app layer for that. CDC leaks schema; domain events express intent. Set
REPLICA IDENTITY FULLon tables you publish from. Use a single publication and replication slot per Debezium connector. Tombstone-handle deletes.
When CDC fits
| Use case | CDC fits? |
|---|---|
| Update search index when posts change | ✅ |
| Stream changes to a data warehouse | ✅ |
| Audit trail of every DB write | ✅ |
| Cache invalidation on row updates | ✅ |
| Sync to a downstream service's own DB | ⚠️ (couples on schema — use domain events) |
| Trigger business workflows | ❌ (semantic = "row changed", not "order placed") |
| Eventual consistency between microservices | ❌ (use domain events) |