Transactional enqueue
Wrap the transaction handle already owned by the application, then enqueue through the transactional port before committing. If the application write rolls back, the job rolls back with it.
GORM and Bun expose the underlying
*sql.Tx on MySQL. SQL builders that retain the native
pgx handle can use the PostgreSQL adapter. An ORM that does not expose a compatible raw
connection needs a small second pool or enqueue-after-commit, with the corresponding
job-loss window made explicit.
Transactional handler effects
Theonce helper claims an effect key, runs application writes, and completes the job in
one fence-verified transaction. Step-scoped idempotency commits a named step’s effect with
its checkpoint. If ownership changes before commit, both the application write and the
Headgate completion roll back.
Inside such a callback, use the supplied transaction. Calling an ordinary store method may
try to acquire a second connection while the first is retained and can exhaust a small
pool.
Connection budget
Size SQL pools for transactional callbacks, renewal, admission, and notifications.