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

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Mar 14, 2018

This pull-request adds some documentation for the Messenger component. As it is, it's extracted from the README built incrementally in the code pull-request.

I'm sure there will be lots to change when the implementation is merged :)

symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Mar 23, 2018
This PR was squashed before being merged into the 4.1-dev branch (closes #24411).

Discussion
----------

[Messenger] Add a new Messenger component

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24326
| License       | MIT
| Doc PR        | symfony/symfony-docs#9437

As discussed in #24326. This PR is to help going forward with the discussions of having a Message component.

# Resources

| What | Where
| --- | ---
| Documentation | [In the PR](https://github.com/sroze/symfony/blob/add-message-component/src/Symfony/Component/Message/README.md)
| Demo | [In `sroze/symfony-demo:message-component-demo`](https://github.com/sroze/symfony-demo/compare/message-component-demo)
| [php-enqueue](https://github.com/php-enqueue/enqueue-dev) adapter | 1. Source: [In `sroze/enqueue-bridge`](https://github.com/sroze/enqueue-bridge) _(to be moved as `symfony/enqueue-bridge` I guess)_<br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-enqueue`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-enqueue)
| [Swarrot](https://github.com/swarrot/swarrot) adapter | **Outdated adapter, waiting for stabilization** 1. Source: [In `sroze/swarrot-bridge`](https://github.com/sroze/swarrot-bridge) _(to be moved as `symfony/swarrot-bridge` I guess)_<br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-swarrot`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-swarrot)
| [HTTP](https://github.com/sroze/message-http-adapter) adapter | **Outdated adapter, waiting for stabilization** 1. Source: [In `sroze/message-http-adapter`](https://github.com/sroze/message-http-adapter) <br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-http-adapter`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-http-adapter)
| Web profiler integration | _In the pull-request_

# Important points

1. **Tests are not in the PR as they were written in PhpSpec & Behat.** If we decide to go forward with this approach, I'll translate them to PHPUnit.
2. The aim is not to solve all the message/queuing problems but provide a good, simple and extensible message bus for developers.
3. The communication with the actual AMQP/API brokers is down to the adapters for now. Not sure if we need to ship some by default or not 🤔

I guess that this would replace #23842 & #23315.

# Changes from the proposals

Based on the comments, a few changes have been made from the proposal.

1. `MessageProducer`s have been renamed to `MessageSender`s
2. `MessageConsumer`s have been renamed to `MessageReceiver`s

Commits
-------

c9cfda990b [Messenger] Add a new Messenger component
fabpot added a commit to symfony/symfony that referenced this pull request Mar 23, 2018
This PR was squashed before being merged into the 4.1-dev branch (closes #24411).

Discussion
----------

[Messenger] Add a new Messenger component

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24326
| License       | MIT
| Doc PR        | symfony/symfony-docs#9437

As discussed in #24326. This PR is to help going forward with the discussions of having a Message component.

# Resources

| What | Where
| --- | ---
| Documentation | [In the PR](https://github.com/sroze/symfony/blob/add-message-component/src/Symfony/Component/Message/README.md)
| Demo | [In `sroze/symfony-demo:message-component-demo`](https://github.com/sroze/symfony-demo/compare/message-component-demo)
| [php-enqueue](https://github.com/php-enqueue/enqueue-dev) adapter | 1. Source: [In `sroze/enqueue-bridge`](https://github.com/sroze/enqueue-bridge) _(to be moved as `symfony/enqueue-bridge` I guess)_<br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-enqueue`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-enqueue)
| [Swarrot](https://github.com/swarrot/swarrot) adapter | **Outdated adapter, waiting for stabilization** 1. Source: [In `sroze/swarrot-bridge`](https://github.com/sroze/swarrot-bridge) _(to be moved as `symfony/swarrot-bridge` I guess)_<br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-swarrot`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-swarrot)
| [HTTP](https://github.com/sroze/message-http-adapter) adapter | **Outdated adapter, waiting for stabilization** 1. Source: [In `sroze/message-http-adapter`](https://github.com/sroze/message-http-adapter) <br/>2. Demo: [In `sroze/symfony-demo:message-component-demo-with-http-adapter`](sroze/symfony-demo@message-component-demo...sroze:message-component-demo-with-http-adapter)
| Web profiler integration | _In the pull-request_

# Important points

1. **Tests are not in the PR as they were written in PhpSpec & Behat.** If we decide to go forward with this approach, I'll translate them to PHPUnit.
2. The aim is not to solve all the message/queuing problems but provide a good, simple and extensible message bus for developers.
3. The communication with the actual AMQP/API brokers is down to the adapters for now. Not sure if we need to ship some by default or not 🤔

I guess that this would replace #23842 & #23315.

# Changes from the proposals

Based on the comments, a few changes have been made from the proposal.

1. `MessageProducer`s have been renamed to `MessageSender`s
2. `MessageConsumer`s have been renamed to `MessageReceiver`s

Commits
-------

c9cfda9 [Messenger] Add a new Messenger component
@fabpot
Copy link
Member

fabpot commented Mar 23, 2018

Should be updated as the component is now named Messenger.

@sroze
Copy link
Contributor Author

sroze commented Mar 23, 2018

Yep. I'll go through the PR and re-phrase a bunch of things this weekend.

@javiereguiluz javiereguiluz removed the Waiting Code Merge Docs for features pending to be merged label Mar 23, 2018
@javiereguiluz javiereguiluz changed the title Symfony Message component documentation Symfony Messenger component documentation Mar 23, 2018
wiese and others added 2 commits March 23, 2018 11:22
=====================

The Message component helps application to send and receive messages
to/from other applications or via
Copy link
Member

Choose a reason for hiding this comment

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

This phrase looks unfinished. Also, it's not a very descriptive description. Should we mention at least "message bus" or some key concept so the readers know undoubtely what problem does this component solve? Thanks!


$ composer require symfony/message

Alternatively, you can clone the `<https://github.com/symfony/message>`_ repository.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be https://github.com/symfony/messenger.


.. code-block:: terminal

$ composer require symfony/message
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be symfony/messenger conform the composer.json.

libraries for now. You can use one of the following adapters:

#. `PHP Enqueue bridge`_ to use one of their 10+ compatible queues such as
RabbitMq, Amazon SQS or Google Pub/Sub.
Copy link
Contributor

Choose a reason for hiding this comment

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

RabbitMq -> RabbitMQ

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To allow us to receive and send messages on the same bus and prevent a loop, the
message bus is equipped with the ``WrapIntoReceivedMessage`` received. It will
Copy link
Contributor

@greg0ire greg0ire Mar 24, 2018

Choose a reason for hiding this comment

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

I'm having a hard time parsing this sentence, especially the last word 😕 . Either it should be a noun, or it should be "the received/obtained WrapIntoReceivedMessage object"

A consumer is responsible for receiving messages from a source and dispatching
them to the application.

Let's say you already proceed some "orders" on your application using a
Copy link
Contributor

Choose a reason for hiding this comment

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

processed != proceed

Copy link
Contributor

Choose a reason for hiding this comment

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

"in" your application?

orders.

You will read this CSV file and dispatch a ``NewOrder`` message. All you need to
do is your custom CSV consumer and Symfony will do the rest.
Copy link
Contributor

@greg0ire greg0ire Mar 24, 2018

Choose a reason for hiding this comment

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

"to do" => "to do is create your…" or "to write is your…"

Copy link
Contributor

Choose a reason for hiding this comment

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

consumer -> receiver?


use App\Message\MyMessage;

$result = $this->get('message_bus')->handle(new MyMessage(/* ... */));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use DI to get the message_bus service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an example of constructing it manually.

.. code-block:: xml

<service id="App\Handler\MyMessageHandler">
<tag name="message_handler" />
Copy link
Contributor

Choose a reason for hiding this comment

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

}
}

.. code-block:: xml
Copy link
Contributor

Choose a reason for hiding this comment

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

you should add yaml config format, too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has to be moved within the FrameworkBundle's documentation actually.

.. code-block:: yaml

framework:
message:
Copy link
Contributor

Choose a reason for hiding this comment

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

messenger here and below

Asynchronous messages
~~~~~~~~~~~~~~~~~~~~~

Using the Message Component is useful to decouple your application but it also
Copy link
Contributor

@andreybolonin andreybolonin Mar 26, 2018

Choose a reason for hiding this comment

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

Using the Messenger Component

Copy link
Contributor

Choose a reason for hiding this comment

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

Messenger

Concepts
--------

.. image:: /_images/components/message/overview.png
Copy link
Contributor

@andreybolonin andreybolonin Mar 26, 2018

Choose a reason for hiding this comment

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

image:: /_images/components/messenger/overview.png

Copy link
Contributor

Choose a reason for hiding this comment

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

messenger

.. code-block:: yaml

framework:
message:
Copy link
Contributor

@andreybolonin andreybolonin Mar 26, 2018

Choose a reason for hiding this comment

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

messenger:

Copy link
Contributor

Choose a reason for hiding this comment

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

messenger

.. code-block:: yaml

framework:
message:
Copy link
Contributor

@andreybolonin andreybolonin Mar 26, 2018

Choose a reason for hiding this comment

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

messenger:

Copy link
Contributor

Choose a reason for hiding this comment

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

messenger

.. note::

If the message cannot be guessed from the handler's type-hint, use the
``handles`` attribute on the tag.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think best would be an example. Also mention that the guessing is done on the _invoke method argument

arguments:
- "@serializer"
- "%new_orders_csv_file_path%"

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove blank line here

@sroze
Copy link
Contributor Author

sroze commented Mar 27, 2018

Updated based on feedbacks, split the two documentations (i.e. as a "topic" and as a "component") and added more details. And Travis is green 🎉.

Can I have the honor of another round of reviews?


.. code-block:: xml

<service id="App\MessageHandler\MyMessageHandler">
Copy link
Member

Choose a reason for hiding this comment

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

To be consistent with other parts of Symfony, could we define an interface for Message Handlers so they can be autoconfigured?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is proposed in the following PR: symfony/symfony#26685. Though, it's controversial :)

messenger.rst Outdated
{
public function indexAction(MessageBusInterface $bus)
{
$bus->dispatch(new MyMessage());
Copy link
Member

Choose a reason for hiding this comment

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

Could we use a more realistic example? Which is the simplest possible example where you can see the utility of messages and message bus? Also, can I store data inside a message class?

messenger.rst Outdated
framework:
messenger:
adapters:
default: "%env(MESSENGER_DSN)%"
Copy link
Member

Choose a reason for hiding this comment

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

Here the env var is called MESSENGER_DSN but below is AMQP_DSN

messenger.rst Outdated
This is enough to allow you to route your message to the :code:`messenger.default_adapter`
adapter. This will also configure the following for you:

1. A :code:`messenger.default_sender` sender to be used when routing messages
Copy link
Member

Choose a reason for hiding this comment

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

This syntax:

:code:`...`

should be transformed to this:

``...``

in the whole article. Thanks!

messenger.rst Outdated
routing:
'My\Message\Message': messenger.default_sender # Or another sender service name

Such configuration would only route the ``MessageAboutDoingOperationalWork``
Copy link
Member

Choose a reason for hiding this comment

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

This paragraph mentions MessageAboutDoingOperationalWork ... but that's not used in the previous config example but in the next one.

The bus is used to dispatch messages. The behaviour of the bus is in its ordered
middleware stack. The component comes with a set of middlewares that you can use.

When using the message bus with Symfony's FrameworkBundle, the following middlewares
Copy link
Member

Choose a reason for hiding this comment

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

middleware is uncountable in English, so no plural for it :)

messenger.rst Outdated
}
}

The :code:`YourAdaper` class need to implements the :code:`AdapterInterface`. It
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here implements should be without s

messenger.rst Outdated

Instead of calling a handler, you have the option to route your message(s) to a
sender. Part of an adapter, it is responsible of sending your message somewhere.
You can configuration which message is routed to which sender with the following
Copy link
Member

Choose a reason for hiding this comment

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

typo configure?

@sroze
Copy link
Contributor Author

sroze commented Mar 29, 2018

Ready for another round of reviews 👍

Copy link

@boite boite left a comment

Choose a reason for hiding this comment

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

Partial review. Hope it helps.

The Messenger Component
=======================

The Messenger component helps applications send and receive messages to/from other applications or via message queues.
Copy link

Choose a reason for hiding this comment

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

-    The Messenger component helps applications send and receive messages to/from other applications or via message queues.
+    The Messenger component helps applications send messages to and receive messages from other applications and via message queues.

.. image:: /_images/components/messenger/overview.png

**Sender**:
Responsible for serializing and sending the message to _something_. This
Copy link

Choose a reason for hiding this comment

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

-   Responsible for serializing and sending the message to _something_. This
+   Responsible for serializing and sending messages to _something_. This

something can be a message broker or a third party API for example.

**Receiver**:
Responsible for deserializing and forwarding the messages to handler(s). This
Copy link

Choose a reason for hiding this comment

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

-   Responsible for deserializing and forwarding the messages to handler(s). This
+   Responsible for deserializing and forwarding messages to handler(s). This


**Handler**:
Given a received message, contains the user business logic related to the
message. In practice, that is just a PHP callable.
Copy link

Choose a reason for hiding this comment

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

How about:-

Responsible for handling messages using the business logic applicable to the messages.

The part about PHP callable is confusing, explained better in the Handlers section, below and I think it should be omitted here.


.. note:

Every middleware need to implement the ``MiddlewareInterface`` interface.
Copy link

Choose a reason for hiding this comment

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

need -> needs
or
need to -> must

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 :)

Once dispatched to the bus, messages will be handled by a "message handler". A
message handler is a PHP callable (i.e. a function or an instance of a class)
that will do the required processing for your message. It _might_ return a
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?

--------

The communication with queuing system or third parties is delegated to
libraries for now.
Copy link

Choose a reason for hiding this comment

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

It isn't at all clear what this means or what are the implications for someone who intends to communicate with a queuing system or third party. Also system -> systems. And drop "for now" unless you want to say something about what will happen in the future.

}
}

Same bus received and sender
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize.

messenger.rst Outdated
}
}

Register your factory
Copy link
Member

Choose a reason for hiding this comment

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

s/f/F/

$this->filePath = $filePath;
}

public function receive() : \Generator
Copy link
Member

@yceruto yceruto Mar 29, 2018

Choose a reason for hiding this comment

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

iterable according to the interface?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's compatible

Copy link

@boite boite left a comment

Choose a reason for hiding this comment

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

Good docs! Have managed to follow some and use the message bus and a message handler. :)

messenger.rst Outdated

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Messenger\MessageBusInterface;

Copy link

Choose a reason for hiding this comment

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

Please add something like use App\Message\SendNotification; to make clear that SendNotification is not provided by the messenger component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added 👍

Using the Messenger Service
---------------------------

Once enabled, the ``message_bus`` service can be injected in any service where
Copy link

Choose a reason for hiding this comment

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

Will the following be enough to enable it?

# config/packages/framework.yml
framework:
    messenger: ~

And what exactly is being enabled here - is it the message_bus service (as the sentence seems to indicate) or is it the Messenger Component?

messenger.rst Outdated
-------

Instead of calling a handler, you have the option to route your message(s) to a
sender. Part of an adapter, it is responsible of sending your message somewhere.
Copy link

Choose a reason for hiding this comment

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

of sending -> for sending

messenger.rst Outdated
'My\Message\Message': messenger.default_sender # Or another sender service name

Such configuration would only route the ``My\Message\Message`` message to be
asynchronous, the rest of the messages would still be directly handled.
Copy link

Choose a reason for hiding this comment

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

Instead of two sentences, one before the config example and one after, how about just one:-

"The following configuration shows how you can route a class of messages to a sender, leaving other classes of messages to be passed to their respective handlers."

Copy link

Choose a reason for hiding this comment

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

Also, routing to messenger.default_sender seems to be wrong:-

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 32:
                                                                               
  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]   
  The service "messenger.asynchronous.middleware.send_message_to_producer" ha  
  s a dependency on a non-existent service "messenger.default_sender".

It should be messenger.sender.default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's less clear with a single example IMHO. I've updated the sender configuration 👍

messenger.rst Outdated
messenger:
routing:
'My\Message\MessageAboutDoingOperationalWork': messenger.operations_sender
'*': messenger.default_sender
Copy link

Choose a reason for hiding this comment

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

"You can route all classes of message to a sender using an asterisk instead of a class name:"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, nice call. Updated 👍

messenger.rst Outdated
Registering your middleware
---------------------------

The message bus is based on a set of middleware. If you are un-familiar with the concept,
Copy link

Choose a reason for hiding this comment

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

un-familiar -> unfamiliar

messenger.rst Outdated

.. code-block:: xml

<service id="Your\Own\Middleware">
Copy link

Choose a reason for hiding this comment

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

How about App\Middleware.

messenger.rst Outdated
Your own Adapters
-----------------

Learn how to build your own adapters within the Component's documentation. Once
Copy link

Choose a reason for hiding this comment

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

Learn how to build your own adapters within the Component's documentation.

It is unclear what is meant by this!

messenger.rst Outdated

Learn how to build your own adapters within the Component's documentation. Once
you have built your classes, you can register your adapter factory to be able to
use it via a DSN in the Symfony application.
Copy link

Choose a reason for hiding this comment

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

Where can I read about how to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the "Use your adapter" section :)

