-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Messenger] Introduce SelfStampableInterface #54366
base: 7.2
Are you sure you want to change the base?
Conversation
2e50e03
to
e385324
Compare
src/Symfony/Component/Messenger/Tests/Fixtures/SelfStampableDummyMessage.php
Outdated
Show resolved
Hide resolved
An alternative idea, also suggested by the comment that you've linked, was to use attributes for stamps. Can you elaborate why you dismissed that idea in favor of an interface? |
I misunderstood/forgot about the comment when working on this and the only idea I had in mind was an interface. Then, I reread the comment and even found #50812 IMHO the interface is simpler:
Also, dynamic stamps would be impossible with attribute. This would be useful for the LockStamp in #54141,
|
i tend to prefer stamps as attributes for the sake of decoupling having runtime flexibility is nice, but IMHO it needs to be scalable, eg. we might want to use additional services to compute a stamp in that sense, middleware layer already brings full runtime flexibility in userland to apply default stamps for compiling stamps as-a-service from attributes, take this:
|
Sorry, I don't understand how will be solved, in the simple way, the
situation with
|
perhaps self-stamping is the way to go for such simple runtime usecases no strong opinion :)
it could compute a key from the message payload by default |
With a method, you also can add the stamp conditionnaly
@derrabus do you have time for a new look ? :) |
Idea was kinda suggested from #54141 (comment)
This interface would allow to define stamp I always want by default with a message.
By merging in the order
I can still override a stamp when dispatching the message.