rmsundar / rabbit-mq-priority
用于 rabbitmq 优先队列的示例模块
dev-main
2021-07-25 09:08 UTC
Requires
- magento/framework: 103.0.*
- magento/framework-message-queue: ~100.4.2
This package is not auto-updated.
Last update: 2024-09-24 08:30:18 UTC
README
示例模块,用于展示 rabbitMq 优先队列和其他队列参数
Magento 在 2.4.2 版本中解决了在创建队列和交换时允许 rabbitmq 队列和交换参数的 bug。
向队列传递参数的示例代码
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd"> <exchange name="magento" type="topic" connection="amqp"> <binding id="sample.priority" topic="sample.priority.topic" destinationType="queue" destination="sample.priority"> <arguments> <argument name="x-max-priority" xsi:type="number">10</argument> </arguments> </binding> </exchange> </config>
Magento OOTB 不支持向消息属性传递额外参数。
本模块具有自定义发布者,允许在向交换发布消息时传递额外属性
请参考以下类以发布带属性的消息
- https://github.com/rmsundar1/magento-rabbitmq-priority-queue/blob/main/Model/PriorityConsumer.php
-
magento-rabbitmq-priority-queue/Console/Command/PriorityMessage.php
在第 53 行 9e37bb8
protected function execute(InputInterface $input, OutputInterface $output): void