{"id":28591,"date":"2019-05-29T00:00:00","date_gmt":"2019-05-28T22:00:00","guid":{"rendered":"https:\/\/blexin.com\/disaccoppiare-la-comunicazione-con-rabbitmq\/"},"modified":"2021-06-22T17:04:29","modified_gmt":"2021-06-22T15:04:29","slug":"decoupling-the-communication-with-rabbitmq","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/","title":{"rendered":"Decoupling the communication with RabbitMQ"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"28559\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"8e0c28ac-0cbc-4692-9d61-a7a2edc64c42\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-28559\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The project I am working on is based on an architecture made up of different applications, that communicate each other through messages exchange. This communication usually takes place following the pattern&nbsp;<em>Publish\/Subscribe<\/em>, that establishes that an application can communicate in&nbsp;<em>asynchronous<\/em>&nbsp;manner with different entities, without coupling.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"271\" data-attachment-id=\"28562\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image1-4-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-4.png?fit=523%2C271&amp;ssl=1\" data-orig-size=\"523,271\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image1-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-4.png?fit=523%2C271&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-4.png?resize=523%2C271&#038;ssl=1\" alt=\"\" class=\"wp-image-28562\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-4.png 523w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-4-480x249.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 523px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Involved entities are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Publisher<\/strong>&nbsp;-the application, that produces the message<\/li><li><strong>Message Broker<\/strong>&nbsp;&#8211; It&#8217;s the&nbsp;<em>MOM&nbsp;<\/em>(Message Oriented Middleware) that takes the message and routes it toward a consumer<\/li><li><strong>Consumer<\/strong>&nbsp;&#8211; the application, that consumes the message.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For this project, we used&nbsp;<strong><a href=\"https:\/\/www.rabbitmq.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">RabbitMQ<\/a><\/strong>, an open source messaging broker, that supports different protocols and offers many features.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"291\" data-attachment-id=\"28564\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image2-4-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2.gif?fit=498%2C291&amp;ssl=1\" data-orig-size=\"498,291\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2.gif?fit=498%2C291&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2.gif?resize=498%2C291&#038;ssl=1\" alt=\"\" class=\"wp-image-28564\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">RabbitMQ implements the protocol&nbsp;<strong><em>AMQP.0-9-1&nbsp;<\/em><\/strong>(Advanced Message Queuing Protocol), that establish that messages would be published towards some AMQP entites, called&nbsp;<strong><em>Exchange<\/em><\/strong>. Their role is to distribute received messages according to specific rules&nbsp;called&nbsp;<strong><em>bindings&nbsp;<\/em><\/strong>to other entities,&nbsp;<strong><em>Queue<\/em><\/strong>, to whom one or more&nbsp;<em><strong>Consumer&nbsp;<\/strong><\/em>can subscribe.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"689\" height=\"280\" data-attachment-id=\"28566\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image3-4-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3.jpg?fit=689%2C280&amp;ssl=1\" data-orig-size=\"689,280\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3.jpg?fit=689%2C280&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3.jpg?resize=689%2C280&#038;ssl=1\" alt=\"\" class=\"wp-image-28566\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3.jpg 689w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-480x195.jpg 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 689px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The routing algorithm, which allows messages to be routed to queues, depends on the exchange type. In AMQP there are four types defined, in addition to the&nbsp;<em>default<\/em>&nbsp;one, and they have below characteristics:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Default<\/strong>: its main feature is that every new queue is automatically linked to it, with a routing&nbsp;key identical to the queue name.<\/li><li><strong>Direct<\/strong>: useful to route messages. The messages&nbsp;delivering is based on a routing key.<\/li><li><strong>FanOut<\/strong>: it\u2019s perfect for broadcast routing, since it forward messages to&nbsp;all queues binded to its, overlooking the routing key<\/li><li><strong>Topic<\/strong>: used for multicast routing. The messages delivering is based on a routing key and a&nbsp;<em>wildcard<\/em>&nbsp;pattern used to bind queues to exchange.<\/li><li><strong>Headers<\/strong>: in this case, the exchange is not based on routing key, but on expressed attributes, like message header.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Both queues and exchanges have properties, that allow them to survive to a broker restart and they can also delete themselves, when respectively consumer or associated queues lack. Queues can also be exclusive, that is binded to a single connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I prefer not to local install RabbitMQ, but to use a Docker&nbsp;<em>container<\/em>&nbsp;, both for a convenience reason, since the dockerized image is ready to use, and to give the idea to use a broker instanced on a environment separate from publisher and subscriber, which will be defined hereafter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create the container, we run&nbsp;the following command, where we specify hostname, its name and the RabbitMQ image we want to instance:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\ndocker run -d --hostname my-rabbit --name rabbit1 -p &quot;5672:5672&quot; -p &quot;15672:15672&quot; rabbitmq:3-management\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I mapped the default port and the management Web UI port between container and localhost, to have the choice to access as I need. I chose exactly the management image, for the presence of a web interface, reachable to the address <a href=\"http:\/\/localhost:15672\" rel=\"nofollow\">http:\/\/localhost:15672<\/a>, &nbsp;thanks to which it is possible to interact and control different broker entities: a more intuitive option compared to CLI (rabbitmqctl)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"529\" data-attachment-id=\"28569\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image5-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-2.png?fit=2734%2C1412&amp;ssl=1\" data-orig-size=\"2734,1412\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image5-2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-2.png?fit=1024%2C529&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-2.png?resize=1024%2C529&#038;ssl=1\" alt=\"\" class=\"wp-image-28569\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-2-980x506.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-2-480x248.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Using the examples available on the RabbitMQ website, I create two&nbsp;<em>console application<\/em>&nbsp;in&nbsp;<em>.NET Core<\/em>. One of them will be the Publisher, the other one will be the Subscriber. RabbitMQ provides, among others, a client for the .NET language, that can be installed through the&nbsp;<em>Nuget<\/em>&nbsp;packages manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Analyze now the Producer of the message I defined as&nbsp;<em>Sender<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass Sender\n{\n\u00a0\u00a0static void Main(string&#x5B;] args)\n\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0var factory = new ConnectionFactory() { HostName = &quot;localhost&quot; };\n\u00a0\u00a0\u00a0\u00a0using (var connection = factory.CreateConnection())\n\u00a0\u00a0\u00a0\u00a0using (var channel = connection.CreateModel())\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0channel.QueueDeclare(queue: &quot;QueueDemo&quot;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0durable: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0exclusive: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0autoDelete: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0arguments: null);\n\u200b\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0string message = &quot;Demo Message&quot;;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var body = Encoding.UTF8.GetBytes(message);\n\u200b\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0channel.BasicPublish(exchange: &quot;&quot;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0routingKey: &quot;QueueDemo&quot;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0basicProperties: null,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body: body);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Sent {0}&quot;, message);\n\u00a0\u00a0\u00a0\u00a0}\n\u200b\n\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot; Press &#x5B;enter] to exit.&quot;);\n\u00a0\u00a0\u00a0\u00a0Console.ReadLine();\n\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We create a connection to the EndPoint, in our situation the&nbsp;<em>localhost<\/em>, istancing a&nbsp;<em>ConnectionFactory<\/em>. Running the program in debug, we can see that a connection has been created toward the endpoint, with AMQP protocol and with RabbitMQ default port.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"650\" data-attachment-id=\"28571\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image6-3-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-3.png?fit=934%2C650&amp;ssl=1\" data-orig-size=\"934,650\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image6-3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-3.png?fit=934%2C650&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-3.png?resize=934%2C650&#038;ssl=1\" alt=\"\" class=\"wp-image-28571\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-3.png 934w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image6-3-480x334.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 934px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We can declare now a queue, with the definition of a&nbsp;<em>Name<\/em>&nbsp;(<em>QueueDemo<\/em>) property. We create the message to send (a simple string), and in the method&nbsp;<em>BasicPublish<\/em>&nbsp;we indicate the default exchange (with an empty string), the&nbsp;<em>routing key<\/em>&nbsp;(identical to the queue name) and we insert the message to publish in the&nbsp;<em>body<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can run the application Sender :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"226\" data-attachment-id=\"28574\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image7-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image7.png?fit=1168%2C258&amp;ssl=1\" data-orig-size=\"1168,258\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image7.png?fit=1024%2C226&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image7.png?resize=1024%2C226&#038;ssl=1\" alt=\"\" class=\"wp-image-28574\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image7-1024x226.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image7-980x216.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image7-480x106.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the WebUI&nbsp;<em>Overview<\/em>&nbsp;screen we can note that the queue number has increased. Actually, the queue&nbsp;<em>QueueDemo<\/em>&nbsp;has been created and there\u2019s a message in queue.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"616\" data-attachment-id=\"28576\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image8-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image8-1.png?fit=1668%2C1004&amp;ssl=1\" data-orig-size=\"1668,1004\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image8-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image8-1.png?fit=1024%2C616&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image8-1.png?resize=1024%2C616&#038;ssl=1\" alt=\"\" class=\"wp-image-28576\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image8-1-980x590.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image8-1-480x289.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In&nbsp;<em>QueueDemo<\/em>&nbsp;detailed information, we can see the exchange it has been linked to<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"179\" data-attachment-id=\"28578\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image9-1-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image9-1.png?fit=656%2C179&amp;ssl=1\" data-orig-size=\"656,179\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image9-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image9-1.png?fit=656%2C179&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image9-1.png?resize=656%2C179&#038;ssl=1\" alt=\"\" class=\"wp-image-28578\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image9-1.png 656w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image9-1-480x131.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 656px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And clicking on the&nbsp;<em>button<\/em>&nbsp;<strong>Get Message(s)<\/strong>&nbsp;we can display the&nbsp;<em>Payload<\/em>&nbsp;of our message, which correspond to the string created in Sender.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"756\" data-attachment-id=\"28580\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image10-7-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7.png?fit=1068%2C788&amp;ssl=1\" data-orig-size=\"1068,788\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image10-7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7.png?fit=1024%2C756&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7.png?resize=1024%2C756&#038;ssl=1\" alt=\"\" class=\"wp-image-28580\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7-1024x756.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7-980x723.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image10-7-480x354.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The message, then, is properly queued and is waiting to be consumed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We analyze now the&nbsp; Subscriber application, that I called&nbsp;<em>Receiver<\/em>. We create a connection here too and we declare the queue&nbsp;<em>DemoQueue<\/em>. We create then the real consumer through the class&nbsp;<em>EventBasicConsumer&nbsp;<\/em>and with the method&nbsp;<em>Received<\/em>&nbsp;we define the event, which will occur when the message will be received. To do that, we assign&nbsp;<em>BasicDeliverEventArgs<\/em>&nbsp;<strong>ea<\/strong>&nbsp;properties, that contains all properties related to the message delivered by the broker. Lastly, with the method&nbsp;<em>BasicConsume<\/em>&nbsp;we start the just defined&nbsp;<em>consumer<\/em>&nbsp;.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass Receiver\n{\n\u00a0\u00a0static void Main(string&#x5B;] args)\n\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0var factory = new ConnectionFactory() { HostName = &quot;localhost&quot; };\n\u00a0\u00a0\u00a0\u00a0using (var connection = factory.CreateConnection())\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0using (var channel = connection.CreateModel())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0channel.QueueDeclare(queue: &quot;QueueDemo&quot;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0durable: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0exclusive: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0autoDelete: false,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0arguments: null);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var consumer = new EventingBasicConsumer(channel);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0consumer.Received += (model, ea) =&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var body = ea.Body;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var message = Encoding.UTF8.GetString(body);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Received {0}&quot;, message);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0};\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0channel.BasicConsume(queue: &quot;QueueDemo&quot;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0autoAck: true,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0consumer: consumer);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Press &#x5B;enter] to exit.&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.ReadLine();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Running the application, the message will be consumed precisely.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"243\" data-attachment-id=\"28583\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image11-6-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image11.jpg?fit=1144%2C272&amp;ssl=1\" data-orig-size=\"1144,272\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image11\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image11.jpg?fit=1024%2C243&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image11.jpg?resize=1024%2C243&#038;ssl=1\" alt=\"\" class=\"wp-image-28583\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image11-1024x243.jpg 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image11-980x233.jpg 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image11-480x114.jpg 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"616\" data-attachment-id=\"28585\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image12-4-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image12-4.png?fit=1668%2C1004&amp;ssl=1\" data-orig-size=\"1668,1004\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image12-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image12-4.png?fit=1024%2C616&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image12-4.png?resize=1024%2C616&#038;ssl=1\" alt=\"\" class=\"wp-image-28585\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image12-4-980x590.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image12-4-480x289.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">With many messages in queue and many consumer in waiting, the&nbsp;<em>load balancing<\/em>&nbsp;will be managed by default with a&nbsp;<em>Round Robin<\/em>&nbsp;scheduling, so that no consumer will take priority over&nbsp;others. In order to be sure that the message has been delivered to consumer, we can modify the message\u2019s&nbsp;<em>acknowledge<\/em>&nbsp;way. Inside the consumer&nbsp;<em>Received<\/em>&nbsp;method, we invoke the method BasicAck, that is used to make the message\u2019s acknowledge. Between the arguments of this method, there\u2019s the&nbsp;<em>Delivery Tag<\/em>&nbsp;that univocally identify the delivering. It is needed to set the autoAck in the&nbsp;<em>BasicConsume&nbsp;<\/em>to false.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nchannel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">On the WebUI we can see how the message has been properly consumed and an ack has been sent from the consumer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" data-attachment-id=\"28588\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/attachment\/image13-3-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image13-3.png?fit=1728%2C1148&amp;ssl=1\" data-orig-size=\"1728,1148\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image13-3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image13-3.png?fit=1024%2C680&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image13-3.png?resize=1024%2C680&#038;ssl=1\" alt=\"\" class=\"wp-image-28588\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image13-3-980x651.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image13-3-480x319.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">RabbitMQ can be a great choice for the communication between applications, microservices and all those software solutions for whom it is needed the use of a distributed architecture. As open source middleware, it offers many advantages:&nbsp;among them, the decoupling between different entities, for whom it is possible to deploy separately, or the asynchronous communication, that allow to application to continue the execution flow without block.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different from HTTP communication through REST API, for example, it offers a better reliability in the information exchange between application, thanks both to acknowledge mechanisms and re-delivery of messages and to robustness and redundancy (cluster of nodes) mechanisms.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Obviously, in this article I have only described basic features of RabbitMQ, that were useful to me to start to interact with this communication way.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Waiting for a more technical article, here is the link to the repository GitHub created for this issue:&nbsp;<a href=\"https:\/\/github.com\/intersect88\/IntroToRabbitMQ\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/intersect88\/IntroToRabbitMQ<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See you next<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>To decouple the communication in complex architectures, we can use messages and get help from RabbitMQ to manage them<\/p>\n","protected":false},"author":196716251,"featured_media":28559,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_crdt_document":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637542,688637458,688637537],"class_list":["post-28591","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-dotnetcore-en","tag-rabbitmq-en","tag-swdesign-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Decoupling the communication with RabbitMQ - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Decoupling the communication with RabbitMQ - Blexin\" \/>\n<meta property=\"og:description\" content=\"To decouple the communication in complex architectures, we can use messages and get help from RabbitMQ to manage them\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-28T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-22T15:04:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Genny Paudice\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Genny Paudice\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/\"},\"author\":{\"name\":\"Genny Paudice\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"headline\":\"Decoupling the communication with RabbitMQ\",\"datePublished\":\"2019-05-28T22:00:00+00:00\",\"dateModified\":\"2021-06-22T15:04:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/\"},\"wordCount\":1161,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1\",\"keywords\":[\".NetCore\",\"RabbitMQ\",\"softwaredesign\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/\",\"name\":\"Decoupling the communication with RabbitMQ - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2019-05-28T22:00:00+00:00\",\"dateModified\":\"2021-06-22T15:04:29+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/decoupling-the-communication-with-rabbitmq\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Decoupling the communication with RabbitMQ\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\",\"name\":\"Genny Paudice\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"caption\":\"Genny Paudice\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/genny-paudiceblexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Decoupling the communication with RabbitMQ - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/","og_locale":"en_US","og_type":"article","og_title":"Decoupling the communication with RabbitMQ - Blexin","og_description":"To decouple the communication in complex architectures, we can use messages and get help from RabbitMQ to manage them","og_url":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/","og_site_name":"Blexin","article_published_time":"2019-05-28T22:00:00+00:00","article_modified_time":"2021-06-22T15:04:29+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Genny Paudice","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Genny Paudice","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/"},"author":{"name":"Genny Paudice","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"headline":"Decoupling the communication with RabbitMQ","datePublished":"2019-05-28T22:00:00+00:00","dateModified":"2021-06-22T15:04:29+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/"},"wordCount":1161,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","keywords":[".NetCore","RabbitMQ","softwaredesign"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/","url":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/","name":"Decoupling the communication with RabbitMQ - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","datePublished":"2019-05-28T22:00:00+00:00","dateModified":"2021-06-22T15:04:29+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/decoupling-the-communication-with-rabbitmq\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Decoupling the communication with RabbitMQ"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973","name":"Genny Paudice","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","caption":"Genny Paudice"},"url":"https:\/\/blexin.com\/en\/author\/genny-paudiceblexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/8e0c28ac-0cbc-4692-9d61-a7a2edc64c42.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-7r9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716251"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=28591"}],"version-history":[{"count":6,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28591\/revisions"}],"predecessor-version":[{"id":32926,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/28591\/revisions\/32926"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/28559"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=28591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=28591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=28591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}