messenger.rst Outdated
}

The ``YourAdaper`` class need to implement the ``AdapterInterface``. It
will like the following example::
Copy link

Choose a reason for hiding this comment

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

need -> needs

or

need to -> must

and

It will be like

or

It will look like


**Sender**:
Responsible for serializing and sending the message to _something_. This
something can be a message broker or a third party API for example.
Copy link
Contributor

Choose a reason for hiding this comment

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

a messager handler, broker or a third-party API.

Reasons:

  • The current phrasing kinda implies the component is very queue oriented. It's not wrong but it's not limited to this use case
  • Using it with a message handler is a case common enough to be mentioned IMO
  • I'm not sure all the people are familiar with queues and its related vocabulary so putting message handler which is likely to be more commonly known will make it more accessible

--------

Once dispatched to the bus, messages will be handled by a "message handler". A
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.

sroze added a commit to symfony/symfony that referenced this pull request Apr 9, 2018
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Messenger] Rename the middleware tag

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ø
| License       | MIT
| Doc PR        | symfony/symfony-docs#9437

After a using it for a bit of time, it's weird to have the `messenger.message_handler` tag while using the `message_bus_middleware` tag for the middlewares.

I propose to rename the tag from `message_bus_middleware` to `messenger.bus_middleware` to keep some consistency.

