Add example of filtering #152
-
Hello, I didn’t find the way to filter process able job based on a predicate. Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Regarding filtering are possible approaches:
Tho steer jobs in an enum, Use tower steer https://docs.rs/tower/latest/tower/steer/index.html. That said what you are trying to do may be against apalis's philosophy of one job per worker.
why do you need distinct workers? workers are just a future that streams jobs from source and hence a job could be run by any worker. If you could also give an example of the enum that would be great too. |
Beta Was this translation helpful? Give feedback.
-
Hey, Well the idea is to have a worker A than can embark an algo A, and another worker B with algo B. The incoming message is something like that:
Both workers share the same input. This is really useful because for some deployment in prod I don't need the worker A and for other deployment I need both. But you right I think I can also create 2 differents Message/RequestPayload and each worker handle different type of Message instead of embarking the algo enum in the Message |
Beta Was this translation helpful? Give feedback.
-
You can use generics too
|
Beta Was this translation helpful? Give feedback.
-
Also checkout https://lib.rs/crates/either |
Beta Was this translation helpful? Give feedback.
You can use generics too