How benipranata/walx works
walx is a configured executable that turns PostgreSQL logical-replication changes into ordered, at-least-once JSON events. Its main workflow is: load and validate per-database configuration, prepare PostgreSQL publication/slot and sink, stream and decode changes, filter events, deliver durable batches, then confirm WAL progress. Snapshot backfill, retry/dead-letter handling, selectable sinks, and optional Prometheus metrics are additional product capabilities. Relationships are limited to shown wiring and README statements; some unsampled subsystem details are represented without inferred internal call chains.
Main entry points: engine.go Stream engine · sink.go Sink registry · pipeline.go Database pipeline · app.go Application runner
Components 18
Runtime orchestration
- Application runner
cmd/walx/app.go - Config validation
internal/config/validate.go - Database pipeline
cmd/walx/pipeline.go - Stream engine
internal/engine/engine.go
PostgreSQL capture
- Publication and identity
internal/postgres/publication.go - Postgres connection
internal/postgres/conn.go - Replication and decode
internal/postgres/stream.go
Event processing
- Event filtering
internal/filter/filter.go - Snapshot backfill
internal/snapshot/snapshot.go
Delivery and operations
- Sink registry
internal/sink/sink.go - Stdout sink
internal/sink/stdout/stdout.go - File sink
internal/sink/file/file.go - NATS JetStream sink
internal/sink/nats/nats.go - Dead-letter output
internal/sink/dlq/dlq.go - Prometheus metrics
internal/metrics/prometheus.go
Other components
- Operator
- PostgreSQL
- NATS JetStream
Connections 23
- Operator → Application runner: runs
README.md - Application runner → Config validation: uses config
- Application runner → Database pipeline: prepares pipelines
cmd/walx/app.go - Database pipeline → Publication and identity: ensures publication
cmd/walx/pipeline.go - Database pipeline → Postgres connection: connects
cmd/walx/pipeline.go - Database pipeline → Stream engine: configures engine
cmd/walx/pipeline.go - Database pipeline → Sink registry: builds sink
cmd/walx/pipeline.go - Postgres connection → PostgreSQL: connects
- Replication and decode → PostgreSQL: reads WAL
- Stream engine → Replication and decode: consumes stream
- Stream engine → Event filtering: filters batches
- Stream engine → Sink registry: delivers batches
- Stream engine → Dead-letter output: dead-letters
- Stream engine → PostgreSQL: confirms WAL
README.md - Sink registry → Stdout sink: builds sink
- Sink registry → File sink: builds sink
- Sink registry → NATS JetStream sink: builds sink
- NATS JetStream sink → NATS JetStream: publishes events
internal/sink/nats/nats.go - Application runner → Prometheus metrics: exposes metrics
- Operator → Snapshot backfill: requests backfill
README.md - Snapshot backfill → PostgreSQL: reads current rows
internal/snapshot/snapshot.go - Snapshot backfill → Event filtering: uses filters
- Snapshot backfill → Sink registry: delivers batches