Skip to content



Shopware integrates with the Symfony Messenger component and Enqueue. This gives you the possibility to send and handle asynchronous messages.


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.


A Middleware is called when the message bus dispatches messages. It defines what happens when you dispatch a message. For example, the send\_message middleware is responsible for sending your message to the configured Transport, and the handle_message middleware will actually call your handlers for the given message. You can add your own middleware by implementing the MiddlewareInterface and adding that middleware to the message bus through configuration.


A Handler gets called once the message is dispatched by the handle_messages middleware. Handlers do the actual processing of the message. Therefore they must extend the AbstractMessageHandlerclass and implement the handle() method. To register a handler, you have to tag it with the messenger.message_handler tag. To specify which methods should be handled by a given handler, implement the static getHandledMessages() method and return the MessageClasses which that handler should handle. You can also define multiple handlers for the same message.


A Message is a simple PHP class you want to dispatch over the MessageQueue. It must be serializable and should contain all the necessary information that a handler needs to process the message.


A message will be wrapped in an Envelope by the message bus that dispatches the message.


While the message bus is processing the message through its middleware, it adds Stamps to the envelope that contain metadata about the message. If you need to add metadata or configuration to your message, you can either wrap your message in an envelope and add the necessary stamps before dispatching your message or create your own custom middleware.


A Transport is responsible for communicating with your 3rd party message broker. You can configure multiple Transports and route messages to multiple or different Transports. Supported are all Transports that are either supported by Symfony itself or by Enqueue. If you don't configure a Transport, messages will be processed synchronously, like in the Symfony event system.

Sending Messages

To send messages, the Shopware messenger bus is used, which can be injected through DI and populated with metadata. Optionally, there is also a message bus for sensitive data that offers encryption.

Consuming Messages

Consuming messages can be done via both a Console command and via an API endpoint. The console command starts a worker that will receive incoming messages from your Transport and dispatch them. The API can be communicated via a POST, which will consume messages for 2 seconds, and then you get the count of the handled messages in the response.