Commits
-------

dd18445 Rename the middleware tag from `message_bus_middleware` to `messenger.bus_middleware`
messenger.rst Outdated
adapter. This will also configure the following for you:

1. A ``messenger.default_sender`` sender to be used when routing messages
2. A ``messenger.default_receiver`` receiver to be used when consuming messages.
Copy link

@boite boite Apr 12, 2018

Choose a reason for hiding this comment

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

These should be messenger.sender.default and messenger.receiver.default (there are numerous occurrences that need to be changed).

@sroze
Copy link
Contributor Author

sroze commented Apr 12, 2018

It's ready to be merged. Tweaks can follow in other PRs I suppose.

messenger.rst Outdated
'My\Message\MessageAboutDoingOperationalWork': another_adapter
'*': amqp

A class of message can also be routed to a multiple senders by specifying a list:
Copy link

Choose a reason for hiding this comment

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

- A class of message can also be routed to a multiple senders by specifying a list:
+ A class of message can also be routed to multiple senders by specifying a list:

@sroze
Copy link
Contributor Author

sroze commented Apr 15, 2018

@boite thank you very much for all your reviews, much appreciated! I've updated the wording of the sentence you highlighted in your last review.

@boite
Copy link

boite commented Apr 16, 2018

Well done @sroze; this all looks good.

