Homepage
Main navigation
Main content
Additional information
Login / Sign up
Quality Guidelines
Propose new content
Shopware resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
When using RabbitMQ (see references for setup guide) for Shopware it can be a good idea to use multiple queues for dedicated purposes. A good use case would be a dedicated queue for your integrations which often need to update thousands of entities several times a day. If you use the default queue for this, standard Shopware jobs such as indexing, cache warming, feed generation, etc. can get "stuck" behind thousands of integration messages. **Define Your Custom Queues** Add this to your config/packages/messenger.yaml file: ``` framework: messenger: transports: [...] # Custom queue definition [...] ``` Example: ``` framework: messenger: transports: wexo_integration: dsn: '%env(AMQP_URL)%' options: exchange: name: wexo_integration type: topic default_publish_routing_key: wexo_integration queues: wexo_integration: binding_keys: [wexo_integration] ``` The above example with create a queue named *wexo_integration* as an additonal queue to the default *messages* queue. You can define as many custom queues as you wish (see full example below). **Route Messages to the Custom Queues** In order to use the newly created queues you must explicitly define which messages should use which queues. This is done in the same config/packages/messenger.yaml file with the routing setting: ``` framework: messenger: transports: [...] routing: # <your-message-class>: <your-queue-name> 'Wexo\Integration\Core\Content\IntegrationProduct\IntegrationProductEntity': [wexo_integration] ``` **Consuming From the Custom Queues** When multiple queues exist the messenger consume command will ask you which one to consume from: ![See custom queues](https://cdn.shopwaretricks.com/examples/custom_queue_consume_example.png) You can consume from a specific queue directly: ``` php bin/console messenger:consume <queue> # Example: php bin/console messenger:consume wexo_integration ``` **Full Example with Multiple Custom Queues** ``` framework: messenger: transports: wexo_integration: dsn: '%env(AMQP_URL)%' options: exchange: name: wexo_integration type: topic default_publish_routing_key: wexo_integration queues: wexo_integration: binding_keys: [wexo_integration] wexo_discount_labels: dsn: '%env(AMQP_URL)%' options: exchange: name: wexo_discount_labels type: topic default_publish_routing_key: wexo_discount_labels queues: wexo_discount_labels: binding_keys: [wexo_discount_labels] routing: 'Wexo\BusinessCentralOverride\Core\Content\IntegrationOrderStatus\IntegrationOrderStatusEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationDiscount\IntegrationDiscountEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationOrder\IntegrationOrderEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationPrice\IntegrationPriceEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationProduct\IntegrationProductEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationProfile\IntegrationProfileEntity': [wexo_integration] 'Wexo\Integration\Core\Content\IntegrationPromotion\IntegrationPromotionEntity': [wexo_integration] 'Wexo\ProductLabels\Component\ProductLabelsProductEntity': [wexo_discounts_labels] ```
References
Add additional online resources to your trick
×
Name
URL
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Frontend
Administration
Performance
Indexing
SEO
Database
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline