Reproduce ActiveRecord pessimistic locking strategy in a multi-threaded environment.
- Ruby / Bundler
- Foreman
- PostgreSQL
- Kafka
- Clone this repository
- Start PostgreSQL & Kafka
- Run
bin/setup
- Run
foreman start
- In another shell run
bundle exec rails dbconsole
and thenSELECT * FROM inbound_events ORDER BY id
. Verify thatid
,offset
, andcounter
(frompayload
) are all progressive numbers. This is the proof that they were stored in the same order they were produced (according tooutbound_events.published_at
)