Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWorker: An SDK to work with async workers #51

Closed
wants to merge 5 commits into from
Closed

Conversation

ajatprabha
Copy link
Contributor

@ajatprabha ajatprabha commented Jun 20, 2024

Open Questions
  • Should we make use of generics for Job payload and Handler signatures?

@ajatprabha ajatprabha requested a review from sonnes June 20, 2024 06:53
@ajatprabha ajatprabha changed the title XWorker: An SDK to work with async workers Draft: XWorker: An SDK to work with async workers Jun 20, 2024
@ajatprabha ajatprabha changed the title Draft: XWorker: An SDK to work with async workers XWorker: An SDK to work with async workers Jun 20, 2024
@ajatprabha ajatprabha marked this pull request as draft June 20, 2024 07:24
@sonnes
Copy link
Collaborator

sonnes commented Jun 20, 2024

Check out https://github.com/riverqueue/river

i really liked the ease of use of their APIs

@sonnes
Copy link
Collaborator

sonnes commented Jun 20, 2024

I’m trying to use it for kafka publishing #47

@sonnes
Copy link
Collaborator

sonnes commented Jun 21, 2024

I have been thinking about this for a while. These are few things that I am concerned about:

  1. gocraft/work is a pretty outdated library. It is not maintained anymore. I know we maintain a fork of it, but it is just band-aids. gocraft's primary constraint is only works with Redis.

  2. Choosing a async worker framework/library is a big decision. Primarily because every framework has different trade-offs, UI, and APIs. Bending these frameworks to work with our SDK significantly increases the complexity of the SDK. Once a project chooses a framework, it is unlikely to switch to another one or use multiple frameworks.

Alternatively, theses are some options we can consider:

  1. Adopt a new library like https://github.com/riverqueue/river. It is Postgres based and should easily integrate with most of our projects. It is already structured as a SDK with pluggable drivers.

  2. We can build our own async worker framework. The generics based SDK of River can be a good starting point. This only makes sense if we really need to support different databases - Redis, Badger, etc AND a small subset of River's features.

@ajatprabha
Copy link
Contributor Author

gocraft/work is a pretty outdated library.

Agreed, I also tried xworker with asynq and machinery, worked with both.

every framework has different trade-offs, UI, and APIs.

True, machinery had flows like async orchestration which I didn't support in xworker.

Adopt a new library like https://github.com/riverqueue/river.

Sure, haven't tried it yet, but it looks promising! The choice of underlying storage is very subjective, for instance, my workflows primarily rely on redis and kafka only, for me, postgres is an added dependency.

We can build our own async worker framework.

Decoupling the frontend SDK from underlying implementation is a great idea in most cases, example: Otel, but I agree that it also comes with huge complexity, however, I don't want to deny the benefits, looks like river solves that, then I would wonder if we even need a wrapper altogether. Can we get away with river itself.

@sonnes
Copy link
Collaborator

sonnes commented Jun 25, 2024

Let us try adding redis backend to river

@ajatprabha ajatprabha closed this Jul 9, 2024
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.

2 participants