Dynamic worker connection and queue#326
Closed
janwehner wants to merge 4 commits intodurable-workflow:masterfrom
Closed
Dynamic worker connection and queue#326janwehner wants to merge 4 commits intodurable-workflow:masterfrom
janwehner wants to merge 4 commits intodurable-workflow:masterfrom
Conversation
0d5b84f to
e8dee83
Compare
Member
|
@janwehner $workflow->start('blah', 'blah', WorkflowOptions::set(['connection' => 'connection-name', 'queue' => 'queue-name']));Would this work for you? |
Author
|
Yea, that should work. So the only difference would be the connection and queue options saved in the arguments column instead of seperate columns and no changes to the |
Member
|
I will make a new PR for this feature. Thanks for your work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi,
This PR is more kind of a proof of concept. It does introduce the possibility to set the queue and connection name dynamically.
It's currently not possible to really set the queue connection and queue name dynamically. There is this discussion were was suggested to extend the workflow and only set the
$connectionand$queueproperty.The problem is that I have about 40 workflows and would like to introduce a tenant-based queue system and it's not really reasonable to create hundreds of classes only to define the
$connectionand$queueproperty.The second approach to let the parent workflow inject the queue in every activity and child workflow it is spawning does not work because the
Signal,Timer,ExceptionandChildWorkflowclasses do get the connection and queue from the default properties of the workflow and would be processed by the wrong worker or not at all.Since an instance of the
StoredWorkflowclass is available in every workflow-related class it would be the easiest way to introduce dynamic connection and queue names by saving them in the database.The PR is adding two optional parameters to the
WorkflowStub::makemethod to save the connection and queue name in the database. Doing so is passing the connection and queue completely down the line by minimal changes to the dispatching of jobs and making of child workflows and activites, so evenSignal,Timer,ExceptionandChildWorkflowwill be processed by the correct worker.I think this approach would have no impact on existing systems since the
$connectionand$queueproperty would still be used if no connection and queue is set in the database.Would you consider merging/implementing this approach for dynamic connection and queue names?