Skip to content

[Messenger] Update the messenger documentation #9727

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 11 commits into from
May 9, 2018

Conversation

sroze
Copy link
Contributor

@sroze sroze commented May 3, 2018

@yceruto
Copy link
Member

yceruto commented May 3, 2018

This is enough to allow you to route your message to the amqp.

What about to add a note block before that about install/enable the Serializer component, to make AMQP transport available?

@ogizanagi
Copy link
Contributor

ogizanagi commented May 7, 2018

Some more entries to add to the list :)

  1. Now that [Messenger] Support configuring messages when dispatching symfony#26945 is merged, examples should be updated to reflect the new Envelope usage (SenderInterface::send(Envelope $envelope) and receivers's handler (function (?Envelope $envelope) instead of function ($message)).
  2. We can mention the EnvelopeAwareInterface, how to write items and how to benefit from it in custom middlewares (+ mention existing items)
  3. middlewares config entry is renamed middleware (Rename middlewares to middleware symfony#27177)
  4. in the config, message buses names are the full service id you'll use ([FrameworkBundle][Messenger] Remove convention-based service id generation for buses symfony#27162)

messenger.rst Outdated

# Create buses
buses:
commands: ~
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be the full service name (and remove the note bellow)

messenger.rst Outdated

use Symfony\Component\Messenger\AbstractMessageBusDecorator;

final class CommandBus extends AbstractMessageBusDecorator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recommend binding the message bus variable name instead

@sroze
Copy link
Contributor Author

sroze commented May 8, 2018

Now that symfony/symfony#26945 is merged, examples should be updated to reflect the new Envelope usage (SenderInterface::send(Envelope $envelope) and receivers's handler (function (?Envelope $envelope) instead of function ($message)).
We can mention the EnvelopeAwareInterface, how to write items and how to benefit from it in custom middlewares (+ mention existing items)

@ogizanagi could you send a PR for that? Has it's not been merged yet, I'd prefer to move it out of the scope of this PR.

@ogizanagi
Copy link
Contributor

Sure I'll do once this one is merged.

@sroze
Copy link
Contributor Author

sroze commented May 8, 2018

@javiereguiluz @weaverryan could you have a look at this one? 🙏

messenger.rst Outdated
buses:
messenger.bus.default:
middleware:
# Works with the FQCN if the class discovery is enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Or if you just name your service after the FQCN manually. No need to mention this IMHO. It's still a service id. ^^

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 removed the use of the .-based service actually.

messenger.rst Outdated
# Or with some service name
- app.middleware.yours

Note that if the service is abstract, then a child service will be created per bus.
Copy link
Contributor

Choose a reason for hiding this comment

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

then a different instance of service will be created per bus.? (more concrete for the user I think)

@sroze sroze force-pushed the revamp-the-messenger-documentation branch from 41bebe5 to 3ffc785 Compare May 8, 2018 20:29
@sroze sroze changed the title [Messenger] Revamp the messenger documentation [Messenger] Update the messenger documentation May 8, 2018
messenger.rst Outdated
@@ -107,11 +107,20 @@ configure the following services for you:
1. A ``messenger.sender.amqp`` sender to be used when routing messages.
2. A ``messenger.receiver.amqp`` receiver to be used when consuming messages.

.. note::

In order to use Symfony's built-in AMQP adapter, you will need the Serializer
Copy link
Member

Choose a reason for hiding this comment

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

AMQP transport?

messenger.rst Outdated
messenger.bus.default:
middleware:
- "App\\Middleware\\MyMiddleware"
- "App\\Middleware\\AnotherMiddleware"
Copy link
Member

@yceruto yceruto May 8, 2018

Choose a reason for hiding this comment

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

single quote and single backslash to be concistent?

@weaverryan weaverryan changed the base branch from master to 4.1 May 9, 2018 14:07
@weaverryan weaverryan force-pushed the revamp-the-messenger-documentation branch from bfa508b to c3c3528 Compare May 9, 2018 14:07
@weaverryan
Copy link
Member

Thank you @sroze!

@weaverryan weaverryan merged commit c3c3528 into symfony:4.1 May 9, 2018
weaverryan added a commit that referenced this pull request May 9, 2018
This PR was submitted for the master branch but it was squashed and merged into the 4.1 branch instead (closes #9727).

Discussion
----------

[Messenger] Update the messenger documentation

- [x] Fixes #9641 with the middleware configuration.
- [x] Fixes #9617 with the multiple bus configuration.
- [x] Change adapters to transports (waiting merge: symfony/symfony#27129)
- [x] middlewares config entry is renamed middleware (symfony/symfony#27177)
- [x] in the config, message buses names are the full service id you'll use (symfony/symfony#27162)
- [x] Add TransportInterface as first class citizen sender+receiver (symfony/symfony#27164)

Commits
-------

c3c3528 Few updates following review
64bfd75 Change wording and don't use `.`-based services so it's just clearer
e1f3b5a Fix the formating of the method name
9b7b85f Update the example of using multiple buses to use DI's `bind`s
c76b2c2 Uses the full service name when configuring the buses from the YAML configuration
2409798 Middleware does not have a plural
a20286d Add a note about the symfony serializer pack
10f46eb Introduce the `TransportInterface`
ef70bc0 Add a documentation about the middlewares
3ff8cfe Add multiple buses configuration and type-hint example
a4bc592 Rename the adapters to transport
@sroze sroze deleted the revamp-the-messenger-documentation branch May 9, 2018 14:10
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.

5 participants