Documentation
¶
Overview ¶
Package main sketches the recommended way to combine Postgres and DynamoDB: Postgres is the authoritative event store (it provides the global ordered feed and crash-safe subscriptions), and DynamoDB holds a read model built by a background subscriber. Crash recovery happens from Postgres — after a restart the subscriber resumes from its checkpoint and re-applies events to DynamoDB.
The DynamoDB projection is at-least-once, NOT exactly-once: a DynamoDB write cannot join the subscriber's Postgres batch transaction, so a crash mid-batch redelivers events. The handler is therefore made idempotent with a conditional write keyed on the global feed position — replays are no-ops and application stays monotonic.
Run with live infrastructure:
POSTGRES_DSN=postgres://... DYNAMO_PROJECTION_TABLE=accounts \ AWS_REGION=us-east-1 go run ./examples/projection/