Support Dynamic Queue Names with Wildcard Priorities config #1066
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #856
Allows workers to process dynamic queue names. Dynamic queue priorities can be set using wildcard (
*) patterns:criticalwill be processed first (priority 10):transfer:in its name (priority 7)email:important(priority 6)email:(priority 5)Implementation details
queueManagerthat periodically polls (by default every 5s) all existing queues from existing Redis SET AllQueues. The manager assigns priorities to new queues based on the wildcard configuration.Motivation
The feature addresses the use case described in #856, enabling dynamic queue creation at runtime (e.g., queue names based on domain objects - for us it is S3 bucket names for data migration). This is particularly useful for applications requiring flexible queue management without predefined queue names.
Side notes
Apologies for submitting a large PR without a prior design proposal. The API change is minimal, and the implementation is best understood by reviewing the source code. Feedback is welcome!
Future work
This PR lays the groundwork for addressing #850, which proposes dynamic queue priority configuration. Potential next steps include:
-1queueManagerto periodically fetch new queues with score-1and assign priorities based on the dynamic configuration.O(N)toO(1)for each message dequeue operation, whereNis number of queues in the config.