-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] allow to change the message name #29045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The serializing part loses the name - that's why I added it as a stamp in a previous PR. |
Let's say there is a message with arbitrary data and you want to route to handlers based on the data of the message. |
+1 to changing the interface back so it accepts an As for responsibilities, this is how I see things:
|
…es (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [Messenger] make senders/handlers locator accept envelopes | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As suggested by @Tobion in symfony/symfony#29045 (comment) - works for me also. Commits ------- 9cd88b0dc5 [Messenger] make senders/handlers locator accept envelopes
…es (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [Messenger] make senders/handlers locator accept envelopes | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As suggested by @Tobion in #29045 (comment) - works for me also. Commits ------- 9cd88b0 [Messenger] make senders/handlers locator accept envelopes
Replaced by #29052. The rest can be implemented manually or in future symfony versions. |
…es (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [Messenger] make senders/handlers locator accept envelopes | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As suggested by @Tobion in symfony/symfony#29045 (comment) - works for me also. Commits ------- 9cd88b0dc5 [Messenger] make senders/handlers locator accept envelopes
Having the class name as default for the message name is the best practice and usually does not need to be changed. But I think we need to provide a way to do so for just for flexibility. This allows people to opt-out of interface/parent class based routing (#28993) by manually calling
$bus->dispatch(Envelope::createNamed($message, 'foo'))
. IMO we don't need to add an optional name parameter to thedispatch
method like originally proposed in #28944 since it's an edge case that does not need to be exposed at the primary entry point.