Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Add HandlerArgumentsStamp #45418

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

Merged
merged 1 commit into from
Aug 14, 2022

Conversation

enumag
Copy link
Contributor

@enumag enumag commented Feb 14, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #31075
License MIT
Doc PR symfony/symfony-docs#17174

As 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.

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@enumag enumag marked this pull request as ready for review February 14, 2022 08:28
@carsonbot carsonbot added this to the 6.1 milestone Feb 14, 2022
@enumag
Copy link
Contributor Author

enumag commented Mar 3, 2022

Can I get some feedback on this feature?

@fabpot fabpot modified the milestones: 6.1, 6.2 May 20, 2022
Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@enumag enumag force-pushed the messanger-arguments-stamp branch 4 times, most recently from 62cb367 to efefa83 Compare August 8, 2022 07:24
@enumag
Copy link
Contributor Author

enumag commented Aug 8, 2022

@fabpot Thanks for the review. I changed the code according to your comments and added a test.

The CI failure seems unrelated.

Status: Needs review

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small code change to make it more consistent with the rest of Symfony.

@enumag
Copy link
Contributor Author

enumag commented Aug 14, 2022

@fabpot Updated. Is it okay to keep the promoted property or should I use the non-promoted syntax?

@enumag enumag force-pushed the messanger-arguments-stamp branch from 63aac08 to 7130126 Compare August 14, 2022 18:24
@enumag enumag force-pushed the messanger-arguments-stamp branch from 7130126 to d081267 Compare August 14, 2022 18:24
@enumag
Copy link
Contributor Author

enumag commented Aug 14, 2022

Tests are failing but once again I don't think it's related to my code.

I squashed everything into a single commit.

Also added a documentation PR.

@fabpot
Copy link
Member

fabpot commented Aug 14, 2022

Thank you @enumag.

@fabpot fabpot merged commit 79ee32a into symfony:6.2 Aug 14, 2022
@fabpot fabpot mentioned this pull request Oct 24, 2022
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Aug 14, 2023
This PR was submitted for the 6.2 branch but it was merged into the 6.3 branch instead.

Discussion
----------

[Messenger] HandlerArgumentsStamp

Refs
* symfony/symfony#45418

Commits
-------

756a0ca [Messenger] HandlerArgumentsStamp
@melkamar
Copy link

What is the reasoning behind making the stamp implement a NonSendableStampInterface? I needed to customize the arguments for a handler reading this from the transport and it seems like I cannot. Is there a technical reason why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Messenger] Passing stamps to message Handler
4 participants