Configuring Messenger
If your Sylius project uses asynchronous Messenger transport by default, you must ensure that all Wishlist-related commands are executed synchronously.
This is necessary because the Wishlist plugin performs immediate operations (such as creating or updating wishlists) that must take effect instantly - not via delayed message queues.
Configuration
To make all Wishlist commands synchronous, configure the WishlistSyncCommandInterface
to use the sync transport.
Add or update the following in your config/packages/messenger.yaml
file:
# config/packages/messenger.yaml
framework:
messenger:
transports:
sync: 'sync://'
routing:
'Sylius\WishlistPlugin\Command\Wishlist\WishlistSyncCommandInterface': sync
Explanation
The
sync://
transport ensures that messages are handled immediately in the same process.All commands from the Wishlist plugin implement the
Sylius\WishlistPlugin\Command\Wishlist\WishlistSyncCommandInterface
interface.Therefore, no additional routing configuration is required - this single rule covers all commands in the plugin.
Result
After applying this configuration:
All Wishlist operations (adding items, removing items, clearing the wishlist, etc.) will be executed synchronously.
Your asynchronous transports (e.g., RabbitMQ, Doctrine, Redis) will continue to handle other background messages normally.
Last updated
Was this helpful?