[GH-ISSUE #1077] [FEATURE REQUEST] Accept regex in mux.HanlderFunc() #2539

Open
opened 2026-03-15 20:49:25 +03:00 by kerem · 1 comment
Owner

Originally created by @turisap on GitHub (Sep 29, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1077

Originally assigned to: @hibiken, @kamikazechaser on GitHub.

Is your feature request related to a problem? Please describe.
We use aynq and we want to process tasks grouped by type via a single handler, for example:

  • we have a group of scheduled tasks which all have type of automatic tasks (naming is auto:some_name)
  • we have configuration in the task payload, which is used in the handler to decide which users it will be assigned to
  • we want to use a single handler for all tasks of type auto, but in the moment mux.HandlerFunc() does not seem to be accepting sth like auto:* as a pattern parameter

Describe the solution you'd like
we want to use `mux.HandlerFunc('auto:*', ...) to handle them all as there are quite a lot of those task and we have groups of tasks.

Describe alternatives you've considered
at the moment, I just assign handlers in a loop.

Additional context
In the case of this is not implemented, I am willing to submit a PR if possible

Originally created by @turisap on GitHub (Sep 29, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1077 Originally assigned to: @hibiken, @kamikazechaser on GitHub. **Is your feature request related to a problem? Please describe.** We use `aynq` and we want to process tasks grouped by type via a single handler, for example: * we have a group of scheduled tasks which all have type of automatic tasks (naming is `auto:some_name`) * we have configuration in the task payload, which is used in the handler to decide which users it will be assigned to * we want to use a single handler for all tasks of type `auto`, but in the moment `mux.HandlerFunc()` does not seem to be accepting sth like `auto:*` as a pattern parameter **Describe the solution you'd like** we want to use `mux.HandlerFunc('auto:*', ...) to handle them all as there are quite a lot of those task and we have groups of tasks. **Describe alternatives you've considered** at the moment, I just assign handlers in a loop. **Additional context** In the case of this is not implemented, I am willing to submit a PR if possible
Author
Owner

@thomas4019 commented on GitHub (Oct 5, 2025):

@turisap I think it's already possible to do what you want. The mux.HanlderFunc() does prefix matching as documented here, so you should be able to do this by passing in auto:

<!-- gh-comment-id:3368718927 --> @thomas4019 commented on GitHub (Oct 5, 2025): @turisap I think it's already possible to do what you want. The `mux.HanlderFunc()` does prefix matching as documented [here](https://github.com/hibiken/asynq/wiki/Handler-Deep-Dive#using-servemux), so you should be able to do this by passing in `auto:`
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#2539
No description provided.