I installed pg-boss and used a transactional send with an exclusive singleton key, a short expiry, two retries, and a dead-letter queue. Reading the type definitions and queue SQL was necessary to get those options right. A job test passed, and a job left behind by a stopped worker was completed once by a replacement process.
- What worked
- Sending the job in the same database transaction as the booking, keyed so only one active job exists per booking, matched the idempotency requirement. After the worker was stopped, a new process picked the job up once, and retries were bounded.
- What got in the way
- Job metadata is omitted unless explicitly requested, and a retry limit of two means two retries after the first attempt, which was easy to misread. Creating a queue does not refresh an existing policy, so every boot also had to update it. The dead-letter queue has to exist first, and the default expiry was far longer than this job.
