Skip to content
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

NEXT-39755 - Update messenger docs to use default symfony bus #1584

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion concepts/framework/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Shopware integrates with the [Symfony Messenger](https://symfony.com/doc/current

### Message Bus

The [Message bus](https://symfony.com/doc/current/components/messenger.html#bus) is used to dispatch your messages to your registered handlers. While dispatching your message it loops through the configured middleware for that bus. The message bus used inside Shopware can be found under the service tag `messenger.bus.shopware`. It is mandatory to use this message bus if your messages should be handled inside Shopware. However, if you want to send messages to external systems, you can define your custom message bus for that.
The [Message bus](https://symfony.com/doc/current/components/messenger.html#bus) is used to dispatch your messages to your registered handlers. While dispatching your message it loops through the configured middleware for that bus. The message bus used inside Shopware can be found under the service tag `messenger.default_bus`. It is mandatory to use this message bus if your messages should be handled inside Shopware. However, if you want to send messages to external systems, you can define your custom message bus for that.

### Middleware

Expand Down
6 changes: 3 additions & 3 deletions guides/hosting/infrastructure/message-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@

### Message bus

The message bus is used to dispatch your messages to your registered handlers. While dispatching your message, it loops through the configured middleware for that bus. The message bus used inside Shopware can be found under the service tag `messenger.bus.shopware`. It is mandatory to use this message bus if your messages should be handled inside Shopware. However, if you want to send messages to external systems, you can define your custom message bus for that.
The message bus is used to dispatch your messages to your registered handlers. While dispatching your message, it loops through the configured middleware for that bus. The message bus used inside Shopware can be found under the service tag `messenger.bus.default`. It is mandatory to use this message bus if your messages should be handled inside Shopware. However, if you want to send messages to external systems, you can define your custom message bus for that.

You can configure an array of buses and define one default bus in your `framework.yaml`.

```yaml
// <platform root>/src/Core/Framework/Resources/config/packages/framework.yaml
framework:
messenger:
default_bus: messenger.bus.shopware
default_bus: my.messenger.bus

Check warning on line 174 in guides/hosting/infrastructure/message-queue.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/hosting/infrastructure/message-queue.md#L174

You’ve repeated a verb. Did you mean to only write one of them? (REPEATED_VERBS[1]) Suggestions: `bus`, `buses` Rule: https://community.languagetool.org/rule/show/REPEATED_VERBS?lang=en-US&subId=1 Category: GRAMMAR
Raw output
guides/hosting/infrastructure/message-queue.md:174:34: You’ve repeated a verb. Did you mean to only write one of them? (REPEATED_VERBS[1])
 Suggestions: `bus`, `buses`
 Rule: https://community.languagetool.org/rule/show/REPEATED_VERBS?lang=en-US&subId=1
 Category: GRAMMAR
buses:
messenger.bus.shopware:
my.messenger.bus:
```

For more information on this check the [Symfony docs](https://symfony.com/doc/current/messenger/multiple_buses.html).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SmsNotification implements AsyncMessageInterface

## Send a message

After we've created our notification, we will create a service that will send our `SmsNotification`. We will name this service `ExampleSender`. In this service we need to inject the `Symfony\Component\Messenger\MessageBusInterface`, that is needed to send the message through the desired bus, which is called `messenger.bus.shopware`.
After we've created our notification, we will create a service that will send our `SmsNotification`. We will name this service `ExampleSender`. In this service we need to inject the `Symfony\Component\Messenger\MessageBusInterface`, that is needed to send the message through the desired bus, which is called `messenger.default_bus`.

```php
// <plugin root>/src/Service/ExampleSender.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ For each defined bus in our `framework.yaml`, we can define the middleware that
// <platform root>/src/Core/Framework/Resources/config/packages/framework.yaml
framework:
messenger:
default_bus: messenger.bus.shopware
buses:
messenger.bus.default:
middleware:
- 'Swag\BasicExample\MessageQueue\Middleware\ExampleMiddleware'
- 'Swag\BasicExample\MessageQueue\Middleware\AnotherExampleMiddleware'
messenger.bus.default:
middleware:
- 'Swag\BasicExample\MessageQueue\Middleware\ExampleMiddleware'
- 'Swag\BasicExample\MessageQueue\Middleware\AnotherExampleMiddleware'
```

## More interesting topics
Expand Down
Loading