<?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 Matthias Transier on Medium]]></title>
        <description><![CDATA[Stories by Matthias Transier on Medium]]></description>
        <link>https://medium.com/@matthias.transier?source=rss-dd3a71fb7988------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2jk-1aecgYpt2URGK2bd9g.jpeg</url>
            <title>Stories by Matthias Transier on Medium</title>
            <link>https://medium.com/@matthias.transier?source=rss-dd3a71fb7988------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 23:00:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@matthias.transier/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[Agentic Coding with Anypoint Studio]]></title>
            <link>https://medium.com/@matthias.transier/agentic-coding-with-anypoint-studio-c7455194b07d?source=rss-dd3a71fb7988------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7455194b07d</guid>
            <category><![CDATA[agentic-coding]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[anypoint-studio]]></category>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[mulesoft]]></category>
            <dc:creator><![CDATA[Matthias Transier]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 10:49:08 GMT</pubDate>
            <atom:updated>2026-09-18T14:30:43.986Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ik5VvrBrv1L1TZBUjDs3VQ.png" /></figure><p>Agentic coding is clearly becoming the next big thing in developer tooling — and MuleSoft is no exception. With <strong>Anypoint Code Builder (ACB)</strong>, MuleSoft offers a modern, Visual Studio Code–based IDE that comes with <strong>MuleSoft Vibes</strong>, its built‑in coding agent.</p><p>That’s great — unless you can’t move to ACB yet.</p><p>And in many projects, that’s exactly the situation. Maybe you’re tied to an existing Anypoint Studio setup, maybe tooling is locked down, or maybe you just aren’t ready to switch IDEs yet. The downside: no MuleSoft Vibes.</p><p>The good news? You’re not completely out of options.</p><p>While <strong>GitHub Copilot</strong> isn’t tailored specifically for MuleSoft development, it can still be surprisingly useful for everyday tasks — from explaining flows to drafting DataWeave snippets or helping with Java code inside Mule apps. And yes, you <em>can</em> use it inside <strong>Anypoint Studio</strong>.</p><p>Here’s how I set it up.</p><h3>Installing GitHub Copilot in Anypoint Studio</h3><p>GitHub provides an official Copilot plugin for Eclipse, which also works nicely with Anypoint Studio.</p><p><strong><em>Important:</em></strong><em> Please follow the instructions exactly as described and in the specified order. Deviating from these steps may result in incompatible dependencies being installed, which can break your Anypoint Studio installation.</em></p><p>You’ll find the releases on GitHub: <a href="https://github.com/microsoft/copilot-for-eclipse/releases/">https://github.com/microsoft/copilot-for-eclipse/releases/</a></p><p>At the time of writing, the latest version is <strong>0.21.0 (September 11th, 2026)</strong>. Download the ZIP file (GithubCopilotForEclipse.zip)—you’ll need it in a moment.</p><p>Once downloaded, open <strong>Anypoint Studio</strong> and head to<br><strong>Help → Install New Software… </strong>Choose <strong>Add…</strong>, then <strong>Archive…</strong>, and point to the ZIP file you just downloaded. Give it a meaningful name like <em>GitHub Copilot</em> so you’ll recognize it later.</p><p>Then click <strong>Add…</strong> again and create a new update site named <em>Mylyn Release 4.2.0</em> using: <a href="https://download.eclipse.org/mylyn/updates/release/4.2.0/">https://download.eclipse.org/mylyn/updates/release/4.2.0/</a></p><p>Back in the installer view, select your newly added GitHub Copilot update site in the <em>Work with</em> dropdown, enable <strong>GitHub Copilot</strong>, click <strong>Next</strong>, and proceed through the installation steps. A restart of Anypoint Studio is required.</p><p>And after restarting Anypoint Studio, GitHub Copilot should appear and prompt you to sign in.</p><h4>Enabling Terminal Integration</h4><p>If you want to use Copilot’s runInTerminal feature, one additional dependency is required: <strong>TM Terminal</strong>. Microsoft documents this requirement in their <a href="https://github.com/microsoft/copilot-eclipse-feedback/blob/main/TERMINAL-DEPENDENCY-GUIDE.md">Terminal Dependency Guide</a>.</p><p>Because Anypoint Studio 7.28 is based on Eclipse 2024–03, add the Eclipse 2024–03 update site (importantly, do not add this before Copilot is already installed): <a href="https://download.eclipse.org/releases/2024-03/">https://download.eclipse.org/releases/2024-03/</a></p><p>Once added, install <strong>TM Terminal</strong> from that repository. After another restart, Copilot’s terminal integration should be available.</p><h4>Using GitHub Enterprise? One extra step</h4><p>If you’re working with <strong>GitHub Enterprise (GHE)</strong>, there’s one small configuration you’ll want to do.</p><p>Open <strong>Preferences</strong>, navigate to <strong>GitHub Copilot → General</strong>, and add your enterprise GitHub URL in the authentication settings — for example:<br> <a href="https://company.ghe.com/">https://company.ghe.com</a></p><h4>Opening the Copilot chat</h4><p>Once everything is installed, you might not immediately see Copilot — and that’s normal.</p><p>Use the new <strong>Copilot → Open Chat</strong> menu entry to bring up the chat view. I personally prefer moving it from the bottom panel to the right‑hand side, where it feels more natural to work with while coding.</p><p>From there, sign in using <strong>“Sign in to use Copilot”</strong>. Depending on your setup, one more restart of Anypoint Studio may be required before everything fully kicks in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-AfentVGM5a7wp8je2AVtA.png" /><figcaption>Anypoint Studio with GitHub Copilot Chat</figcaption></figure><h3>So… is this “vibe coding” in Anypoint Studio?</h3><p>Let’s be honest: <strong>this is not MuleSoft Vibes</strong>.</p><p>GitHub Copilot doesn’t understand MuleSoft nearly as deeply, and it won’t magically know about your flows, connectors, or best practices. But for many day‑to‑day tasks — explaining code, getting quick suggestions, drafting snippets — it’s still genuinely helpful.</p><p>If Anypoint Code Builder isn’t an option right now, GitHub Copilot is a solid fallback. Not perfect — but definitely better than coding alone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7455194b07d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending MuleSoft Application Logs to RabbitMQ with JSON Logger]]></title>
            <link>https://medium.com/another-integration-blog/sending-mulesoft-application-logs-to-rabbitmq-with-json-logger-6ad65e5b5012?source=rss-dd3a71fb7988------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ad65e5b5012</guid>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[amqp]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <dc:creator><![CDATA[Matthias Transier]]></dc:creator>
            <pubDate>Wed, 14 Jan 2026 11:03:10 GMT</pubDate>
            <atom:updated>2026-01-14T12:54:27.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OfQKfmKVuG8bo99JVXqeMQ.png" /></figure><p>Logging is a critical aspect of any integration application, providing visibility into system behavior and helping diagnose issues quickly. The open-source <strong>JSON Logger</strong> is a popular choice for structured logging in MuleSoft applications, but did you know it can do more than just write logs to files or the console? One of its lesser-known features is the ability to send logs directly to a message queue, enabling real-time log processing and integration with external systems.</p><p>In this article, we will walk through how to configure <strong>RabbitMQ</strong> as a local message broker and connect it to MuleSoft’s JSON Logger using two different approaches: the <a href="https://docs.mulesoft.com/amqp-connector/latest/"><strong>MuleSoft AMQP connector</strong></a> and the <a href="https://docs.mulesoft.com/jms-connector/latest/"><strong>MuleSoft JMS connector</strong></a>. By the end, you will have a working setup that streams Mule application logs to RabbitMQ for further processing or monitoring.</p><h4>1. Set up RabbitMQ</h4><p>An easy way to get RabbitMQ up and running is by using the official Docker image. If you have Docker (or Podman) installed, launch the container with the following command:</p><pre>docker run -d --hostname my-rabbit --name rabbitmq -p 5672:5672 -p 15672:15672 docker.io/library/rabbitmq:3-management</pre><ul><li>--hostname avoids a random hostname</li><li>--name specifies the container name</li><li>Port 5672 is for AMQP, and port 15672 serves the web interface</li></ul><p>After launching the container, you can log in to the management interface at <a href="http://localhost:15672/">http://localhost:15672</a> using the default credentials:</p><ul><li>Username: guest</li><li>Password: guest</li></ul><h4>2. Create Queue and Exchange in RabbitMQ</h4><ol><li>Navigate to <a href="http://localhost:15672/#/queues">http://localhost:15672/#/queues</a> and add a new queue (e.g., logs) by clicking <strong>Add queue</strong>.</li><li>Go to <a href="http://localhost:15672/#/exchanges">http://localhost:15672/#/exchanges</a> and add a new exchange (e.g., log-exchange) by clicking <strong>Add exchange</strong>.</li><li><em>(Optional)</em> Bind the queue to the exchange by entering the queue name in the <strong>To queue</strong> field and clicking <strong>Bind</strong>.</li></ol><p>That is all we need for RabbitMQ. Later, the <strong>Overview</strong> tab will show incoming messages.</p><h4>3. Prepare Mule Application</h4><p>Create a new Mule app in your favorite IDE and add the JSON Logger dependency from Maven Central:</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;cloud.anypoint&lt;/groupId&gt;<br>  &lt;artifactId&gt;json-logger&lt;/artifactId&gt;<br>  &lt;version&gt;3.1.0&lt;/version&gt;<br>  &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>&lt;/dependency&gt;</pre><p>Add a simple flow with a <strong>Logger</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*kxur-PjAXUw09t34G8clZQ.png" /><figcaption>A simple flow with a logger</figcaption></figure><p>and configure the JSON Logger. For now, only the three mandatory fields are required:</p><ul><li>Application Name</li><li>Application Version</li><li>Environment</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*BEKydMv71tGwIQ804bVN5A.png" /><figcaption>The basic configuration for the JSON logger</figcaption></figure><p>Your application should now run and log each incoming request to the console and log file.</p><h4>4a. Connect Rabbit MQ using the MuleSoft AMQP Connector</h4><p>Add the AMQP connector dependency:</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;com.mulesoft.connectors&lt;/groupId&gt;<br>  &lt;artifactId&gt;mule-amqp-connector&lt;/artifactId&gt;<br>  &lt;version&gt;1.9.0&lt;/version&gt;<br>  &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>&lt;/dependency&gt;</pre><p>Configure AMQP:</p><pre>&lt;!-- AMQP Configuration for RabbitMQ --&gt;<br>&lt;amqp:config name=&quot;AMQP_Config&quot; doc:name=&quot;AMQP Config&quot; doc:id=&quot;amqp-config&quot;&gt;<br>  &lt;amqp:connection host=&quot;localhost&quot; port=&quot;5672&quot; username=&quot;guest&quot; password=&quot;guest&quot; /&gt;<br>&lt;/amqp:config&gt;</pre><p>Reference this configuration in the JSON Logger destination:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*hh7RGV7K3PV5kRNHHC6g-Q.png" /><figcaption>The AMQP destination config for JSON Logger</figcaption></figure><p>Once done, log entries should be sent to RabbitMQ and appear in the queue if you have connected the exchange and queue as described earlier. Check the <strong>Overview</strong> page at <a href="http://localhost:15672/">http://localhost:15672/</a>.</p><h4>4b. Connect Rabbit MQ using the MuleSoft JMS Connector</h4><p>This approach is more complex. Start by adding the following dependencies:</p><pre>&lt;!-- JMS Connector --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.mule.connectors&lt;/groupId&gt;<br>  &lt;artifactId&gt;mule-jms-connector&lt;/artifactId&gt;<br>  &lt;version&gt;1.10.2&lt;/version&gt;<br>  &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>&lt;/dependency&gt;<br>&lt;!-- RabbitMQ JMS Client --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;com.rabbitmq.jms&lt;/groupId&gt;<br>  &lt;artifactId&gt;rabbitmq-jms&lt;/artifactId&gt;<br>  &lt;version&gt;2.12.0&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;!-- Spring Module --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.mule.modules&lt;/groupId&gt;<br>  &lt;artifactId&gt;mule-spring-module&lt;/artifactId&gt;<br>  &lt;version&gt;2.1.1&lt;/version&gt;<br>  &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>&lt;/dependency&gt;<br>&lt;!-- Spring dependencies --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-core&lt;/artifactId&gt;<br>  &lt;version&gt;5.3.39&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-context&lt;/artifactId&gt;<br>  &lt;version&gt;5.3.39&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;<br>  &lt;version&gt;5.3.39&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;!-- Spring security dependencies --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;<br>  &lt;version&gt;5.8.16&lt;/version&gt;<br>  &lt;/dependency&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;<br>  &lt;version&gt;5.8.16&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-security-crypto&lt;/artifactId&gt;<br>  &lt;version&gt;5.8.16&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>To make these external dependencies visible despite class loader isolation, add them as <strong>shared libraries</strong> in the mule-maven-plugin configuration:</p><pre>&lt;plugin&gt;<br>  &lt;groupId&gt;org.mule.tools.maven&lt;/groupId&gt;<br>  &lt;artifactId&gt;mule-maven-plugin&lt;/artifactId&gt;<br>  &lt;version&gt;${mule.maven.plugin.version}&lt;/version&gt;<br>  &lt;extensions&gt;true&lt;/extensions&gt;<br>  &lt;configuration&gt;<br>    &lt;classifier&gt;mule-application&lt;/classifier&gt;<br>    &lt;sharedLibraries&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;com.rabbitmq.jms&lt;/groupId&gt;<br>        &lt;artifactId&gt;rabbitmq-jms&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.mule.connectors&lt;/groupId&gt;<br>        &lt;artifactId&gt;mule-jms-client&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-core&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-context&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>      &lt;sharedLibrary&gt;<br>        &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-security-crypto&lt;/artifactId&gt;<br>      &lt;/sharedLibrary&gt;<br>    &lt;/sharedLibraries&gt;<br>  &lt;/configuration&gt;<br>&lt;/plugin&gt;</pre><p>Next, define the global JMS configuration:</p><pre>&lt;jms:config name=&quot;JMS_Config&quot; doc:name=&quot;JMS Config&quot; doc:id=&quot;jms-config&quot;&gt;<br>  &lt;jms:generic-connection connectionFactory=&quot;rabbitConnectionFactory&quot; /&gt;<br>&lt;/jms:config&gt;<br><br>&lt;spring:config name=&quot;Spring_Config&quot; doc:name=&quot;Spring Config&quot; doc:id=&quot;spring-config&quot;<br>  files=&quot;spring-config.xml&quot; /&gt;</pre><p>Next, define the global JMS configuration and reference a connection factory in a Spring config file (/src/main/resources/spring-config.xml):</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;<br>       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>       xsi:schemaLocation=&quot;<br>         http://www.springframework.org/schema/beans<br>         http://www.springframework.org/schema/beans/spring-beans.xsd&quot;&gt;<br><br>    &lt;bean id=&quot;rabbitConnectionFactory&quot; class=&quot;com.rabbitmq.jms.admin.RMQConnectionFactory&quot;&gt;<br>        &lt;property name=&quot;username&quot; value=&quot;guest&quot;/&gt;<br>        &lt;property name=&quot;password&quot; value=&quot;guest&quot;/&gt;<br>        &lt;property name=&quot;virtualHost&quot; value=&quot;/&quot;/&gt;<br>        &lt;property name=&quot;host&quot; value=&quot;localhost&quot;/&gt;<br>        &lt;property name=&quot;port&quot; value=&quot;5672&quot;/&gt;<br>    &lt;/bean&gt;<br><br>&lt;/beans&gt;</pre><p>Once this is set up, the JSON Logger can reference the JMS config to send logs to RabbitMQ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*7RGJFvkzqSDrONXoZYU_1A.png" /><figcaption>The JMS destination config for JSON Logger</figcaption></figure><p><strong>Note:</strong> The JMS config expects a <strong>queue destination</strong>, while AMQP uses an <strong>exchange</strong>. After running your app, logs should appear in RabbitMQ, this time directly in the queue.</p><h3>Conclusion</h3><p>Streaming logs to a message queue opens up powerful possibilities for real-time monitoring, alerting, and integration with external systems. While both AMQP and JMS connectors can achieve this, the AMQP connector is clearly the simpler and more efficient choice for RabbitMQ. JMS remains useful for environments where AMQP isn’t supported, but it comes with additional complexity and dependencies.</p><p>If you’re already using MuleSoft and RabbitMQ, leveraging JSON Logger with the AMQP connector is a quick win for improving observability and scalability in your integration architecture. Try it out and take your logging strategy to the next level!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ad65e5b5012" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/sending-mulesoft-application-logs-to-rabbitmq-with-json-logger-6ad65e5b5012">Sending MuleSoft Application Logs to RabbitMQ with JSON Logger</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MUnit: Mocking Errors]]></title>
            <link>https://medium.com/@matthias.transier/munit-mocking-errors-c4238c714bd6?source=rss-dd3a71fb7988------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4238c714bd6</guid>
            <dc:creator><![CDATA[Matthias Transier]]></dc:creator>
            <pubDate>Thu, 16 Oct 2025 14:47:37 GMT</pubDate>
            <atom:updated>2025-10-16T14:47:37.786Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Avr5lLAW0HE61Qx9GqwrYg.png" /></figure><p>Unit testing is one of the earliest and most critical stages in the development cycle. The earlier bugs are identified, the more efficiently they can be resolved. MuleSoft provides the <strong>MUnit </strong>framework to create unit tests that mock external calls, allowing developers to validate behavior against any possible response from external systems.</p><p>Proper mocking is essential, and it’s worth paying close attention to the details. In particular, <strong>mocking error responses</strong> can be tricky — but we’ll get to that shortly. Let’s begin with the <strong>happy path</strong> scenarios.</p><h3><strong>Mocking Success Payloads</strong></h3><p>A Mule payload can come in various formats (see <a href="https://docs.mulesoft.com/dataweave/latest/dataweave-formats">DataWeave Formats</a>). Ideally, a mock should return the same format as the external system. If the system returns JSON, the mock should return JSON. If it returns XML, the mock should return XML. This ensures your code is tested under the most realistic conditions.</p><p>There are multiple places in a mock where the data format is referenced:</p><pre>&lt;munit-tools:payload<br>    value=&quot;#[<br>        output application/json<br>        ---<br>        readUrl(&#39;classpath://mock/response.json&#39;, &#39;application/json&#39;)<br>    ]&quot;<br>    mediaType=&quot;application/json&quot;<br>    encoding=&quot;UTF-8&quot; /&gt;</pre><ul><li>The output directive specifies the format produced by the mock.</li><li>The second parameter of readUrl() defines the format of the source file.</li><li>The mediaType attribute set smetadata for the payload. Without it, the test might behave differently due to missing metadata.</li></ul><h3>Mocking Error Payloads</h3><p>Mocking error responses is more complex. Error payloads are typically not stored in the regular Mule message payload but in the <strong>error object</strong> at error.errorMessage.payload.</p><p>This cannot be mocked using the &lt;munit-tools:mock-when/&gt; processor. Instead, you need to mock the <strong>server itself</strong> to return an error when requested. This can be done by creating a <strong>listener in the test configuration</strong> with a simple flow that throws an error. The listener should set an appropriate error code and response body:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*rm-oVhxeP0C61xTbMB9DOg.png" /><figcaption>A mock for creating error responses</figcaption></figure><p>You can call this mock server from your implementation (e.g., <a href="http://localhost:8081/mock/api)">http://localhost:8081/mock/api)</a> instead of the actual endpoint. This allows you to realistically test your error-handling logic.</p><p>If your code does not support injecting a different URL, you can use the <a href="https://docs.mulesoft.com/munit/latest/mock-event-processor#mock-using-then-call">“Then-Call” feature</a> to reference a flow that performs the request and returns the error.</p><h3>Final Thoughts</h3><p>Mocking both success and error responses accurately is key to robust unit testing. While success cases are straightforward, error scenarios require a bit more setup — but they are just as important to validate.</p><p>By using MUnit effectively, you can ensure your Mule applications are resilient and behave correctly under all conditions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4238c714bd6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating SAP Using MuleSoft]]></title>
            <link>https://medium.com/another-integration-blog/integrating-sap-using-mulesoft-5e88597c591c?source=rss-dd3a71fb7988------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e88597c591c</guid>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[sap-integration]]></category>
            <dc:creator><![CDATA[Matthias Transier]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 22:20:18 GMT</pubDate>
            <atom:updated>2025-10-07T14:33:00.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCrTpLjy2k0O18gvUM214w.png" /></figure><p>While SAP offers its own integration platform — <strong>SAP Cloud Platform Integration (SAP CPI) </strong>— you might consider the more powerful <strong>MuleSoft Anypoint Platform</strong> to integrate your SAP systems. MuleSoft provides the <a href="https://docs.mulesoft.com/sap-connector/latest/">SAP Connector</a>, which enables seamless integration with SAP systems. This connector leverages the <strong>SAP Java Connector (SAP JCo)</strong> libraries to establish technical connections, invoke and expose Remote Function Modules (both synchronously and asynchronously) and parse IDocs. So you can even connect SAP to SAP — all within MuleSoft.</p><p>Secure connections require some additional setup. You’ll need the <a href="https://help.sap.com/doc/saphelp_nw75/7.5.5/en-US/6c/5b0b37233f7c6fe10000009b38f936/frameset.htm">SAP Cryptographic Library</a> and the <a href="https://help.sap.com/docs/Convergent_Charging/d1d04c0d65964a9b91589ae7afc1bd45/467291d0dc104d19bba073a0380dc6b4.html?locale=en-US">SAPCAR</a> tool to unpack the SAR archive of the SAPCRYPTOLIB.</p><h3>1. Preparing the JCo Libraries for MuleSoft</h3><h4>Download the Required Libraries and Tools</h4><p>You’ll need an SAP Support Portal account to download the following files. This article covers setup for Windows (64-bit x86) and Linux (64-bit x86).</p><h4>For Windows (64-bit x86):</h4><ul><li>sapjco31P_12–20009381.zip</li><li>SAPCRYPTOLIBP_8559–20011729.SAR</li><li>SAPCAR_1400–70007719.EXE (for unpacking on Windows)</li></ul><h4>For Linux (64-bit x86):</h4><ul><li>sapjco31P_12–70004517.zip</li><li>SAPCRYPTOLIBP_8559–20011697.SAR</li><li>SAPCAR_1400–70007716.EXE (for unpacking on Linux)</li></ul><h4>IDoc Library:</h4><ul><li>sapjidoc31P_4–80004914.zip</li></ul><h3>2. Deploying the Libraries</h3><p>Organize the libraries into three folders:</p><ul><li>ntamd64 (for Windows)</li><li>linuxx86_64 (for Linux)</li><li>common (for platform-independent files)</li></ul><p>Then, run the unpacking script:</p><pre>#/bin/bash<br>IDOC_VER=4-80004914<br><br>WIN_PLATFORM=ntamd64<br>WIN_JCO_VER=12-20009381<br>WIN_CRYPTO_VER=8559-20011729<br>WIN_CAR_VER=1400-70007719<br><br>LINUX_PLATFORM=linuxx86_64<br>LINUX_JCO_VER=12-70004517<br>LINUX_CRYPTO_VER=8559-20011697<br>LINUX_CAR_VER=1400-70007716<br><br>JCO_SEMVER=3.1.12<br><br>rm -rf target<br>mkdir -p target/common<br>mkdir target/linuxx86_64<br>mkdir target/ntamd64<br><br>unzip -o common/sapjidoc31P_${IDOC_VER}.zip -d target/common/ sapidoc3.jar<br><br>unzip -o linuxx86_64/sapjco31P_${LINUX_JCO_VER}.zip -d target/linuxx86_64/ sapjco3-linuxx86_64-${JCO_SEMVER}.tgz<br>tar xzvf target/linuxx86_64/sapjco3-linuxx86_64-${JCO_SEMVER}.tgz -C target/linuxx86_64/ libsapjco3.so<br>tar xzvf target/linuxx86_64/sapjco3-linuxx86_64-${JCO_SEMVER}.tgz -C target/common/ sapjco3.jar<br>unzip -o ntamd64/sapjco31P_${WIN_JCO_VER}.zip -d target/ntamd64/<br>unzip -o target/ntamd64/sapjco3-ntamd64-${JCO_SEMVER}.zip -d target/ntamd64/ sapjco3.dll<br><br>chmod a+x linuxx86_64/SAPCAR_${LINUX_CAR_VER}.EXE<br>linuxx86_64/SAPCAR_${LINUX_CAR_VER}.EXE -xvf linuxx86_64/SAPCRYPTOLIBP_${LINUX_CRYPTO_VER}.SAR -R target/linuxx86_64/ libsapcrypto.so<br>linuxx86_64/SAPCAR_${LINUX_CAR_VER}.EXE -xvf ntamd64/SAPCRYPTOLIBP_${WIN_CRYPTO_VER}.SAR -R target/ntamd64/ sapcrypto.dll</pre><p>This will produce the following relevant files:</p><pre>target/common/sapidoc3.jar<br>target/common/sapjco3.jar<br>target/linuxx86_64/libsapcrypto.so<br>target/linuxx86_64/libsapjco3.so<br>target/ntamd64/sapcrypto.dll<br>target/ntamd64/sapjco3.dll</pre><p>SAP does not permit renaming the sapjco3.jar file, which prevents it from being deployed via Maven. All other files can be deployed to the Maven repository as usual.</p><h4>Installing to Local Maven Repository</h4><p>Use the following script to install the libraries locally (adjust semantic versions as needed):</p><pre>#!/bin/bash<br>IDOC_SEMVER=${IDOC_SEMVER:-3.1.4}<br>JCO_SEMVER=${JCO_SEMVER:-3.1.12}<br>CRYPTO_SEMVER=${CRYPTO_SEMVER:-8.5.59.0}<br><br>mvn install:install-file -DgroupId=com.sap.conn.idoc -DartifactId=com.sap.conn.idoc.sapidoc3 -Dversion=${IDOC_SEMVER} -Dpackaging=jar -Dfile=target/common/sapidoc3.jar<br>mvn install:install-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=${JCO_SEMVER} -Dclassifier=linuxx86_64 -Dpackaging=so -Dfile=target/linuxx86_64/libsapjco3.so<br>mvn install:install-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=${JCO_SEMVER} -Dclassifier=ntamd64 -Dpackaging=dll -Dfile=target/ntamd64/sapjco3.dll<br>mvn install:install-file -DgroupId=com.sap.conn.crypto -DartifactId=sapcrypto -Dversion=${CRYPTO_SEMVER} -Dclassifier=linuxx86_64 -Dpackaging=so -Dfile=target/linuxx86_64/libsapcrypto.so<br>mvn install:install-file -DgroupId=com.sap.conn.crypto -DartifactId=sapcrypto -Dversion=${CRYPTO_SEMVER} -Dclassifier=ntamd64 -Dpackaging=dll -Dfile=target/ntamd64/sapcrypto.dll</pre><h4>Deploying to a Remote Repository</h4><p>To deploy to a remote repository (e.g., Nexus or Artifactory), use the deploy goal instead of install. Ensure your credentials are stored in settings.xml under the same ID as your repository name:</p><pre>#/bin/bash<br>IDOC_SEMVER=${IDOC_SEMVER:-3.1.4}<br>JCO_SEMVER=${JCO_SEMVER:-3.1.12}<br>CRYPTO_SEMVER=${CRYPTO_SEMVER:-8.5.59.0}<br><br>REPO=${REPO:-your-repo-name}<br>REPO_URL=${REPO_URL:-https://your.nexus.url/repository/${REPO}/}<br><br>mvn deploy:deploy-file -DgroupId=com.sap.conn.idoc -DartifactId=com.sap.conn.idoc.sapidoc3 -Dversion=${IDOC_SEMVER} -Dpackaging=jar -Dfile=target/common/sapidoc3.jar -DrepositoryId=${REPO} -Durl=${REPO_URL}<br>mvn deploy:deploy-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=${JCO_SEMVER} -Dclassifier=linuxx86_64 -Dpackaging=so -Dfile=target/linuxx86_64/libsapjco3.so -DrepositoryId=${REPO} -Durl=${REPO_URL}<br>mvn deploy:deploy-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=${JCO_SEMVER} -Dclassifier=ntamd64 -Dpackaging=dll -Dfile=target/ntamd64/sapjco3.dll -DgeneratePom=false -DrepositoryId=${REPO} -Durl=${REPO_URL}<br>mvn deploy:deploy-file -DgroupId=com.sap.conn.crypto -DartifactId=sapcrypto -Dversion=${CRYPTO_SEMVER} -Dclassifier=linuxx86_64 -Dpackaging=so -Dfile=target/linuxx86_64/libsapcrypto.so -DrepositoryId=${REPO} -Durl=${REPO_URL}<br>mvn deploy:deploy-file -DgroupId=com.sap.conn.crypto -DartifactId=sapcrypto -Dversion=${CRYPTO_SEMVER} -Dclassifier=ntamd64 -Dpackaging=dll -Dfile=target/ntamd64/sapcrypto.dll -DgeneratePom=false -DrepositoryId=${REPO} -Durl=${REPO_URL}</pre><h3>3. Setting Up the pom.xml</h3><p>In a multi-module Maven setup, define the library versions in the parent pom.xml:</p><pre>    &lt;dependencyManagement&gt;<br>        &lt;dependencies&gt;<br>           &lt;dependency&gt;<br>                &lt;groupId&gt;com.mulesoft.connectors&lt;/groupId&gt;<br>                &lt;artifactId&gt;mule-sap-connector&lt;/artifactId&gt;<br>                &lt;version&gt;5.9.12&lt;/version&gt;<br>                &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.idoc&lt;/groupId&gt;<br>                &lt;artifactId&gt;com.sap.conn.idoc.sapidoc3&lt;/artifactId&gt;<br>                &lt;version&gt;3.1.4&lt;/version&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>                &lt;artifactId&gt;sapjco3&lt;/artifactId&gt;<br>                &lt;version&gt;3.1.12&lt;/version&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>                &lt;artifactId&gt;libsapjco3&lt;/artifactId&gt;<br>                &lt;version&gt;3.1.12&lt;/version&gt;<br>                &lt;classifier&gt;linuxx86_64&lt;/classifier&gt;<br>                &lt;type&gt;so&lt;/type&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.crypto&lt;/groupId&gt;<br>                &lt;artifactId&gt;sapcrypto&lt;/artifactId&gt;<br>                &lt;version&gt;8.5.59.0&lt;/version&gt;<br>                &lt;classifier&gt;linuxx86_64&lt;/classifier&gt;<br>                &lt;type&gt;so&lt;/type&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>                &lt;artifactId&gt;libsapjco3&lt;/artifactId&gt;<br>                &lt;version&gt;3.1.12&lt;/version&gt;<br>                &lt;classifier&gt;ntamd64&lt;/classifier&gt;<br>                &lt;type&gt;dll&lt;/type&gt;<br>            &lt;/dependency&gt;<br>            &lt;dependency&gt;<br>                &lt;groupId&gt;com.sap.conn.crypto&lt;/groupId&gt;<br>                &lt;artifactId&gt;sapcrypto&lt;/artifactId&gt;<br>                &lt;version&gt;8.5.59.0&lt;/version&gt;<br>                &lt;classifier&gt;ntamd64&lt;/classifier&gt;<br>                &lt;type&gt;dll&lt;/type&gt;<br>            &lt;/dependency&gt;<br>        &lt;/dependencies&gt;<br>    &lt;/dependencyManagement&gt;</pre><p>The pom.xml of your application, which will be using the SAP Connector, will look similar to this (leaving out parts, which are not relevant to the SAP connector):</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br><br>    &lt;parent&gt;<br>        &lt;groupId&gt;your-org-id&lt;/groupId&gt;<br>        &lt;artifactId&gt;mule-parent&lt;/artifactId&gt;<br>        &lt;version&gt;1.0.0&lt;/version&gt;<br>    &lt;/parent&gt;<br><br>    &lt;groupId&gt;your-org-id&lt;/groupId&gt;<br>    &lt;artifactId&gt;sapi-sap&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;<br>    &lt;packaging&gt;mule-application&lt;/packaging&gt;<br><br>    &lt;name&gt;sapi-sap&lt;/name&gt;<br>    &lt;description&gt;System API for connecting to SAP&lt;/description&gt;<br><br>    &lt;properties&gt;<br>        &lt;native.lib.classifier&gt;linuxx86_64&lt;/native.lib.classifier&gt;<br>        &lt;native.lib.type&gt;so&lt;/native.lib.type&gt;<br>    &lt;/properties&gt;<br><br>    &lt;build&gt;<br>        &lt;plugins&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.mule.tools.maven&lt;/groupId&gt;<br>                &lt;artifactId&gt;mule-maven-plugin&lt;/artifactId&gt;<br>                &lt;configuration&gt;<br>                    &lt;sharedLibraries&gt;<br>                        &lt;sharedLibrary&gt;<br>                            &lt;groupId&gt;com.sap.conn.idoc&lt;/groupId&gt;<br>                            &lt;artifactId&gt;com.sap.conn.idoc.sapidoc3&lt;/artifactId&gt;<br>                        &lt;/sharedLibrary&gt;<br>                        &lt;sharedLibrary&gt;<br>                            &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>                            &lt;artifactId&gt;sapjco3&lt;/artifactId&gt;<br>                        &lt;/sharedLibrary&gt;<br>                        &lt;sharedLibrary&gt;<br>                            &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>                            &lt;artifactId&gt;libsapjco3&lt;/artifactId&gt;<br>                        &lt;/sharedLibrary&gt;<br>                    &lt;/sharedLibraries&gt;<br>                &lt;/configuration&gt;<br>            &lt;/plugin&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>                &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;3.6.1&lt;/version&gt;<br>                &lt;executions&gt;<br>                    &lt;execution&gt;<br>                        &lt;phase&gt;package&lt;/phase&gt;<br>                        &lt;goals&gt;<br>                            &lt;goal&gt;shade&lt;/goal&gt;<br>                        &lt;/goals&gt;<br>                        &lt;configuration&gt;<br>                            &lt;artifactSet&gt;<br>                                &lt;includes&gt;<br>                                    &lt;include&gt;com.sap.conn.jco:sapjco3&lt;/include&gt;<br>                                &lt;/includes&gt;<br>                            &lt;/artifactSet&gt;<br>                            &lt;extraJars&gt;<br>                                &lt;extraJar&gt;lib/sapjco3.jar&lt;/extraJar&gt;<br>                            &lt;/extraJars&gt;<br>                        &lt;/configuration&gt;<br>                    &lt;/execution&gt;<br>                &lt;/executions&gt;<br>            &lt;/plugin&gt;<br>        &lt;/plugins&gt;<br>    &lt;/build&gt;<br><br>    &lt;dependencies&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.mulesoft.connectors&lt;/groupId&gt;<br>            &lt;artifactId&gt;mule-sap-connector&lt;/artifactId&gt;<br>            &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.sap.conn.idoc&lt;/groupId&gt;<br>            &lt;artifactId&gt;com.sap.conn.idoc.sapidoc3&lt;/artifactId&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>            &lt;artifactId&gt;sapjco3&lt;/artifactId&gt;<br>            &lt;scope&gt;system&lt;/scope&gt;<br>            &lt;systemPath&gt;${basedir}/lib/sapjco3.jar&lt;/systemPath&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.sap.conn.jco&lt;/groupId&gt;<br>            &lt;artifactId&gt;libsapjco3&lt;/artifactId&gt;<br>            &lt;classifier&gt;${native.lib.classifier}&lt;/classifier&gt;<br>            &lt;type&gt;${native.lib.type}&lt;/type&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.sap.conn.crypto&lt;/groupId&gt;<br>            &lt;artifactId&gt;sapcrypto&lt;/artifactId&gt;<br>            &lt;classifier&gt;${native.lib.classifier}&lt;/classifier&gt;<br>            &lt;type&gt;${native.lib.type}&lt;/type&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br><br>    &lt;profiles&gt;<br>        &lt;profile&gt;<br>            &lt;id&gt;windows&lt;/id&gt;<br>            &lt;activation&gt;<br>                &lt;os&gt;<br>                    &lt;family&gt;Windows&lt;/family&gt;<br>                &lt;/os&gt;<br>            &lt;/activation&gt;<br>            &lt;properties&gt;<br>                &lt;native.lib.classifier&gt;ntamd64&lt;/native.lib.classifier&gt;<br>                &lt;native.lib.type&gt;dll&lt;/native.lib.type&gt;<br>            &lt;/properties&gt;<br>        &lt;/profile&gt;<br>    &lt;/profiles&gt;<br>&lt;/project&gt;</pre><p>The key sections are:</p><ul><li>&lt;properties/&gt;: Defines default platform (Linux by default).</li><li>&lt;plugins/&gt;: The configuration of the mule-maven-plugin makes sure the SAP libraries are visible to the SAP connector. The maven-shade-plugin adds the classes from the sapjco3.jar to the jar, effectively satisfying the internal renaming checks of the jar. See also this <a href="https://help.salesforce.com/s/articleView?id=005108677&amp;type=1">help article</a>.</li><li>&lt;dependencies/&gt;: Uses placeholders for platform-independent configuration and includes the JCo JARs from the project folder /lib. The native libs are referenced from the maven repository.</li><li>&lt;profile/&gt;: Automatically switches to Windows-specific libraries when building on Windows. Similarly, define the same for MacOS if required.</li></ul><h4>Placing the JCo JARs</h4><p>Since sapjco3.jar cannot be distributed via Maven due to SAP’s licensing restrictions, it must be stored locally within your project. Create a /lib folder in your project root and copy the JAR file there.</p><h3>4. Configuring the SAP Connector</h3><p>When creating an SAP configuration in your Mule application, it should resemble the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*Sk0W-a5FY5mkbfLWr8l8ow.png" /><figcaption>The general settings for the SAP connection</figcaption></figure><p>✅ Green checkmarks indicate that all required libraries are found.</p><p>For the <strong>Simple Connection Provider</strong>, provide:</p><ul><li>Username</li><li>Password</li><li>SAP system number</li><li>SAP client ID</li><li>Application server host</li></ul><p>The <strong>sapcrypto </strong>library is only required when setting up Secure Network Communication (SNC), which involves additional configuration (see the <a href="https://docs.mulesoft.com/sap-connector/latest/sap-connector-config-snc">MuleSoft documentation</a>).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e88597c591c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/integrating-sap-using-mulesoft-5e88597c591c">Integrating SAP Using MuleSoft</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Large Files to AWS S3 with MuleSoft]]></title>
            <link>https://medium.com/@matthias.transier/streaming-large-files-to-aws-s3-with-mulesoft-fd1730e8ddd3?source=rss-dd3a71fb7988------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd1730e8ddd3</guid>
            <category><![CDATA[data-streaming]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[aws-s3]]></category>
            <dc:creator><![CDATA[Matthias Transier]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 10:21:07 GMT</pubDate>
            <atom:updated>2025-07-11T10:21:07.671Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*27F5JvnDcVukEc1ZQwM7fA.png" /></figure><p>While there are many articles and videos covering various aspects of streaming in MuleSoft, this article focues on a very specific use case: streaming files to the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">AWS S3 API</a> via a PUT request.</p><h3>Mule Streaming vs. HTTP Streaming</h3><p>In the context of MuleSoft, <em>streaming </em>typically refers to how payloads are handled within a flow. It allows data to be processed and passed to the next processor while it is still being received. This means the processor doesn’t need to store the entire payload in memory, which is especially useful when dealing with large files.</p><p>In contrast, <em>HTTP streaming</em> refers to using <a href="https://en.wikipedia.org/wiki/Chunked_transfer_encoding">chunked transfer encoding</a>. When an HTTP request is streamed, the client omits the Content-Length header and instead specifies Transfer-Encoding: chunked. The receiver then processes an unspecified number of data chunks until the sender signals the end of the transmission.</p><p>In MuleSoft’s HTTP request processor, these two streaming concepts are tightly coupled. Unfortunately, the AWS S3 API does <strong>not</strong> support HTTP streaming, which means Mule streaming won’t work out of the box.</p><h3>What is Required for Mule Streaming?</h3><p>To stream payloads through a Mule flow, every processor in the chain must support streaming.</p><p>Let’s say we want to receive a CSV file via HTTPS, add an id column, and send it via HTTPS to another system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*TAmaCzdcTr9aRci0u_jWNA.png" /><figcaption>A basic flow streaming data through HTTP</figcaption></figure><ul><li>The HTTP Listener supports streaming by configuring the output MIME type like this:</li></ul><pre>&lt;http:listener doc:name=&quot;Listener&quot;<br>      outputMimeType=&quot;application/csv; streaming=true&quot;<br>      config-ref=&quot;HTTP_Listener_config&quot; path=&quot;/input&quot;/&gt;</pre><ul><li>The Transform Message component with a DataWeave transformation must specify the deferred property:</li></ul><pre>output application/csv deferred=true<br>---<br>payload map ({ id: $$ } ++ $)</pre><ul><li>The HTTP Request processor doesn’t require special configuration, as its default (AUTO) enables streaming if the payload is a stream. Alternatively, you can explicitly set it:</li></ul><pre>&lt;http:request method=&quot;GET&quot; requestStreamingMode=&quot;ALWAYS&quot;<br>      config-ref=&quot;HTTP_Request_configuration&quot; path=&quot;/path&quot;/&gt;</pre><p>This is where Mule streaming and HTTP streaming intersect: the HTTP Request connector will only stream data from the flow if it uses chunked transfer encoding. But since AWS S3 does not allow chunked encoding, this approach won’t work.</p><h3>The solution</h3><p>Suppose you know the size and MD5 checksum of the payload. In that case, you can theoretically use the AWS S3 API by sending a Content-Length header. But how can you stream data through Mule while also sending a Content-Length header?</p><p>With standard Mule mechanisms, you can’t.</p><p>Instead, stream the data to a connector that supports streaming — like the File connector — to temporarily store the payload on disk:</p><pre>&lt;file:write path=”temp.csv” /&gt;</pre><p>Then, use curl to upload the file to AWS S3:</p><pre>curl --upload-file temp.csv \<br>  --header &#39;Content-Type: application/csv&#39; \<br>  --header &#39;Content-Length: &lt;size in bytes&gt;&#39; \<br>  --header &#39;Content-MD5: &lt;MD5 checksum of payload&gt;&#39; \<br>  https://bucket-name.s3express-zone-id.region-code.amazonaws.com/</pre><p>The --upload-file flag uses PUT by default. By specifying the Content-Length, the request avoids chunked encoding—meeting AWS S3’s requirements.4</p><h4>Calling curl from Mule</h4><p>To do this from Mule, implement a Java class with a static method that uses <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ProcessBuilder.html">ProcessBuilder</a> to invoke the curl command:</p><pre>package org.mydomain;<br><br>import java.io.IOException;<br>import java.io.SequenceInputStream;<br>import java.util.ArrayList;<br>import java.util.List;<br>import java.util.Scanner;<br><br>public class Request {<br><br>    private Request() {<br>    }<br><br>    public static String curl(https://medium.com/String%20url,%20String[]%20headers,%20String%20file)<br>            throws IOException, InterruptedException {<br>        List&lt;String&gt; command = new ArrayList&lt;&gt;();<br>        command.add(&quot;curl&quot;);<br>        command.add(&quot;-s&quot;); // -s silent mode<br>        command.add(&quot;-S&quot;); // -S show error<br>        command.add(&quot;-f&quot;); // -f fail on HTTP errors<br>        command.add(&quot;-T&quot;); // -T transfer file<br>        command.add(file);<br>        for (String header : headers) {<br>            command.add(&quot;-H&quot;); // -H add headers<br>            command.add(header);<br>        }<br>        command.add(url);<br>        return execute(new ProcessBuilder(command));<br>    }<br><br>    private static String execute(ProcessBuilder pb) throws IOException, InterruptedException {<br>        Process p = pb.start();<br>        SequenceInputStream sis = new SequenceInputStream(p.getInputStream(), p.getErrorStream());<br>        try (Scanner s = new java.util.Scanner(sis).useDelimiter(&quot;\\A&quot;)) {<br>            if (p.waitFor() != 0) {<br>                throw new RuntimeException(s.hasNext() ? s.next() : &quot;no error message available&quot;);<br>            }<br>            return s.hasNext() ? s.next() : &quot;&quot;;<br>        }<br>    }<br>}</pre><p>Don’t forget to delete the temporary file afterwards.</p><h3>Final Thoughts</h3><p>The whole flow then looks approximately like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*85PcWDv5Ws0zEWWbKZ2A_w.png" /><figcaption>Flow to stream a file using curl in a static Java method</figcaption></figure><p>While this approach works, it’s more of a workaround than a best-practice solution. Be sure to implement proper error handling and cleanup logic to ensure robustness.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd1730e8ddd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>