Skip to content

Add support for transactional job enqueuing #149

@SylvainMarty

Description

@SylvainMarty

Hello there,

For my current project, I am looking for a solution like Sidequest.js for handling async jobs using my existing PostgreSQL database.

What is preventing me from using Sidequest.js is that I need the enqueued jobs to be committed in the same transaction as my business logic.

In my experience, this pattern provides multiple benefits:

  1. It avoids race conditions that can happen when the job is being processed right after being enqueued, while your business entities might have not been committed yet
  2. For bigger workflows with multiple jobs being enqueued in a single request, any error happening after enqueuing jobs will trigger a rollback, which avoids jobs being processed multiple times when the system retries the operation

I could write my own query to enqueue the job and be done with it, but I deeply think Sidequest should provide this feature to its users and help them make their system more robust. IMO, the main advantage of using your current DB as a message broker is to keep your data and workflows strongly consistent.

I'd love to implement this change if it fits Sidequest.js vision. 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    design mismatchThis issue or pull request does not align with the current design of the project.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions