<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Asitha Madhushanka on Medium]]></title>
        <description><![CDATA[Stories by Asitha Madhushanka on Medium]]></description>
        <link>https://medium.com/@asitham?source=rss-872ef9dd1595------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Eh7IDWgSI5Cm6OsF</url>
            <title>Stories by Asitha Madhushanka on Medium</title>
            <link>https://medium.com/@asitham?source=rss-872ef9dd1595------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:53:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asitham/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RabbitMQ Dead Letter Queue (DLQ) With WSO2 MI]]></title>
            <link>https://medium.com/@asitham/rabbitmq-dead-letter-queue-dlq-with-wso2-mi-da3e089aa60f?source=rss-872ef9dd1595------2</link>
            <guid isPermaLink="false">https://medium.com/p/da3e089aa60f</guid>
            <category><![CDATA[dlq]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <dc:creator><![CDATA[Asitha Madhushanka]]></dc:creator>
            <pubDate>Tue, 30 Jun 2026 18:15:07 GMT</pubDate>
            <atom:updated>2026-06-30T18:15:07.419Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Everyone! 😊 Welcome back!</p><p>This article is a follow-up to my previous guide on <a href="https://medium.com/@asitham/rabbitmq-guaranteed-delivery-in-a-multithreaded-architecture-with-wso2-mi-5ec36ff6efca"><strong><em>RabbitMQ Guaranteed Delivery in a Multithreaded Architecture with WSO2 MI</em></strong></a>. In that guide, we covered how to use Consumer Acknowledgements, Publisher Confirms, and the callback-controlled AckDecisionCallback to ensure end-to-end message reliability.</p><p>In this article, I want to tackle a subtler but equally important challenge that surfaces when you introduce Dead Letter Queues (DLQs) into the picture: how do you prevent a message from being requeued indefinitely when you have already configured a DLQ to handle permanently failed messages? 🤔</p><p>Let us dive in!</p><h3>A Quick Recap: Acknowledgement Decisions</h3><p>As a quick refresher, the callback-controlled acknowledgement feature in WSO2 MI gives the mediation flow full control over what happens to a RabbitMQ message after processing. Once a message is consumed, the RabbitMQ consumer thread blocks on an AckDecisionCallback until the mediation flow sets one of three decisions:</p><ul><li><strong>ACKNOWLEDGE</strong> — processing succeeded; send a basic.ack to the broker and remove the message from the queue.</li><li><strong>SET_ROLLBACK_ONLY</strong> — processing failed; send a basic.nack without requeue. The broker discards the message or routes it to a configured Dead Letter Exchange.</li><li><strong>SET_REQUEUE_ON_ROLLBACK</strong> — processing failed; send a basic.nack with requeue=true. The broker puts the message back at the head of the queue for another delivery attempt.</li></ul><p>The default failure behaviour — when no explicit decision is set — is SET_REQUEUE_ON_ROLLBACK. This is a safe default for most retry scenarios: if something goes wrong, try again. However, this default creates a problem as soon as you bring DLQs into the equation.</p><h3>The Problem: Requeue vs. Dead-Letter</h3><h4>What Happens in a Common Fault Sequence</h4><p>In many WSO2 MI deployments, a single shared fault sequence handles errors across multiple proxy services. This is a clean pattern when you centralise your error-logging, alerting, and failure responses in one place. However, it introduces an ambiguity:</p><p><strong>⚠️ Problem: </strong><em>Different proxy services have different retry strategies. Some use a Dead Letter Exchange for permanent failure routing. Others expect the message to be requeued and retried. A single fault sequence cannot know which strategy applies without inspecting the calling proxy.</em></p><p>Here is the specific scenario that triggers the issue:</p><ol><li>A proxy service is configured with a Dead Letter Exchange.</li><li><strong>(rabbitmq.message.error.exchange.name</strong>) and a max dead-letter count (<strong>rabbitmq.message.max.dead.lettered.count</strong>). This means: after N failed attempts, route the message to the DLQ — do not retry forever.</li><li>Processing fails and the fault sequence runs.</li><li>The fault sequence sets <strong>SET_REQUEUE_ON_ROLLBACK</strong> (the default) because it does not know that this proxy has a DLQ configured.</li><li>The broker requeues the message. RabbitMQ re-delivers it. The same failure happens again.</li><li>The message is requeued again. And again. It never reaches the DLQ. The dead-letter count mechanism is bypassed entirely. 😬</li></ol><p>Essentially, SET_REQUEUE_ON_ROLLBACK and a Dead Letter Exchange are at cross-purposes. When a message is requeued, RabbitMQ treats it as a fresh delivery — the dead-letter counter never increments to the configured maximum. The DLQ is never triggered. The message loops forever.</p><p><strong>⚠️ Problem: </strong><em>SET_REQUEUE_ON_ROLLBACK bypasses the Dead Letter Exchange mechanism. A requeued message restarts its delivery count, so it can never reach the configured max-dead-letter threshold and be routed to the DLQ.</em></p><h3>The Solution: DLQ-Aware Acknowledgement Override</h3><p>WSO2 MI addresses this through an intelligent override in the callback-controlled ACK flow. When a proxy service has a Dead Letter Exchange configured, any failure that would normally result in <strong>SET_REQUEUE_ON_ROLLBACK</strong> is automatically overridden to <strong>SET_ROLLBACK_ONLY</strong>.</p><p><strong>✅ Solution: </strong><em>When a DLQ is configured on the Proxy Service, WSO2 MI detects the presence of the dead-letter exchange parameter and overrides SET_REQUEUE_ON_ROLLBACK to SET_ROLLBACK_ONLY. This ensures the message is nacked without requeue, allowing the broker to route it to the DLQ as intended.</em></p><p>The override is automatic you do not need to change your fault sequence. The RabbitMQMessageReceiver detects the proxy-level configuration at runtime and applies the correct decision before the ack is sent to the broker.</p><h3>Sample Proxy Service Configuration</h3><p>Here is a complete proxy service configuration that enables Dead Letter Queue routing alongside the callback-controlled acknowledgement flow:</p><pre>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;proxy name=”sample” startOnLoad=”true” transports=”rabbitmq” xmlns=”http://ws.apache.org/ns/synapse&quot;&gt;<br> &lt;target faultSequence=”APICommon-Runtime-Error-Sequence-V7&quot; inSequence=”Sample-InSequence”&gt; <br> &lt;outSequence/&gt;<br> &lt;/target&gt;<br> &lt;parameter name=”rabbitmq.message.error.exchange.name”&gt;test&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.message.error.queue.routing.key”&gt;test/parameter&gt;<br> &lt;parameter name=”rabbitmq.message.max.dead.lettered.count”&gt;1&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.proxy.throttle.mode”&gt;FIXED_INTERVAL&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.proxy.throttle.count”&gt;100&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.queue.auto.ack”&gt;false&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.proxy.throttle.enabled”&gt;true&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.proxy.throttle.timeUnit”&gt;minute&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.queue.autodeclare”&gt;false&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.connection.factory”&gt;AMQPConnectionFactory&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.queue.name”&gt;test&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.message.content.type”&gt;application/xml&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.channel.consumer.qos”&gt;1&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.concurrent.consumer.count”&gt;4&lt;/parameter&gt;<br> &lt;parameter name=”rabbitmq.AckMode”&gt;clientAck&lt;/parameter&gt;<br>&lt;/proxy&gt;</pre><p>The three key DLQ parameters are:</p><ul><li><strong>rabbitmq.message.error.exchange.name</strong> — the Dead Letter Exchange name. WSO2 MI inspects this parameter to detect whether DLQ routing is enabled for this proxy.</li><li><strong>rabbitmq.message.error.queue.routing.key</strong> — the routing key used to bind the DLQ queue to the Dead Letter Exchange.</li><li><strong>rabbitmq.message.max.dead.lettered.count</strong> — the maximum number of times a message can be dead-lettered before it is discarded or parked in a final holding queue.</li></ul><p><strong>📌 Note: </strong><em>You do not need to modify your fault sequence to enable this behaviour. The override happens automatically inside WSO2 MI when rabbitmq.message.error.exchange.name is present on the proxy.</em></p><h3>How the Override Works Internally</h3><p>Here is the internal sequence of events when a failure occurs on a DLQ-enabled proxy:</p><ol><li>The mediation flow fails. The fault sequence runs but does not explicitly set an acknowledgement decision.</li><li>The AckDecisionCallback defaults to <strong>SET_REQUEUE_ON_ROLLBACK</strong> — the standard fallback for unhandled failures.</li><li>Before sending the nack to the broker, the <strong>RabbitMQMessageReceiver</strong> checks whether the proxy service has <strong>rabbitmq.message.error.exchange.name</strong> configured.</li><li>Since the DLQ exchange is configured, the receiver overrides the decision: <strong>SET_REQUEUE_ON_ROLLBACK</strong> → <strong>SET_ROLLBACK_ONLY</strong>.</li><li>A basic.nack without requeue is sent to the broker.</li><li>RabbitMQ applies the x-dead-letter-exchange policy. The message is routed to the configured Dead Letter Exchange and lands in the DLQ. ✅</li></ol><h3>Reading the Logs</h3><p>When this override triggers, WSO2 MI emits a clear sequence of log entries that tell you exactly what happened. Here is what to look for:</p><pre>INFO {AckDecisionCallback} — AckDecisionCallback completed successfully with decision: SET_REQUEUE_ON_ROLLBACK<br>INFO {RabbitMQMessageReceiver} — Since DLQ is enabled for the service, setting SET_ROLLBACK_ONLY to true. Overriding the AckDecision SET_REQUEUE_ON_ROLLBACK<br>INFO {ServiceTaskManager} — The rejected message with message id: null and delivery tag: 3 on the queue: queue will discard or dead-lettered.</pre><p>Breaking down what each log line tells you:</p><ul><li><strong>AckDecisionCallback … SET_REQUEUE_ON_ROLLBACK</strong> — the mediation flow completed (with failure) and the callback defaulted to requeue.</li><li><strong>RabbitMQMessageReceiver … Overriding the AckDecision SET_REQUEUE_ON_ROLLBACK</strong> — WSO2 MI detected the DLQ configuration and applied the override before sending the ack.</li><li><strong>ServiceTaskManager … will discard or dead-lettered</strong> — the message was nacked without requeue. RabbitMQ will now apply the dead-letter policy and route it to the DLQ.</li></ul><p><strong>📌 Note: </strong><em>If you see the second log line (“Since DLQ is enabled … Overriding”), the override is working correctly. The message will reach your DLQ as configured.</em></p><h3>Behaviour Summary</h3><p>The table below summarises how the acknowledgement decision is resolved depending on whether a DLQ is configured:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdPRpjPZKSN05ngkIxxWew.png" /></figure><p>No more lost messages, no more endless loops — just clean, reliable delivery from queue to DLQ. Happy Integrating! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da3e089aa60f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RabbitMQ Guaranteed Delivery in a Multithreaded Architecture with WSO2 MI]]></title>
            <link>https://medium.com/@asitham/rabbitmq-guaranteed-delivery-in-a-multithreaded-architecture-with-wso2-mi-5ec36ff6efca?source=rss-872ef9dd1595------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec36ff6efca</guid>
            <category><![CDATA[multithreaded-architectur]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[guaranteed-delivery]]></category>
            <dc:creator><![CDATA[Asitha Madhushanka]]></dc:creator>
            <pubDate>Tue, 30 Jun 2026 17:49:21 GMT</pubDate>
            <atom:updated>2026-06-30T17:49:21.304Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello Everyone! 😊 Welcome back to another deep-dive guide!</p><p>In this article, I am going to walk you through one of the trickier reliability challenges in WSO2 Micro Integrator (MI): achieving guaranteed end-to-end message delivery with RabbitMQ when your mediation flow runs in a multithreaded environment. We will cover exactly why the default architecture can cause silent message loss, and how a purpose-built feature — introduced via a WSO2 U2 update — solves the problem cleanly.</p><p>By the end of this guide you will be able to configure Consumer Acknowledgements, Publisher Confirms, and callback-controlled acknowledgement together so that a RabbitMQ message is only ever acknowledged after your entire mediation flow has completed successfully.</p><h3>Understanding the Problem</h3><h4>Non-Blocking Transport and the Threading Gap</h4><p>WSO2 MI uses a non-blocking transport by default. In this model, the calling thread does not block waiting for the backend response. Instead, it returns immediately and sends an acknowledgement to the RabbitMQ broker long before the backend actually replies.</p><p>This creates a dangerous window: if a timeout fires, the fault sequence is executed by a completely different thread — not the one that originally received the message. The original consumer thread has already returned and already acked the message. The result? The message is gone from the queue even if the backend call ultimately failed. 😬</p><p><strong>📌 Note: </strong><em>In the non-blocking transport, the ack to RabbitMQ is sent before the mediation flow completes. Any error in the backend will trigger a fault sequence on a different thread, and the original message is already lost.</em></p><h4>What About Call Blocking Mode?</h4><p>A natural first instinct is to switch to call blocking mode — forcing the calling thread to wait for the backend response. This does make the backend call synchronous, but it does not solve the acknowledgement problem.</p><p>Here is why: WSO2 MI spawns a new thread in the Axis Engine before the transport is even invoked. Because of this, handling the acknowledgement at the transport level is not possible. The same limitation applies to other transports such as JMS and VFS — the WSO2 documentation already notes that you must set specific properties for those transports, and the same principle carries over to RabbitMQ.</p><p><strong>📌 Note: </strong><em>Switching to call blocking mode makes the outbound HTTP call synchronous, but a new thread is already spawned in the Axis Engine before that point. Acknowledgement control at the transport level is therefore not achievable this way.</em></p><h4>The Default WSO2 MI Architecture</h4><p>To summarise how WSO2 MI works by default:</p><ul><li>A RabbitMQ consumer thread picks up a message from the queue.</li><li>The Axis Engine spawns a new worker thread to process the mediation flow.</li><li>The consumer thread (or the non-blocking transport) acknowledges the message to RabbitMQ.</li><li>The worker thread continues processing — but if it fails, there is no way to roll back the already-sent acknowledgement.</li></ul><p>This architecture is optimised for throughput, not for guaranteed delivery. To achieve guaranteed delivery in a single-threaded mediation flow this was previously the only approach, but it put a hard constraint on concurrency.</p><h4>The Solution: Callback-Controlled Acknowledgement</h4><p>WSO2 has introduced a feature available that decouples the acknowledgement decision from the transport thread and hands it to the mediation flow itself. This enables guaranteed delivery in a multithreaded architecture without sacrificing concurrency.</p><p>The approach combines three mechanisms:</p><ul><li><strong>Consumer Acknowledgement (clientAck)</strong> — the broker holds the message until the consumer explicitly acks or nacks.</li><li><strong>Publisher Confirms</strong> — the outbound RabbitMQ publish is confirmed by the broker before the flow continues.</li><li><strong>AckDecisionCallback</strong> — the RabbitMQ consumer thread blocks on a callback until the mediation flow explicitly decides to ACKNOWLEDGE, SET_ROLLBACK_ONLY, or SET_REQUEUE_ON_ROLLBACK.</li></ul><p>Let us look at each configuration step in detail.</p><h3>Step-by-Step Configuration</h3><h4>Step 1 — Enable Consumer Acknowledgement</h4><p>By default, RabbitMQ uses auto-acknowledgement, which means the broker considers a message delivered the moment it is handed to the consumer. To take control of this, switch to client acknowledgement mode on your inbound endpoint.</p><p>Add the following parameters to your RabbitMQ inbound endpoint configuration:</p><pre>&lt;parameter name=”rabbitmq.AckMode”&gt;clientAck&lt;/parameter&gt;<br>&lt;parameter name=&quot;rabbitmq.queue.auto.ack&quot;&gt;false&lt;/parameter&gt;<br>&lt;parameter name=&quot;rabbitmq.channel.consumer.qos&quot;&gt;1&lt;/parameter&gt;</pre><p>Here is what each parameter does:</p><ul><li><strong>rabbitmq.AckMode=clientAck</strong> — switches from auto-ack to manual (client) acknowledgement.</li><li><strong>rabbitmq.queue.auto.ack=false</strong> — disables the AMQP-level auto-ack at the queue consumer.</li><li><strong>rabbitmq.channel.consumer.qos=1</strong> — sets the prefetch count to 1, ensuring only one unacknowledged message is in flight per consumer at a time.</li></ul><h4>Step 2 — Enable Publisher Confirms</h4><p>Publisher Confirms are the outbound counterpart to Consumer Acknowledgements. When enabled, the RabbitMQ broker sends a confirmation (ack or nack) back to the publisher after a message has been safely written to the queue. This prevents silent drops on the publishing side.</p><p>Add the rabbitmq.publisher.confirms.enabled=true parameter to the To header URI of your proxy service or API mediation flow:</p><pre>&lt;header name=”To” scope=”default” value=”rabbitmq://AMQPConnectionFactory?rabbitmq.connection.factory=AMQPConnectionFactory&amp;amp;rabbitmq.queue.name=Test&amp;amp;rabbitmq.exchange.name=amqp.default&amp;amp;rabbitmq.queue.routing.key=Test&amp;amp;rabbitmq.queue.autodeclare=false&amp;amp;rabbitmq.publisher.confirms.enabled=true”/&gt;</pre><p><strong>📌 Note: </strong><em>Publisher Confirms add a small latency overhead because the mediation flow waits for the broker confirmation before proceeding. This is the intended behaviour — it is the trade-off for guaranteed delivery.</em></p><h4>Step 3 — Configure deployment.toml</h4><p>The callback-controlled acknowledgement feature is governed by a set of properties in the deployment.toml file of your WSO2 MI installation. Add the following block under the [messaging_callback] section:</p><pre>[messaging_callback]<br>callback_controlled_ack_enabled = true<br>enable_client_api_nonblocking_mode = true<br>preserve_payload_on_timeout = true<br>default_pub_confirm_timeout_for_callback_controlled_flow = 180000<br>rabbitmq_inbound_ack_max_wait_ms = 180000</pre><p>Here is what each property controls:</p><ul><li><strong>callback_controlled_ack_enabled = true</strong> — activates the callback-controlled acknowledgement mechanism globally.</li><li><strong>enable_client_api_nonblocking_mode = true</strong> — allows the mediation flow to proceed in non-blocking mode while still retaining ack control.</li><li><strong>preserve_payload_on_timeout = true</strong> — ensures the original payload is retained if a timeout occurs, enabling proper rollback.</li><li><strong>default_pub_confirm_timeout_for_callback_controlled_flow = 180000</strong> — timeout (in milliseconds) to wait for a publisher confirm before treating the publish as failed.</li><li><strong>rabbitmq_inbound_ack_max_wait_ms = 180000</strong> — maximum time (in milliseconds) the consumer thread will block on the AckDecisionCallback before timing out.</li></ul><h4>Step 4 — Explicitly Acknowledge the Message</h4><p>This is the critical piece that ties everything together. After every successful mediation flow — including the publishing step — you must explicitly set the ACKNOWLEDGE property. This signals the AckDecisionCallback to release the consumer thread and send the ack to the broker.</p><pre>&lt;property name=”ACKNOWLEDGE” value=”true” scope=”axis2&quot; type=”STRING”/&gt;</pre><p>The RabbitMQ consumer thread blocks on the AckDecisionCallback until the mediation flow sets one of the following decisions:</p><ul><li><strong>ACKNOWLEDGE</strong> — the message was processed successfully; send a basic.ack to the broker.</li><li><strong>SET_ROLLBACK_ONLY</strong> — the flow failed; send a basic.nack and discard the message.</li><li><strong>SET_REQUEUE_ON_ROLLBACK</strong> — the flow failed; send a basic.nack with requeue=true so the broker re-delivers the message.</li></ul><p><strong>📌 Note: </strong><em>You must add the ACKNOWLEDGE property after every successful publishing step in the mediation flow. Without it, the consumer thread will block until the rabbitmq_inbound_ack_max_wait_ms timeout expires, after which the message will be treated as failed.</em></p><h3>How It All Works Together</h3><p>Let us trace through the complete flow once everything is configured:</p><ul><li>The RabbitMQ consumer thread picks up a message from the queue. Because clientAck is enabled, the broker holds the message — it is not yet acknowledged.</li><li>The consumer thread immediately blocks on the AckDecisionCallback, handing control to the mediation flow worker thread.</li><li>The mediation flow executes — it calls the backend, transforms the response, and publishes to a downstream RabbitMQ queue.</li><li>Because Publisher Confirms are enabled, the flow waits for the broker to confirm the publish succeeded.</li><li>Once the publish is confirmed, the flow sets ACKNOWLEDGE=true. The AckDecisionCallback unblocks the consumer thread, which sends a basic.ack to the broker.</li><li>If anything fails at any step, the fault sequence sets SET_ROLLBACK_ONLY or SET_REQUEUE_ON_ROLLBACK, and the broker re-delivers or discards accordingly.</li></ul><p>The result is a fully guaranteed delivery chain: the original message is never acknowledged until all downstream processing is confirmed. And because the consumer thread only blocks on the callback (not on the actual mediation work), multiple messages can still be processed concurrently by separate worker threads. 🎯</p><h3>Complete Configuration Summary</h3><h4>Consumer Proxy Parameters with Throttling Enabled:</h4><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy name=&quot;sample&quot; startOnLoad=&quot;true&quot; transports=&quot;rabbitmq&quot; xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;<br>    &lt;target faultSequence=&quot;APICommon-Runtime-Error-Sequence-V7&quot; inSequence=&quot;Sample-InSequence&quot;&gt;                                                                  <br>        &lt;outSequence/&gt;<br>    &lt;/target&gt;<br>     &lt;parameter name=&quot;rabbitmq.message.error.exchange.name&quot;&gt;test&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.message.error.queue.routing.key&quot;&gt;test/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.message.max.dead.lettered.count&quot;&gt;1&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.proxy.throttle.mode&quot;&gt;FIXED_INTERVAL&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.proxy.throttle.count&quot;&gt;100&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.queue.auto.ack&quot;&gt;false&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.proxy.throttle.enabled&quot;&gt;true&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.proxy.throttle.timeUnit&quot;&gt;minute&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.queue.autodeclare&quot;&gt;false&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.connection.factory&quot;&gt;AMQPConnectionFactory&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.queue.name&quot;&gt;test&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.message.content.type&quot;&gt;application/xml&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.channel.consumer.qos&quot;&gt;1&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.concurrent.consumer.count&quot;&gt;4&lt;/parameter&gt;<br>    &lt;parameter name=&quot;rabbitmq.AckMode&quot;&gt;clientAck&lt;/parameter&gt;<br>&lt;/proxy&gt;</pre><p>Now that guaranteed delivery is in place, Happy Stacking! 🌟🌟</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec36ff6efca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send email with an attachment and HTML body in WSO2 MI]]></title>
            <link>https://medium.com/@asitham/send-email-with-an-attachment-and-html-body-in-wso2-mi-228aec5cfbde?source=rss-872ef9dd1595------2</link>
            <guid isPermaLink="false">https://medium.com/p/228aec5cfbde</guid>
            <category><![CDATA[wso2-email]]></category>
            <category><![CDATA[email-with-html-body]]></category>
            <category><![CDATA[email-with-an-attachment]]></category>
            <category><![CDATA[wso2-micro-integrator]]></category>
            <category><![CDATA[send-email-in-mi]]></category>
            <dc:creator><![CDATA[Asitha Madhushanka]]></dc:creator>
            <pubDate>Sat, 05 Feb 2022 12:32:40 GMT</pubDate>
            <atom:updated>2022-02-05T12:32:40.881Z</atom:updated>
            <content:encoded><![CDATA[<h4>Send email with an attachment and HTML body using base64 content in WSO2 MI</h4><p>Hello everyone 👋</p><p>As you know, WSO2 MI comes with a comprehensive set of transports supported and Mail transport is one of the mostly used transports. Today, I’ll explain how to send an email with an attachment and HTML body by using the WSO2 Micro Integrator.</p><p>First you need to enable the mail transport. If you take the WSO2 ESB, you would have visible more than one configuration files inside the conf directory. However modifying those files has several drawbacks. With Micro Integrator, you do not have to configure multiple files. There is only one file that you need to modify and it is deployment.toml.😊😊😊</p><p>To enable the mail transport you have to modify the deployment.toml file inside the &lt;MI-Home&gt;/conf directory as below mention.</p><pre>[[transport.mail.sender]]<br>name = &quot;mailto&quot;<br>parameter.hostname = &quot;smtp.gmail.com&quot;<br>parameter.port = &quot;587&quot;<br>parameter.enable_tls = true<br>parameter.auth = true<br>parameter.username = &quot;USERNAME&quot;<br>parameter.password = &quot;PASSWORD&quot;<br>parameter.from = &quot;USERNAME&quot;</pre><p>We are using base64 encoded HTML content and base64 encoded image content. Therefore, we have create a JSON payload with base64 encoded contents.</p><pre>{&quot;subject&quot;: &quot;Sample email&quot;,&quot;content&quot;:&quot;{base64 encoded HTML content}&quot;,&quot;image&quot;:&quot;{base64 encoded image content}&quot;}</pre><p>Lets Create a Proxy Service. 😎</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>       name=&quot;emailProxy&quot;<br>       transports=&quot;http&quot;<br>       startOnLoad=&quot;true&quot;&gt;<br>   &lt;description/&gt;<br>   &lt;target&gt;<br>      &lt;inSequence&gt;<br>         &lt;propertyGroup&gt;<br>            &lt;property name=&quot;enableSwA&quot; value=&quot;true&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;subject&quot;<br>                      expression=&quot;json-eval($.subject)&quot;<br>                      scope=&quot;default&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;attachmentEncoded&quot;<br>                      expression=&quot;json-eval($.image)&quot;<br>                      scope=&quot;default&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;htmlContent&quot;<br>                      expression=&quot;json-eval($.content)&quot;<br>                      scope=&quot;default&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;AttachmentFile&quot;<br>                      value=&quot;sampleimage.png&quot;<br>                      scope=&quot;axis2&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;transport.mail.Format&quot;<br>                      value=&quot;Attachment&quot;<br>                      scope=&quot;axis2&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>            &lt;property name=&quot;FORCE_SC_ACCEPTED&quot;<br>                      value=&quot;true&quot;<br>                      scope=&quot;axis2&quot;<br>                      type=&quot;STRING&quot;/&gt;<br>         &lt;/propertyGroup&gt;<br>        &lt;property name=&quot;OUT_ONLY&quot; scope=&quot;default&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;<br>        &lt;property expression=&quot;base64Decode(get-property(&#39;htmlContent&#39;))&quot; name=&quot;transport.mail.bodyWhenAttached&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; xmlns:ns=&quot;<a href="http://org.apache.synapse/xsd">http://org.apache.synapse/xsd</a>&quot;/&gt;<br>        &lt;property name=&quot;transport.mail.bodyMimeWhenAttached&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;text/html&quot;/&gt;<br>        <strong> &lt;!-- Creating the Payload for a binary payload.--&gt;</strong><br>         &lt;payloadFactory media-type=&quot;xml&quot;&gt;<br>            &lt;format&gt;<br>               &lt;ns:binary xmlns:ns=&quot;<a href="http://ws.apache.org/commons/ns/payload">http://ws.apache.org/commons/ns/payload</a>&quot;&gt;$1&lt;/ns:binary&gt;<br>            &lt;/format&gt;<br>            &lt;args&gt;<br>               &lt;arg evaluator=&quot;xml&quot; expression=&quot;$ctx:attachmentEncoded&quot;/&gt;<br>            &lt;/args&gt;<br>         &lt;/payloadFactory&gt;<br>         <strong>&lt;!-- Even using a binary payload, the Axis2 frameworks keeps considering the payload as text. We use a script mediator to set the first node as binary; --&gt;</strong><br>         &lt;script language=&quot;js&quot;&gt;var binaryNode =       <br>                   mc.getEnvelope().getBody().getFirstElement().getFirstOMChild();  <br>                    binaryNode.setBinary(true);&lt;/script&gt;<br>        <strong> &lt;!-- To set ExpandingMessageFormatter --&gt;</strong><br>         &lt;property name=&quot;messageType&quot;<br>                   value=&quot;application/octet-stream&quot;<br>                   scope=&quot;axis2&quot;<br>                   type=&quot;STRING&quot;/&gt;<br>         &lt;property name=&quot;OUT_ONLY&quot; value=&quot;true&quot; scope=&quot;default&quot; type=&quot;STRING&quot;/&gt;<br>         &lt;send&gt;<br>            &lt;endpoint&gt;<br>               &lt;address uri=&quot;mailto:emailAddress&quot; optimize=&quot;swa&quot;/&gt;<br>            &lt;/endpoint&gt;<br>         &lt;/send&gt;<br>      &lt;/inSequence&gt;<br>      &lt;outSequence/&gt;<br>      &lt;faultSequence/&gt;<br>   &lt;/target&gt;<br>&lt;/proxy&gt;</pre><p>Now we have created a proxy 😎. Now let’s start the WSO2 MI by executing the following command.</p><pre>&lt;MI_HOME&gt;/bin/micro-integrator.sh (Linux)</pre><pre>&lt;MI_HOME&gt;/bin/micro-integrator.bat (Windows)</pre><p>Now you have configured the MI to send an email.😎</p><p>Lets invoke the proxy with the given JSON payload. Now you can check on you email and confirm that email message is received with an attachment and HTML content of the message content.😇😇😇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=228aec5cfbde" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>