Skip to content

Symfony Messenger component documentation #9437

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 15 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Uses :: to display as code blocks
  • Loading branch information
sroze committed Mar 27, 2018
commit 31a56ee081c24985e74af7b6c7abcb6f9d6759aa
4 changes: 2 additions & 2 deletions components/messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ following middlewares are configured for you:
#. ``SendMessageMiddleware`` (enables asynchronous processing)
#. ``HandleMessageMiddleware`` (calls the registered handle)

Example:
Example::

use App\Message\MyMessage;
Copy link
Contributor

Choose a reason for hiding this comment

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

-  use Symfony\Component\Messenger\MessageBus;
-  use Symfony\Component\Messenger\HandlerLocator;
-  use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
-
-    use App\Message\MyMessage;
+    use App\Message\MyMessage;
+    use Symfony\Component\Messenger\MessageBus;
+    use Symfony\Component\Messenger\HandlerLocator;
+    use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how it even ended like that 😂 Changed!

use Symfony\Component\Messenger\MessageBus;
Expand All @@ -67,7 +67,7 @@ Handlers
Once dispatched to the bus, messages will be handled by a "message handler". A
Copy link

Choose a reason for hiding this comment

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

"dispatched" is confusing here: according to the Bus section, the bus is responsible for dispatching messages; and the method used to get a message on to the bus is handle().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's dispatch :)

message handler is a PHP callable (i.e. a function or an instance of a class)
Copy link
Contributor

Choose a reason for hiding this comment

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

that will do the required processing for your message. It _might_ return a
result:
result::
Copy link

Choose a reason for hiding this comment

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

It might return a result

What happens if it does or does not return a result? Does the following example code illustrate something about this statement?


namespace App\MessageHandler;

Expand Down
2 changes: 1 addition & 1 deletion messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Registering Handlers
--------------------

In order to do something when your message is dispatched, you need to create a
message handler. It's a class with an `__invoke` method:
message handler. It's a class with an `__invoke` method::

// src/MessageHandler/MyMessageHandler.php
namespace App\MessageHandler;
Expand Down