Skip to content

Support mixed drivers in transactional work - #1365

Closed
bgentry wants to merge 1 commit into
masterfrom
bg/mixed-driver-job-transactions
Closed

Support mixed drivers in transactional work#1365
bgentry wants to merge 1 commit into
masterfrom
bg/mixed-driver-job-transactions

Conversation

@bgentry

@bgentry bgentry commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Worker contexts currently bind transactional worker helpers to the worker
client's transaction type. Applications that execute jobs with one River
driver but use another driver for application transactions cannot complete a
job or persist a resumable step atomically through those transactions.

Use the explicit TDriver parameter to adapt the supplied transaction while
continuing to take the pilot, schema, and clock from the worker client. This
keeps completion behavior associated with the worker that owns the job without
requiring the transaction and worker clients to expose the same Go transaction
type.

Apply the same separation to JobCompleteTx, ResumableSetStepTx, and
ResumableSetStepCursorTx.

River Pro compatibility is handled in
riverqueue/riverpro#360.

Fixes #1364.

Worker contexts identify the client that is executing a job, but an
application transaction may use a different database abstraction against the
same database. Binding the context lookup to the transaction type prevents
`JobCompleteTx` and the resumable step helpers from supporting that topology.

Use the explicit driver type to unwrap each transaction while obtaining the
pilot, schema, and clock from the worker client through a type-independent
context view. This preserves the worker's completion semantics while allowing
the transaction adapter to differ.

Cover completion and resumable step persistence with transaction types that
differ from the worker client's transaction type.
@bgentry

bgentry commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing this draft after further design review. Apologies, Codex got overeager and turned an incidental pre-Pilot behavior into proposed support for mixed transactional drivers. That doesn't fit River's client/driver/Pilot ownership model, and the pgx-backed listener approach in #1366 is the better solution to #1364.

@bgentry bgentry closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public way to supply the client to JobCompleteTx when completing in a different client’s transaction type

1 participant