Skip to content

Move some doc contents in a Messenger article #12260

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
Sep 2, 2019
Merged
Changes from all commits
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
11 changes: 4 additions & 7 deletions messenger/handler_results.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ You can use this to get the value returned by the handler(s)::
// or get info about all of handlers
$handledStamps = $envelope->all(HandledStamp::class);

A :class:`Symfony\\Component\\Messenger\\HandleTrait` also exists in order to ease
leveraging a Messenger bus for synchronous needs.
The :method:`Symfony\\Component\\Messenger\\HandleTrait::handle` method ensures
there is exactly one handler registered and returns its result.

Working with Command & Query Buses
----------------------------------

Expand All @@ -36,8 +31,10 @@ buses are central pieces of the application. Read Martin Fowler's
As queries are usually synchronous and expected to be handled once,
getting the result from the handler is a common need.

To avoid boilerplate code, you can leverage the ``HandleTrait`` in any class
that has a ``$messageBus`` property::
A :class:`Symfony\\Component\\Messenger\\HandleTrait` exists to get the result
of the handler when processing synchronously. It also ensures that exactly one
handler is registered. The ``HandleTrait`` can be used in any class that has a
``$messageBus`` property::

// src/Action/ListItems.php
namespace App\Action;
Expand Down