Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Messenger] HandlerArgumentsStamp#17174
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This PR was merged into the 6.2 branch.Discussion----------[Messenger] Add HandlerArgumentsStamp| Q | A| ------------- | ---| Branch? | 6.2| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets |Fix#31075| License | MIT| Doc PR |symfony/symfony-docs#17174As discussed in#31075 sometimes it's desirable for the messenger handler to receive additional argument than just the message itself. I understand the voiced concerns about passing the entire envelope but instead of that we could use the approach from this PR which doesn't add any additional arguments by default but is actually even more powerful since it gives the user full control what should be sent to the handler if desired.This is just a prototype of course. With#45377 in mind I used a readonly property from PHP 8.1 but of course such details can be easily adjusted.Let me know if such feature is wanted in Symfony. If yes then I'll add tests and a doc PR.Commits-------d081267 Add HandlerArgumentsStamp
alexislefebvre commentedAug 15, 2022
Can you please add an example of code? I think it also need a note to say that it was added since Symfony 6.2. |
OskarStark commentedOct 24, 2022
friendly ping@enumag |
enumag commentedNov 4, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Code sample and version note added. |
52a946f to187f63fComparemessenger.rst Outdated
| It's possible to have messenger pass additional data to the message handler using the | ||
| :class:`Symfony\\Component\\Messenger\\Stamp\\HandlerArgumentsStamp`. Add this stamp to | ||
| the envelope in a middleware and fill it with any additional data you want to have | ||
| available in the handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| available in the handler. | |
| available in the handler:: |
messenger.rst Outdated
| } | ||
| } | ||
| Then your handler will look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| Then your handler will look like this: | |
| Then your handler will look like this:: |
messenger.rst Outdated
| ..versionadded::6.2 | ||
| The HandlerArgumentsStamp was introduced in Symfony 6.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| The HandlerArgumentsStamp was introduced in Symfony 6.2. | |
| The:class:`Symfony\\Component\\Messenger\\Stamp\\HandlerArgumentsStamp` was introduced in Symfony 6.2. |
OskarStark commentedAug 14, 2023
It took time, but here we go, this is in now. Thank you very much Jáchym. |
Uh oh!
There was an error while loading.Please reload this page.
Refs