@javiereguiluz
Copy link
Member

Let's merge this because, otherwise, this would be one of those eternal pull requests that never get merged. We can improve contents later as needed. Thanks Samuel for your contribution and thanks to the community for the reviews!

@javiereguiluz javiereguiluz merged commit c5306b8 into symfony:master Apr 16, 2018
javiereguiluz added a commit that referenced this pull request Apr 16, 2018
…guiluz, wiese)

This PR was merged into the master branch.

Discussion
----------

Symfony Messenger component documentation

This pull-request adds some documentation for the Messenger component. As it is, it's extracted from the README built incrementally in the code pull-request.

I'm sure there will be lots to change when the implementation is merged :)

Commits
-------

c5306b8 Minor wording change
32403ea Update the documentation to reflect the latest changes
3fb973c Update based on comments
509e149 Add a documentation about middlewares and update based on reviews
fb88abc Add Messenger in the topics
a15752b Fix unresolved reference
25c0b6e It helps multiple applications  Please enter the commit message for your changes. Lines starting
bcfae23 Finish the documentation about the custom adapter
2493c90 Update typos and missing reference
31a56ee Uses `::` to display as code blocks
5c828e4 Update the documentation a bit, and add more FrameworkBundle documentation
88ba8fe Merge pull request #1 from wiese/patch-3
b26de80 minor doc fixes for the Message component
b40bc71 Fixed the RST syntax issues
585491d Move the documentation from the main PR to RST format.
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.