Get Free Audit

Magento 2 Module To Use Amazon SQS

Sep 19, 2017

3618 Artsem Miklashevich

Magento 2 Module To Use Amazon SQS

Magento 2 is distinguished by the number of features Magento 1 feels lack. One of the examples is Queues which allow executing time and resource-consuming tasks such as product import, stocks management, API interfaces, indexation asynchronously. Magento 2 box version provides interfaces for accessing AMQP and MySQL queues.  As for MySQL, the queues are based on the cron job tasks. This solution performs great for middle-size websites. But there’s an issue concerning high-load projects, as cron job can not manage all scheduled tasks during one iteration. In such a way, the queue can become a potential source of serious bugs.

Our investigations showed that RabbitMQ can be considered as the way out. RabbitMQ service can be connected to Magento 2 by creating a separate module with the queue.xml file, that defines the Queue connection attribute type=”amqp” in it. This workflow gives us access to all Queue functions and allows us to expand default functionality with additional features.

The only real problem you can face while using RabbitMQ is that not every hosting company is eager to install RabbitMQ service by your request. You can setup everything yourself, but it’s not convenient and requires much effort and administrative knowledge.  

Let’s suppose Amazon doesn’t provide queues service on RabbitMQ, but it has its own queues service – SQS. The service is simpler than RabbitMQ and doesn’t have additional options. But in most cases, all these extra options are not necessary. As a rule, you need the queue to send messages. SQS has obvious benefit if compared with RabbitMQ. In Amazon ecosystem SQS is available everywhere and doesn’t need to be installed separately. After weighing all the pros and cons, we decided to create a separate module which allows using Amazon SQS service with Magento 2 Queues with ease. You can download the module via packagist.

Now let’s consider how to install the module. In order to connect the module, in the file  app/etc/env.php in the section “queues”, you need to enter credentials in the following format:

Then in the file <module_path>/etc/queue.xml  you need to update connection type into SQS.

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor

Now it’s configured. The rest of it is described in the documents. The only thing you should pay attention to is to specify topology module dependency (belvg/module-sqs) in the setup file when installing the module. Here is the example:

P.S. The module was tested on Magento 2.1.3-2.1.7 EE. Any bugs can be submitted to the repository

Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor


  1. Hi, Denis Yurevich!
    Thanks for your comment! You are absolutely right. We will update the article in the nearest time.

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *