{"id":14278,"date":"2017-09-19T17:51:35","date_gmt":"2017-09-19T14:51:35","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=14278"},"modified":"2019-03-19T10:32:49","modified_gmt":"2019-03-19T08:32:49","slug":"module-to-use-amazon-sqs-queues","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html","title":{"rendered":"Magento 2 Module To Use Amazon SQS"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">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<\/span> <span style=\"font-weight: 400;\">asynchronously. <!--more-->Magento 2 box version provides interfaces for accessing AMQP and MySQL queues. &#160;As for MySQL, the queues are based on the cron job tasks. This solution performs great for middle-size websites. But there&#8217;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. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">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=&#8221;amqp&#8221; in it. This workflow gives us access to all Queue functions and allows us to expand default functionality with additional features. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">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&#8217;s not convenient and requires much effort and administrative knowledge. &#160;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s suppose Amazon doesn&#8217;t provide queues service on RabbitMQ, but it has its own queues service &#8211; SQS. The service is simpler than RabbitMQ and doesn&#8217;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&#8217;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 <\/span><span style=\"font-weight: 400;\"><a href=\"https:\/\/packagist.org\/packages\/belvg\/module-sqs\">packagist<\/a>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now let&#8217;s consider how to install the module. In order to connect the module, in the file &#160;app\/etc\/env.php in the section &#8220;queues&#8221;, you need to enter credentials in the following format:<\/span><\/p>\n<pre class=\"lang:php decode:true\">'queue' =&gt;\r\narray (\r\n'sqs' =&gt;\r\narray (\r\n&#160;&#160;'region' =&gt; '',\r\n&#160;&#160;'version' =&gt; '',\r\n&#160;&#160;'access_key' =&gt; '',\r\n&#160;&#160;'secret_key' =&gt; '',\r\n)\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Then in the file <strong>&lt;module_path&gt;\/etc\/queue.xml<\/strong> &#160;you need to update connection type into SQS. <\/span><\/p>\n<pre class=\"lang:php decode:true\">&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc\/queue.xsd\"&gt;\r\n&#160;&#160;&lt;broker topic=\"name.topic\" type=\"sqs\" exchange=\"magento\"&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&lt;queue consumer=\"consumerName\" name=\"queue.name\"\/&gt;\r\n&#160;&#160;&lt;\/broker&gt;\r\n&lt;\/config&gt;<\/pre>\n<p><span style=\"font-weight: 400;\">Now it&#8217;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:<\/span><\/p>\n<pre class=\"lang:php decode:true\">\/**\r\n* UpgradeSchema constructor.\r\n* @param Topology $topology\r\n*\/\r\npublic function __construct(Belvg\\Sqs\\Model\\Topology &#160;$topology)\r\n{\r\n&#160;&#160;\/** @var TYPE_NAME $topology *\/\r\n&#160;&#160;$this-&gt;topology = $topology;\r\n}\r\n&#8230;\r\n$this-&gt;topology-&gt;install();\r\n...\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">P.S. The module was tested on Magento 2.1.3-2.1.7 EE. Any bugs can be submitted to the repository <\/span><a href=\"https:\/\/github.com\/Galillei\/magento-sqs\"><span style=\"font-weight: 400;\">https:\/\/github.com\/Galillei\/magento-sqs<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"Magento 2 is distinguished by the number of features Magento 1 feels lack. One of &#8230;","protected":false},"author":47,"featured_media":14279,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,389],"tags":[],"class_list":["post-14278","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento","category-magento2-development","post_format-post-format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"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.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Artsem Miklashevich\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#article\",\"name\":\"Module To Use Amazon SQS Queues | BelVG Blog\",\"headline\":\"Magento 2 Module To Use Amazon SQS\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/Module-To-Use-Amazon-SQS-Queues.jpg\",\"width\":770,\"height\":433,\"caption\":\"Module To Use Amazon SQS Queues\"},\"datePublished\":\"2017-09-19T17:51:35+02:00\",\"dateModified\":\"2019-03-19T10:32:49+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#webpage\"},\"articleSection\":\"Magento, Magento 2 Development, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"position\":2,\"name\":\"Magento\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#listItem\",\"name\":\"Magento 2 Module To Use Amazon SQS\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#listItem\",\"position\":3,\"name\":\"Magento 2 Module To Use Amazon SQS\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich\",\"name\":\"Artsem Miklashevich\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/145dc6a225439ebb3a257da8fd0f46383a3649cdca2e58190b33a28af5f216a5?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Artsem Miklashevich\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html\",\"name\":\"Module To Use Amazon SQS Queues | BelVG Blog\",\"description\":\"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.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/artsem-miklashevich#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/Module-To-Use-Amazon-SQS-Queues.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html\\\/#mainImage\",\"width\":770,\"height\":433,\"caption\":\"Module To Use Amazon SQS Queues\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/module-to-use-amazon-sqs-queues.html#mainImage\"},\"datePublished\":\"2017-09-19T17:51:35+02:00\",\"dateModified\":\"2019-03-19T10:32:49+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Module To Use Amazon SQS Queues | BelVG Blog","description":"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.","canonical_url":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#article","name":"Module To Use Amazon SQS Queues | BelVG Blog","headline":"Magento 2 Module To Use Amazon SQS","author":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2017\/09\/Module-To-Use-Amazon-SQS-Queues.jpg","width":770,"height":433,"caption":"Module To Use Amazon SQS Queues"},"datePublished":"2017-09-19T17:51:35+02:00","dateModified":"2019-03-19T10:32:49+02:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#webpage"},"articleSection":"Magento, Magento 2 Development, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","position":2,"name":"Magento","item":"https:\/\/belvg.com\/blog\/category\/magento","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#listItem","name":"Magento 2 Module To Use Amazon SQS"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#listItem","position":3,"name":"Magento 2 Module To Use Amazon SQS","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author","url":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich","name":"Artsem Miklashevich","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/145dc6a225439ebb3a257da8fd0f46383a3649cdca2e58190b33a28af5f216a5?s=96&d=mm&r=g","width":96,"height":96,"caption":"Artsem Miklashevich"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#webpage","url":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html","name":"Module To Use Amazon SQS Queues | BelVG Blog","description":"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.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/artsem-miklashevich#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2017\/09\/Module-To-Use-Amazon-SQS-Queues.jpg","@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html\/#mainImage","width":770,"height":433,"caption":"Module To Use Amazon SQS Queues"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html#mainImage"},"datePublished":"2017-09-19T17:51:35+02:00","dateModified":"2019-03-19T10:32:49+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"14278","title":"Module To Use Amazon SQS Queues | #site_title","description":"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.","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:37:15","updated":"2026-11-03 18:37:15"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento\" title=\"Magento\">Magento<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMagento 2 Module To Use Amazon SQS\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento","link":"https:\/\/belvg.com\/blog\/category\/magento"},{"label":"Magento 2 Module To Use Amazon SQS","link":"https:\/\/belvg.com\/blog\/module-to-use-amazon-sqs-queues.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/14278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=14278"}],"version-history":[{"count":-2,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/14278\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/14279"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=14278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=14278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=14278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}