[GH-ISSUE #421] Multiple handlers for a specific task type ? #2211

Closed
opened 2026-03-15 19:41:38 +03:00 by kerem · 4 comments
Owner

Originally created by @raynaudoe on GitHub (Mar 18, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/421

Let's say that I have a task named data:process and the payload contains some raw json for example and I want that task to be distributed to 'several' handlers, the task should be processed by 'all' the handlers.
Something like:

 mux := asynq.NewServeMux()
 mux.HandleFunc("data:process", dataProcessorA)
 mux.HandleFunc("data:process", dataProcessorB)

is this possible ?
Thanks a lot

Originally created by @raynaudoe on GitHub (Mar 18, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/421 Let's say that I have a task named `data:process` and the payload contains some raw json for example and I want that task to be distributed to 'several' handlers, the task should be processed by 'all' the handlers. Something like: ```go mux := asynq.NewServeMux() mux.HandleFunc("data:process", dataProcessorA) mux.HandleFunc("data:process", dataProcessorB) ``` is this possible ? Thanks a lot
kerem closed this issue 2026-03-15 19:41:43 +03:00
Author
Owner

@hibiken commented on GitHub (Mar 18, 2022):

@raynaudoe thank you for the question!

Is this similar to this other question #410?

<!-- gh-comment-id:1072438154 --> @hibiken commented on GitHub (Mar 18, 2022): @raynaudoe thank you for the question! Is this similar to this other question #410?
Author
Owner

@raynaudoe commented on GitHub (Mar 19, 2022):

Thanks @hibiken , yeah, something like consumers groups.
The difference with the example on that issue is that, initially, my handlers (dataProcessorA, dataProcessorB ...) they all handle the same type of task but each processor analyzes let's say some aspect of the payload. Then the 'final' result is the sumatory of all the handler's outputs.

I'm sure that I can achieve the above using kafka or similar but since I'm using asynq for another component I thought I could achieve the same result without needing an extra package.

<!-- gh-comment-id:1073071077 --> @raynaudoe commented on GitHub (Mar 19, 2022): Thanks @hibiken , yeah, something like consumers groups. The difference with the example on that issue is that, initially, my handlers (dataProcessorA, dataProcessorB ...) they all handle the same type of task but each processor analyzes let's say some aspect of the payload. Then the 'final' result is the sumatory of all the handler's outputs. I'm sure that I can achieve the above using kafka or similar but since I'm using asynq for another component I thought I could achieve the same result without needing an extra package.
Author
Owner

@hibiken commented on GitHub (Mar 20, 2022):

I see. It sounds like this use case may benefit from a workflow feature like this one (#244)? Essentially you'd create a set of tasks to handle multiple stages in your workflow.

I'm planning to work on this laster half of this year so the feature is coming :)

<!-- gh-comment-id:1073262580 --> @hibiken commented on GitHub (Mar 20, 2022): I see. It sounds like this use case may benefit from a workflow feature like this one (#244)? Essentially you'd create a set of tasks to handle multiple stages in your workflow. I'm planning to work on this laster half of this year so the feature is coming :)
Author
Owner

@raynaudoe commented on GitHub (Mar 21, 2022):

thanks! yeah, I really like the workflows idea! Looking forward to it :)

<!-- gh-comment-id:1073740272 --> @raynaudoe commented on GitHub (Mar 21, 2022): thanks! yeah, I really like the workflows idea! Looking forward to it :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2211
No description provided.