-
-
Notifications
You must be signed in to change notification settings - Fork 921
Provides an integration with the Symfony Messenger component #2398
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
@dunglas With the default configuration in sf messenger, how would oneself make a message handler that handled the remove message? |
Also, in the example posted above, would the swagger generated documentation properly reflect that no response is made? |
For removal, you'll need a middleware, a simple handler would just get the message.
Not yet unfortunately, but it's something we're working on! |
just a niggle but your example relies on #2396. https://github.com/krakphp/api-platform-extra also implemented this, FYI. |
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.
So simple, yet so powerful. Loving it!
I've made a few remarks regarding possible future requests and just more flexibility in general but otherwise, super nice addition - well done!
09c62d7
to
5293729
Compare
{ | ||
$this->messageBus->dispatch($data); | ||
|
||
return $data; |
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.
I'd return the result
of the HandledStamp
instead if it exists.
*/ | ||
public function supports($data): bool | ||
{ | ||
return true === $this->resourceMetadataFactory->create($this->getObjectClass($data))->getAttribute('messenger'); |
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.
Could we have created a new ContextAwareDataPersisterInterface
, so that the messenger
attribute could be set at the operation level?
This patch adds an easy way to dispatch messages to be handled asynchronously (or synchronously) using the Symfony Messenger component. It allows to create service-oriented endpoints very easily, but still in a restful way.
To be dispatched as a Symfony message, a resource just need to have be marked with
messenger
attribute:The corresponding Message handler:
It's an alternative to https://github.com/sroze/api-platform-messenger.