Type
magento2-module
Magento 2 Message Queue OS Module
magento2-module
OSL-3.0
None
None
None
None
Lightweight implementation of message queue for Magento 2 Community Edition.
This extension supports the following versions of Magento:
$ composer require renatocason/magento2-module-mq
$ bin/magento module:enable Rcason_Mq
$ bin/magento setup:upgrade
$ bin/magento ce_mq:queues:list
$ bin/magento ce_mq:consumers:start product.updates
This module does not include any message queue backend implementation. You will have to chose and install one of the following modules (or implement your own) in order to get your message queues working: * MqMysql - Stores messages in the database * MqAmqp - Integrates any AMQP queue manager (i.e. RabbitMQ) * Amazon SQS - Integrates Amazon SQS as a queue manager (work in progress)
A simple example can be found here.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Rcason_Mq:etc/ce_mq.xsd">
<ceQueue name="product.updates" broker="mysql"
messageSchema="int"
consumerInterface="Rcason\MqExample\Model\ExampleConsumer"/>
</config>
/**
* @param \Rcason\Mq\Api\PublisherInterface $publisher
*/
public function __construct(
\Rcason\Mq\Api\PublisherInterface $publisher
) {
$this->publisher = $publisher;
}
$this->publisher->publish('product.updates', $productId);
class ExampleConsumer implements \Rcason\Mq\Api\ConsumerInterface
{
/**
* {@inheritdoc}
*/
public function process($productId)
{
// Your code here
}
}
Author: - Renato Cason
Contributions: - grafikchaos - jonathan-martz - antoninobonumore - For a full list of contributors visit Magento 2 Message Queue Module on GitHub
Licensed under the Open Software License version 3.0