<?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 Aakash Kesarwani on Medium]]></title>
        <description><![CDATA[Stories by Aakash Kesarwani on Medium]]></description>
        <link>https://medium.com/@aakashkesarwani40?source=rss-b29c34416697------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*atNFAVNPU8_vGCiYUfoa6g.jpeg</url>
            <title>Stories by Aakash Kesarwani on Medium</title>
            <link>https://medium.com/@aakashkesarwani40?source=rss-b29c34416697------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 06:33:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aakashkesarwani40/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[ Simplifying Secure MuleSoft ↔ Salesforce Connectivity with JWT-Bearer OAuth]]></title>
            <link>https://medium.com/@aakashkesarwani40/simplifying-secure-mulesoft-salesforce-connectivity-with-jwt-bearer-oauth-54c9fb8d1aa2?source=rss-b29c34416697------2</link>
            <guid isPermaLink="false">https://medium.com/p/54c9fb8d1aa2</guid>
            <dc:creator><![CDATA[Aakash Kesarwani]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 14:30:21 GMT</pubDate>
            <atom:updated>2026-01-23T14:30:21.083Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iB8XIbqZKg2rf-9afbjoqQ.png" /></figure><p>Integrating Salesforce with MuleSoft is a powerful pattern in modern enterprise landscapes — especially for server-to-server use cases where seamless, secure authentication is critical. One of the most robust ways to achieve this is by leveraging <strong>JWT-Bearer OAuth</strong>, eliminating the need for user interaction and improving security posture.</p><p>In this article, I’ll walk through a practical, end-to-end approach to configure a secure MuleSoft-Salesforce integration using the JWT-Bearer OAuth flow.</p><h3>🔐 Why JWT-Bearer OAuth?</h3><p>JWT (JSON Web Token) is a compact, URL-safe token format that can securely convey authentication claims between parties. When used in Salesforce’s OAuth framework, it enables MuleSoft to obtain access tokens without storing sensitive credentials or requiring interactive logins — ideal for automated, reliable integrations.</p><h3>🛠️ Step 1 — Generate Your Certificate in Salesforce</h3><p>To initiate the JWT authentication flow, Salesforce must trust the signing identity of the MuleSoft application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xh0dtWLKRi3V-Dsc" /></figure><ol><li>Open <strong>Setup</strong> in Salesforce.</li><li>Search for <strong>Certificate and Key Management</strong>.</li><li>Click <strong>Create Self-Signed Certificate</strong>.</li><li>Give it a descriptive label (e.g., MuleJWTCert) and save.</li><li>Once created, <strong>download the certificate</strong> (.crt file).</li><li>Export it to a <strong>Java Keystore (.jks)</strong> so Mule can use it for signing JWTs later.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SjC1hiDf2arTgUgj" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GTUlD5_5US90Naoa" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GTUlD5_5US90Naoa" /></figure><h3>⚙️ Step 2 — Create the Connected App in Salesforce</h3><p>Next, you need a Connected App that represents MuleSoft as an OAuth-trusted client:</p><ol><li>Go to <strong>App Manager</strong> &gt; <strong>New Connected App</strong>.</li><li>Add essential details (Name, Contact Email, etc.).</li><li>Enable <strong>OAuth Settings</strong> and tick <strong>JWT Bearer Token Flow</strong>.</li><li>Upload the certificate from Step 1 under the JWT section.</li><li>Configure the required OAuth scopes (e.g., access to APIs).</li><li>Save and proceed.</li></ol><p>Once saved, Salesforce will generate a <strong>Consumer Key/Client ID</strong>. You’ll need this in your Mule configuration.</p><h3>🔗 Step 3 — Configure MuleSoft with JWT Authentication</h3><p>Now let’s wire this into your Mule application:</p><ol><li><strong>Create a Mule project</strong> in Anypoint Studio.</li><li>Add the <strong>Salesforce Connector</strong> to your project.</li><li>Import the .jks keystore into your project’s resources.</li><li>In the Salesforce Connector configuration, choose <strong>OAuth JWT</strong> as the authentication type.</li><li>Supply:</li></ol><ul><li><em>Consumer Key</em> (from Salesforce)</li><li><em>Keystore path</em></li><li><em>Keystore password</em></li><li><em>Alias</em> of the keypair within the keystore</li><li><em>Salesforce Login URL</em> (production vs sandbox)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XGEY89xm7SoX05N1" /></figure><p>6. Test the connection.</p><p>Mule will generate a signed JWT using the private key and exchange it for an <strong>access token</strong> from Salesforce, which can then be used for API calls securely.</p><h3>🧪 Step 4 — Validate and Use Your Integration</h3><p>Once everything is configured:</p><ul><li>Use <strong>Test Connection</strong> in Anypoint Studio to confirm Mule can successfully authenticate and is authorized in Salesforce.</li><li>Build flows that make API calls (e.g., querying objects, creating records) with the connector.</li><li>Monitor for access token expiration and automated refresh, which is handled transparently by Mule when configured correctly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*6cYAMBXWyx7gdud7" /></figure><h3>🎯 Benefits of This Pattern</h3><p>✔ <strong>No interactive logins required</strong> — perfect for headless automation.<br> ✔ <strong>Stronger security guarantees</strong> — JWT tokens are signed with your private key.<br> ✔ <strong>Centralized credentials</strong> — reduces surface area for leaks or compromised secrets.<br> ✔ <strong>Scalable for production</strong> — ideal for high-throughput, long-running integrations.</p><h3>✨ Final Thoughts</h3><p>Using the <strong>JWT-Bearer OAuth flow</strong> for MuleSoft-Salesforce integrations sets a strong foundation for secure, scalable, and maintainable system communication. It aligns with industry best practices and modern identity standards — helping you deliver robust enterprise solutions without sacrificing security or flexibility.</p><p>Have you implemented JWT-based authentication in your Mule projects? Drop a comment or send me a DM — always happy to share patterns and learn from real-world experiences! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54c9fb8d1aa2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No More Manual Replays: Automating Failed Transaction Replays in MuleSoft Anypoint Partner Manager]]></title>
            <link>https://medium.com/@aakashkesarwani40/no-more-manual-replays-automating-failed-transaction-replays-in-mulesoft-anypoint-partner-manager-041340c67726?source=rss-b29c34416697------2</link>
            <guid isPermaLink="false">https://medium.com/p/041340c67726</guid>
            <dc:creator><![CDATA[Aakash Kesarwani]]></dc:creator>
            <pubDate>Tue, 20 May 2025 09:18:00 GMT</pubDate>
            <atom:updated>2025-05-20T09:22:03.758Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In today’s fast-moving digital economy, <strong>40% of B2B integrations experience failures</strong> due to downtime, data mismatches, or transient errors. For enterprises relying on <strong>Anypoint Partner Manager (APM)</strong>, manual intervention for retries is unsustainable, delaying SLAs, increasing costs, and straining IT teams.</p><p>We help businesses <strong>modernize integration landscapes</strong> with automation and intelligent error handling. In this blog, we’ll explore how we leveraged <strong>MuleSoft Platform APIs</strong> to build a <strong>self-healing replay mechanism</strong> for failed transactions, reducing resolution time from hours to minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*9gkJbg7k3f8L5KeSsNb8rQ.png" /></figure><h3>Why Automate Transaction Replays?</h3><p>Manual retry processes introduce three critical challenges:</p><ul><li><strong>Operational Overhead</strong>: Teams waste hours monitoring and replaying failures.</li><li><strong>SLA Risks</strong>: Delayed retries impact partner performance guarantees.</li><li><strong>Limited Scalability</strong>: Human-dependent workflows break under high transaction volumes.</li></ul><p>By automating retries with <strong>MuleSoft’s native APIs</strong>, organizations gain:</p><ul><li><strong>Faster recovery</strong> from transient errors (e.g., network timeouts).</li><li><strong>Consistent SLAs</strong> with configurable retry thresholds.</li><li><strong>Proactive alerts</strong> for unresolved failures requiring human review.</li></ul><h3>Automation Flow Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*J1tJUejowvdEoLXb20sEJQ.png" /></figure><h3>Step-by-Step Process:</h3><ol><li><strong>Pull the Timestamp</strong> from the Object Store for the last run.</li><li><strong>Query APM</strong> for failed transactions since that timestamp.</li><li><strong>Evaluate Each Transaction</strong>:</li></ol><ul><li>If isReplay = false → Push to Anypoint MQ.</li><li>If isReplay = true and replayCount &lt; 10 → Fetch original ID, push to MQ.</li><li>If replayCount &gt;= 10 → Trigger an alert email.</li></ul><p><strong>4. Update the Object Store</strong> with the new timestamp.</p><p><strong>5. Replay Consumer</strong> picks messages from MQ and calls the replay API.</p><h3>APIs Used in the Replay Workflow</h3><p>We utilize <strong>Anypoint Platform Tracking APIs</strong> for APM to orchestrate the entire retry lifecycle. Here’s a breakdown:</p><h3>1. Get Access Token</h3><p>Authenticate with the platform:</p><pre>curl --location &#39;https://&lt;region&gt;.anypoint.mulesoft.com/accounts/api/v2/oauth2/token&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--data-urlencode &#39;client_id=&lt;CLIENT_ID&gt;&#39; \<br>--data-urlencode &#39;client_secret=&lt;CLIENT_SECRET&gt;&#39; \<br>--data-urlencode &#39;grant_type=client_credentials&#39;</pre><h3>2. Fetch Failed Transactions</h3><p>Query errored outbound transactions:</p><pre>curl --location &#39;https://&lt;region&gt;.anypoint.mulesoft.com/partnermanager/tracking/api/v1/...&amp;status=ERRORED&#39; \<br>--header &#39;Authorization: Bearer &lt;ACCESS_TOKEN&gt;&#39;</pre><h3>3. Get Transaction Details</h3><p>Determine if a replay is eligible:</p><pre>curl --location &#39;.../transmissions/&lt;TRANSACTION_ID&gt;&#39; \<br>--header &#39;Authorization: Bearer &lt;ACCESS_TOKEN&gt;&#39;</pre><h3>4. Replay Transaction</h3><p>Trigger the replay via API:</p><pre>curl --location --request POST &#39;.../transmissions/&lt;TRANSACTION_ID&gt;/replays&#39; \<br>--header &#39;Authorization: Bearer &lt;ACCESS_TOKEN&gt;&#39;</pre><blockquote><em>⚠️ </em><strong><em>Note</em></strong><em>: Only </em>original<em> transmissions can be replayed. For already replayed transactions, fetch the root transaction ID first.</em></blockquote><h3>Critical Considerations</h3><ul><li><strong>Idempotency</strong>: Ensure retries don’t duplicate side effects (e.g., duplicate orders).</li><li><strong>Auditability</strong>: Log all replay attempts (transaction ID, timestamp, status).</li><li><strong>Backoff Strategies</strong>: Add delays between retries for rate-limited partners.</li></ul><h3>Business Impact</h3><p>This solution helped a <strong>global logistics client</strong> achieve:</p><ul><li><strong>80% reduction</strong> in manual retry efforts.</li><li><strong>99.5% SLA compliance</strong> for partner integrations.</li><li><strong>Proactive alerts</strong> for chronic failures (e.g., credential expiry).</li></ul><h3>Next Steps</h3><p>Automating transaction replays is just one step toward <strong>self-healing integrations</strong>. At Prolifics, we help enterprises leverage <strong>MuleSoft’s full potential</strong> with:</p><ul><li><strong>AI-driven anomaly detection</strong> to predict failures before they occur.</li><li><strong>End-to-end observability</strong> for APM and legacy B2B gateways.</li></ul><p><strong>Ready to transform your integration resiliency?</strong><br><a href="https://prolifics.com/uk/contact-us">Contact our MuleSoft experts</a> for a free assessment.</p><h3>Why Prolifics?</h3><p>Prolifics specializes in <strong>enterprise integration</strong> and <strong>digital transformation</strong>, helping businesses modernize with:</p><ul><li><strong>MuleSoft Certified Experts</strong></li><li><strong>End-to-end API lifecycle management</strong></li><li><strong>Proven frameworks for error handling &amp; recovery</strong></li></ul><p><strong>Let’s build integrations that recover faster and work smarter.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=041340c67726" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Seamless B2B Integration with Anypoint Partner Manager]]></title>
            <link>https://medium.com/@aakashkesarwani40/unlocking-seamless-b2b-integration-with-anypoint-partner-manager-7cff8bf51fbb?source=rss-b29c34416697------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cff8bf51fbb</guid>
            <category><![CDATA[cloudhub]]></category>
            <category><![CDATA[anypoint-partner-manager]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[anypoint-platform]]></category>
            <dc:creator><![CDATA[Aakash Kesarwani]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 16:29:53 GMT</pubDate>
            <atom:updated>2025-03-10T16:29:53.238Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In today’s fast-paced business landscape, seamless and efficient communication between business partners is critical. MuleSoft’s Anypoint Partner Manager (APM) offers a comprehensive B2B integration solution that accelerates partner onboarding, manages API and EDI-based transactions, and ensures smooth operational management. This blog explores the features, architecture, and best practices for utilizing Anypoint Partner Manager to enhance your business interactions.</p><h3>What is Anypoint Partner Manager?</h3><p>Anypoint Partner Manager is a cloud-native, low-code B2B integration solution designed to simplify partner onboarding and manage business transactions. It provides organizations with the ability to integrate with partners using multiple protocols and formats such as EDI (Electronic Data Interchange) and APIs (Application Programming Interfaces).</p><p>Key benefits of Anypoint Partner Manager include:</p><ul><li><strong>Accelerated Partner Onboarding:</strong> Reduce the time and effort required to onboard new partners.</li><li><strong>Future-Proof B2B Communications:</strong> Adapt to evolving business needs with both EDI and API support.</li><li><strong>Improved Failure Management:</strong> Easily track and replay transactions in case of failures.</li><li><strong>Flexible Integration:</strong> Handle multiple protocols and formats, ensuring seamless communication.</li></ul><h3>Anypoint Partner Manager Architecture</h3><p>The architecture of Anypoint Partner Manager is designed to facilitate seamless communication between business partners. The core components include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5huCKmDL3b_hSAVe48iJWw.png" /></figure><ol><li><strong>Receive Endpoint Services:</strong> Supports protocols such as HTTPS, FTP, SFTP, and AS2 for receiving messages from partners.</li><li><strong>Document Processing Service:</strong> Handles parsing, validation, and translation of incoming B2B messages based on defined configurations and mapping.</li><li><strong>API Replication Service:</strong> Tracks and updates transaction activities and payload storage through APIs.</li><li><strong>Send Endpoint Services:</strong> Allows sending messages to partners using protocols like HTTPS, FTP, SFTP, and AS2.</li></ol><p>This modular architecture ensures easy adaptability and scalability in managing partner communications.</p><h3>Key Terminologies in Anypoint Partner Manager</h3><p>To better understand the functioning of APM, here are some key terminologies:</p><ul><li><strong>Host Partner Message Flows:</strong> Defines the inbound and outbound communication channels.</li><li><strong>Endpoints:</strong> The protocol through which messages are received or sent (e.g., HTTPS, FTP).</li><li><strong>Message Types:</strong> The format in which messages are exchanged, such as EDI X12, EDIFACT, etc.</li><li><strong>Sender and Receiver Identifiers:</strong> Unique identifiers for message originators and receivers.</li><li><strong>Translation Maps:</strong> DataWeave maps used to transform messages between partner formats and enterprise applications.</li></ul><h3>Setting Up Anypoint Partner Manager</h3><p>The process of setting up APM involves several steps:</p><ol><li><strong>Configure Deployment Settings:</strong> Choose between CloudHub 1.0 or Runtime Fabric for deployment.</li><li><strong>Configure Payload Storage:</strong> Select a storage option such as a database, Amazon S3, or filesystem.</li><li><strong>Configure Host Profile:</strong> Set up your organization’s profile to facilitate communication.</li><li><strong>Configure Partner Profile:</strong> Create profiles for each partner.</li><li><strong>Configure Message Flows:</strong> Define the flow of messages between host and partner.</li><li><strong>Deploy and Test:</strong> Deploy the configured setup and conduct test runs.</li><li><strong>Monitor Transactions:</strong> Continuously monitor transactions and individual messages.</li></ol><h3><strong>Message flow Architecture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMKI9vVsFyDaQI9eCLZHJg.png" /><figcaption>Message Flow Architecture</figcaption></figure><p>The diagram you uploaded illustrates the <strong>B2B Integration Message Flow</strong> between a <strong>Vendor (Partner)</strong> and a <strong>Host (Your Organization)</strong> using <strong>MuleSoft Anypoint Partner Manager</strong>.</p><h3>Key Elements in the Diagram</h3><ol><li><strong>Vendor (Partner):</strong> Represents your business partner or external organization with whom you need to exchange data/messages.</li><li><strong>Host (Your Organization):</strong> Represents your company or business managing the data flow through <strong>Anypoint Partner Manager</strong>.</li><li><strong>Outbound Message Flow:</strong> This flow handles messages from your organization (<strong>Host</strong>) to the <strong>Vendor</strong>.</li><li><strong>Inbound Message Flow:</strong> This flow handles messages from the <strong>Vendor</strong> to your organization (<strong>Host</strong>).</li><li><strong>Endpoints (Blue Blocks):</strong> Represent the protocol used for communication (e.g., HTTPS, FTP, SFTP, AS2).</li><li><strong>Message Types (Green Blocks):</strong> Represent the data formats being exchanged, such as <strong>EDI (Electronic Data Interchange)</strong>, XML, or JSON.</li><li><strong>DW Mapping (DataWeave Mapping):</strong> Handles the transformation of data from one format to another (e.g., EDI to JSON or vice versa).</li><li><strong>Source at Host / Target at Host:</strong> Represents the origin and destination of messages within the host organization.</li></ol><h3>Explanation of the Flow</h3><h3>1. Outbound Message Flow (Host to Vendor)</h3><h4>Defined in the Host Profile:</h4><ul><li><strong>Source at Host:</strong> The internal system where the message originates (e.g., ERP, CRM).</li><li><strong>DW Mapping:</strong> Data transformation process within MuleSoft to convert the message format (e.g., JSON to EDI).</li></ul><h4>Defined in the Partner Profile:</h4><ul><li><strong>Send to Partner:</strong> The system or endpoint where the transformed message is sent.</li><li><strong>Vendor Endpoint:</strong> The protocol used for communication (e.g., HTTPS, FTP, AS2).</li></ul><p><strong>Flow:</strong></p><ol><li>The <strong>Host Profile</strong> defines how messages are sourced and transformed.</li><li>The <strong>Partner Profile</strong> specifies where the message should be sent and through which protocol.</li></ol><h3>2. Inbound Message Flow (Vendor to Host)</h3><h4>Defined in the Partner Profile:</h4><ul><li><strong>Receive from Partner:</strong> The system or endpoint from which the message is received.</li><li><strong>Vendor Endpoint:</strong> The communication protocol used to receive the data.</li></ul><h4>Defined in the Host Profile:</h4><ul><li><strong>DW Mapping:</strong> Transformation of the received data into a format compatible with internal systems (e.g., EDI to JSON).</li><li><strong>Target at Host:</strong> The final destination where the transformed message is sent (e.g., ERP, CRM).</li></ul><p><strong>Flow:</strong></p><ol><li>The <strong>Partner Profile</strong> defines how the vendor sends messages and the communication protocol.</li><li>The <strong>Host Profile</strong> specifies how the message is transformed and where it should be processed internally.</li></ol><h3>Best Practices for Anypoint Partner Manager</h3><ol><li><strong>Efficient Partner Onboarding:</strong> Develop clear documentation and standardized processes to accelerate onboarding.</li><li><strong>Data Monitoring:</strong> Implement dashboards to regularly monitor transaction flows, ensuring data accuracy and reliability.</li><li><strong>Governance and Compliance:</strong> Use role-based access controls, track changes, and maintain compliance with regulatory standards.</li></ol><p>By following these best practices, organizations can ensure seamless and compliant partner interactions.</p><h3>Conclusion</h3><p>MuleSoft’s Anypoint Partner Manager is a game-changing solution for organizations looking to simplify their B2B integration processes. With its low-code interface, flexible architecture, and robust management capabilities, businesses can reduce onboarding times, streamline operations, and ensure data integrity across partner transactions. By leveraging Anypoint Partner Manager, companies can unlock new levels of efficiency and scalability in their B2B communications.</p><p>Stay ahead in your B2B ecosystem by adopting Anypoint Partner Manager and transforming your partner management experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cff8bf51fbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating MuleSoft Deployments: A Complete Guide Using GitLab CI/CD Pipeline for CloudHub 2.0]]></title>
            <link>https://medium.com/@aakashkesarwani40/automating-mulesoft-deployments-a-complete-guide-using-gitlab-ci-cd-pipeline-for-cloudhub-2-0-db24b23fce80?source=rss-b29c34416697------2</link>
            <guid isPermaLink="false">https://medium.com/p/db24b23fce80</guid>
            <category><![CDATA[private-space]]></category>
            <category><![CDATA[anypoint-platform]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[cloudhub-2]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Aakash Kesarwani]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 10:21:57 GMT</pubDate>
            <atom:updated>2025-02-13T10:21:57.094Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automating MuleSoft Deployments: A Complete Guide Using GitLab CI/CD Pipeline for CloudHub 2.0 Deployment</h3><p>In today’s fast-paced development landscape, implementing a robust Continuous Integration and Continuous Deployment (CI/CD) pipeline is essential for efficiently deploying Mule applications to CloudHub 2.0. This approach not only streamlines the deployment process but also minimizes errors and enhances overall productivity. By integrating GitLab CI/CD and implementing custom notifications, teams can ensure faster releases with minimal manual intervention.</p><p><strong>Understanding CI/CD</strong></p><p>CI/CD is a methodology that automates the stages of software development, testing, and deployment, enabling teams to release updates more rapidly and reliably.</p><ul><li><strong>Continuous Integration (CI):</strong> Automatically tests and integrates code changes into a shared repository, ensuring the code remains in a deployable state.</li><li><strong>Continuous Deployment (CD):</strong> Extends CI by automatically deploying the tested code to production environments, reducing manual effort and accelerating software delivery.</li></ul><h3>CI/CD &amp; Dev process</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gXzNCMonNgf6phitRm2XLA.png" /></figure><h3>Applications of the Toolchain</h3><p>In the context of a modern enterprise, the Continuous Integration/Continuous Deployment (CI/CD) toolchain leverages several key tools to support effective software development, testing, and distribution. These tools are carefully selected to ensure a smooth and reliable workflow. Among the main tools used are:</p><ul><li><strong>GitLab</strong>: GitLab serves as the core of source code versioning. It provides a robust environment for managing repositories, enabling developers to collaborate efficiently and track code changes.</li><li><strong>GitLab CI/CD</strong>: A key automation tool for building, testing, and deploying softwareGitLab CI/CD plays a central role in automating build, test, and release processes. It ensures a controlled and repeatable workflow, minimizing human errors and speeding up software deployment times.</li><li><strong>Anypoint CloudHub 2.0</strong>: Managed by MuleSoft, this cloud-based platform is essential for running applications built with MuleSoft technology. CloudHub 2.0 provides a scalable and reliable environment for deploying applications, managing integrations, and handling complex data flows.</li><li><strong>Anypoint Exchange</strong>: A centralized repository for storing and sharing artifacts, managed by MuleSoft. It facilitates collaboration by allowing teams to reuse API definitions, policies, and other integration components, accelerating the development lifecycle.</li><li><strong>Secrets Management Tool — Vault</strong>: Vault is used to securely store and manage credentials, certificates, and sensitive data. It ensures that secrets are handled safely, reducing security risks.</li></ul><h3>CI/CD Workflow</h3><p>The diagram you provided outlines a Continuous Integration (CI) pipeline workflow. Here’s a step-by-step explanation of the process:</p><ol><li><strong>Code pushed to GitHub repository:</strong></li></ol><ul><li>Developers push their code changes to a remote Git repository (GitLab in this case).</li></ul><p><strong>2. CI pipeline performs automatic build trigger:</strong></p><ul><li>The CI pipeline is automatically triggered when new code is pushed to the repository. This step ensures that the build process starts without manual intervention.</li></ul><p><strong>3. Perform Munit test:</strong></p><ul><li>After the build is triggered, the pipeline runs munit tests to validate the code changes. This step ensures that the new code does not break existing functionality.</li></ul><p><strong>4. Store Artifact:</strong></p><ul><li>Once the build and tests are successful, the resulting build artifact (e.g., a compiled application or package) is stored in a repository or storage system for later use.</li></ul><p><strong>5. Manifest pushed to GIT Manifest repo:</strong></p><ul><li>This step might involve someone from OPS team to update yaml config with the artifact number.</li></ul><p><strong>6. CI pipeline retrieves build artifact from exchange:</strong></p><ul><li>The CI pipeline retrieves the stored build artifact from an anypoint exchange for further steps in the deployment process.</li></ul><p><strong>7. Execute Deploy:</strong></p><ul><li>The final step involves deploying the retrieved artifact to the target environment (e.g., production, staging). This step makes the new code changes live and available to users.</li></ul><p><strong>Additional Notes:</strong></p><ul><li><strong>Git Repository (SCM):</strong> This is the source control management system where the code is stored and managed.</li><li><strong>Manifest pushed to GIT Manifest repo:</strong> Manifests (configuration files) are pushed to a separate repository, which might be used to manage deployment configurations of APIs in cloud hub.</li></ul><h3>Key Component:</h3><h3>1. GitLab</h3><ul><li>Source code repository and version control system.</li><li>Manages branches, merges, and code reviews.</li></ul><h3>2. GitLab CI/CD</h3><ul><li>Automates build, test, and deployment steps.</li><li>Defines job execution via .gitlab-ci.yml.</li></ul><h3>3. Anypoint CloudHub 2.0</h3><ul><li>Cloud-based deployment and runtime management.</li><li>Ensures scalability and resilience for MuleSoft applications.</li></ul><h3>4. Anypoint Exchange</h3><ul><li>Centralized repository for APIs, policies, and artifacts.</li><li>Facilitates artifact sharing and reusability.</li></ul><h3>5. Secrets Management (Vault)</h3><ul><li>Securely stores credentials, API keys, and environment variables.</li><li>Enhances security by reducing exposure of sensitive data.</li></ul><h3>CI/CD Implementation in GitLab</h3><ol><li><strong>Repository Setup</strong></li></ol><p>Create a repository named “mulesoft-ci-cd” in your gitlab repo with the following structure. YML file with contains the steps to build API referencing to job and stages defined below in folder:</p><pre>/mulesoft-ci-cd<br>  ├── blueprint-template-app.yml<br>  ├── jobs/<br>  │   ├── get-gav-coordinates.yml<br>  │   ├── set-snapshot-version.yml<br>  │   ├── maven-verify.yml<br>  │   ├── maven-deploy.yml<br>  ├── stages/<br>  │   ├── get-gav-coordinates.yml<br>  │   ├── set-snapshot-version.yml<br>  │   ├── maven-verify.yml<br>  │   ├── maven-deploy.yml</pre><p><strong>blueprint-template-app.yml: </strong>Maven 3.9 and Amazon Corretto 17 image, caches the .m2/ directory for dependency reuse, and configures Maven options to skip tests and use TLSv1.2. It includes stages for fetching GAV coordinates, setting snapshot versions, verification, and deployment.</p><pre>default:<br>  image: maven:3.9-amazoncorretto-17-debian<br>  cache:<br>    paths:<br>      - .m2/<br><br>variables:<br>  MAVEN_OPTS: &gt;-<br>    -Dhttps.protocols=TLSv1.2<br>    -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository<br>  MAVEN_CLI_OPTS: &gt;-<br>    -DskipTests<br><br>include:<br>  - stages/get-gav-coordinates.yml<br>  - stages/set-snapshot-version.yml<br>  - stages/verify.yml<br>  - stages/deploy.yml<br><br>stages:<br>  - Get GAV Coordinates<br>  - Set Snapshot Version<br>  - Verify<br>  - Deploy</pre><p><strong>Job Definition</strong></p><ul><li><strong>get-gav-coordinates.yml: </strong>This job extracts Maven project coordinates (Group ID, Artifact ID, and Version) from a pom.xml file using Maven commands. The extracted values are saved to a vars.env file, which is then exported as a dotenv artifact for use in subsequent pipeline stages.</li></ul><pre>.get-gav-coordinates:<br>  script:<br>    - GROUP_ID=`mvn -B -f ${POM_XML_PATH}pom.xml -s $MVN_SETTINGS_XML help:evaluate -Dexpression=project.groupId -q -DforceStdout`<br>    - ARTIFACT_ID=`mvn -B -f ${POM_XML_PATH}pom.xml -s $MVN_SETTINGS_XML help:evaluate -Dexpression=project.artifactId -q -DforceStdout`<br>    - VERSION=`mvn -B -f ${POM_XML_PATH}pom.xml -s $MVN_SETTINGS_XML help:evaluate -Dexpression=project.version -q -DforceStdout`<br>    - echo &quot;GROUP_ID=$GROUP_ID ARTIFACT_ID=$ARTIFACT_ID VERSION=$VERSION&quot;<br>    - echo &quot;GROUP_ID=$GROUP_ID&quot; &gt; vars.env<br>    - echo &quot;ARTIFACT_ID=$ARTIFACT_ID&quot; &gt;&gt; vars.env<br>    - echo &quot;VERSION=$VERSION&quot; &gt;&gt; vars.env<br>  artifacts:<br>    reports:<br>      dotenv: vars.env</pre><ul><li><strong>set-snapshot-version.yml: T</strong>his job sets a snapshot version for non-main branches, excluding tagged commits. It generates a version using the pipeline ID and branch name, updates the pom.xml, and exports the version as a dotenv artifact for later stages.</li></ul><pre>.set-snapshot-version<br>  script:<br>    - echo &quot;Branch $CI_COMMIT_REF_NAME&quot;<br>    - NEW_VERSION=&quot;$CI_PIPELINE_IID&quot;<br>    - if [ &quot;$CI_COMMIT_REF_NAME&quot; != &quot;develop&quot; ]; then NEW_VERSION=&quot;$CI_COMMIT_REF_NAME.$NEW_VERSION&quot;; fi<br>    - NEW_VERSION=$(echo ${NEW_VERSION} | sed -r &#39;s/[-/]+/./g&#39;) <br>    - NEW_VERSION=&quot;${VERSION}-${NEW_VERSION}&quot;<br>    - echo &quot;Changing version ${VERSION} to ${NEW_VERSION}&quot;<br>    - mvn -B -s $MVN_SETTINGS_XML -f ${POM_XML_PATH}pom.xml versions:set -DnewVersion=${NEW_VERSION}<br>  artifacts:<br>    reports:<br>      dotenv: vars.env</pre><ul><li><strong>maven-verify.yml: </strong>This<strong> </strong>job runs Maven commands to clean and verify a project.</li></ul><pre>.maven-verify:<br>  script:<br>    - mvn -B -s $MVN_SETTINGS_XML -f ${POM_XML_PATH}pom.xml clean verify</pre><ul><li><strong>maven-deploy.yml: </strong>This<strong> </strong>job runs Maven commands to upload the artifact to anypoint exchange.</li></ul><pre>.maven-deploy:<br>  script:<br>    - MVN_COMMAND=&quot;mvn -B -s $MVN_SETTINGS_XML -f ${POM_XML_PATH}pom.xml deploy -DskipTests&quot;<br>    - if [ &quot;$CI_COMMIT_REF_NAME&quot; == &quot;main&quot; ]; then if [ &quot;$MAIN_MAVEN_PROFILES&quot; != &quot;&quot; ]; then MVN_COMMAND=&quot;$MVN_COMMAND -P $MAIN_MAVEN_PROFILES&quot;; fi; fi<br>    - echo &quot;Running $MVN_COMMAND&quot;<br>    - $MVN_COMMAND<br>    - GROUP_ID=`mvn -B -f ${POM_XML_PATH}pom.xml -s $MVN_SETTINGS_XML help:evaluate -Dexpression=project.groupId -q -DforceStdout`<br>    - mvn dependency:purge-local-repository -Dinclude=$GROUP_ID -DresolutionFuzziness=groupId -DreResolve=false -s $MVN_SETTINGS_XML</pre><h3>Stages Definition</h3><ul><li><strong>get-gav-coordinates.yml: </strong>This stage defines a <strong>“Get GAV Coordinates”</strong> job in a GitLab CI/CD pipeline. It reuses configurations from an external file and is assigned to the <strong>“Get GAV Coordinates”</strong> stage. Essentially, it retrieves the Group, Artifact, and Version (GAV) coordinates for the project, ensuring the necessary information is available for subsequent steps in the pipeline.</li><li><strong>set-snapshot-version.yml: </strong>This stage defines a <strong>“Set Snapshot Version”</strong> job in a GitLab CI/CD pipeline. It reuses configurations from an external file and is assigned to the <strong>“Set Snapshot Version”</strong> stage. After running, it saves the pom.xml file as an artifact for use in later stages. Essentially, it prepares the project by setting the snapshot version, ensuring it&#39;s ready for the next steps in the pipeline.</li><li><strong>verify.yml: </strong>This stage defines a <strong>“Verify”</strong> job in a GitLab CI/CD pipeline. It reuses configurations from an external file and depends on the <strong>“Set Snapshot Version”</strong> job to run first. After execution, it saves the pom.xml file as an artifact for use in later stages. Essentially, it ensures the project is validated and ready for the next steps in the pipeline.</li><li><strong>deploy.yml: </strong>This stage defines a <strong>“Deploy”</strong> job in a GitLab CI/CD pipeline. It reuses configurations from an external file and is assigned to the <strong>“Deploy”</strong> stage. It depends on the <strong>“Verify”</strong> job to complete first and saves the pom.xml file as an artifact for later use. Essentially, it handles the deployment of the project, ensuring everything is validated and ready before proceeding.</li></ul><p><strong>2.</strong> Create a .gitlab-ci.yml file in the root folder of mule API and reference to blueprint-template-app.yml created in mulesoft-ci-cd repo as shown below:</p><pre>include:<br>  - project: mulesoft-cicd<br>    ref: develop<br>    file: blueprint-template-app.yml</pre><p><strong>3.</strong> Go to your repo setting and in CI/CD tab add the below variable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*mKQWivH4ewbBQYvjdVWLIQ.png" /></figure><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;settings xsi:schemaLocation=&quot;http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd&quot; xmlns=&quot;http://maven.apache.org/SETTINGS/1.1.0&quot;<br>    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;<br>  &lt;servers&gt;<br>    &lt;server&gt;<br>      &lt;id&gt;anypoint-exchange&lt;/id&gt;<br>      &lt;username&gt;~~~Client~~~&lt;/username&gt;<br>      &lt;password&gt;~~~Password~~~&lt;/password&gt;<br>    &lt;/server&gt;<br>    &lt;server&gt;<br>      &lt;username&gt;nexus-username&lt;/username&gt;<br>      &lt;password&gt;nexus-passowrd&lt;/password&gt;<br>      &lt;id&gt;nexus-id/id&gt;<br>    &lt;/server&gt;<br>  &lt;/servers&gt;<br>&lt;/settings&gt;</pre><p>4. Now, your pipeline is ready to build the API. You can see it in the CI/CD tab of the repo. There should pipeline already running as shown below:</p><h3>Deploy Pipeline Setup</h3><ol><li>Create a mule-manifest repository for deployment configuration and store YAML manifests for each API per environment. Below is the structure.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*1kRy0s9d-boBZgAPPo0Lcw.png" /></figure><pre>/ mule-manifest<br>  ├── .gitlab-ci.yml<br>  ├── support/<br>  │   ├── vault-certificate.pem<br>  ├── dev/<br>  │   ├── dev-hello-world-api.manifest.yaml<br>  ├── prod/<br>  │   ├── prod-hello-world-api.manifest.yaml</pre><p><strong>.gitlab-ci.yml: </strong>This file defines two manual jobs, <strong>“Check”</strong> and <strong>“Deploy,”</strong> in a GitLab CI/CD pipeline.</p><ol><li><strong>Check Job</strong>:</li></ol><ul><li>Runs in the <strong>build</strong> stage.</li><li>Verifies if a specific manifest file exists for the given deployment environment and application.</li><li>Retrieves secrets from a vault using the manifest file and prepares for deployment by generating environment variables.</li><li>Saves the generated environment variables (vars.env) as a temporary artifact for 10 minutes.</li></ul><p><strong>2. Deploy Job</strong>:</p><ul><li>Runs in the <strong>deploy</strong> stage.</li><li>Checks for the same manifest file and retrieves secrets from the vault.</li><li>Executes a deployment script to deploy the application to the specified environment.</li></ul><p>Both jobs are triggered manually and ensure the necessary files and secrets are in place before proceeding with the deployment process.</p><p><strong>2.</strong> Add vault certificate in PEM format in the support folder. The vault will contain connected app and environment credentials for anypoint cloudhub.</p><p><strong>3.</strong> Create a folder for each environment and inside each folder a manifest file for each API giving configuration details. One of the sample is below:</p><pre>artifact:<br>  artifactId: hello-world-api<br>  groupId: &quot;group-id-anypoint-platform<br>  version: artifact-id-from-build-pipeline<br>deploymentType: cloudhub2Deployment<br>configuration: <br>  uri: https://eu1.anypoint.mulesoft.com/<br>  javaVersion: 17<br>  muleVersion: &quot;4.6.8&quot;<br>  applicationName: hello-world-api<br>  target: &quot;private-space-name&quot;<br>  provider: &quot;MC&quot;<br>  environment: DEV<br>  replicas: &quot;1&quot;<br>  vCores: &quot;0.1&quot;<br>  businessGroupId: &quot;group-id-anypoint-platform&quot;<br>  properties: <br>    env: dev<br>    anypoint.platform.visualizer.displayName: hello-world-api<br>    anypoint.platform.client_id: &quot;{{ AP_CREDENTIALS.clientId }}&quot;<br>    anypoint.platform.base_uri: https://eu1.anypoint.mulesoft.com/<br>  secureProperties:<br>    anypoint.platform.client_secret: &quot;{{ AP_CREDENTIALS.client_secret }}&quot;<br>    token: &quot;{{ AP_CREDENTIALS.token }}&quot;<br>  connectedAppClientId: &quot;{{ CA_CREDENTIALS.clientId }}&quot;<br>  connectedAppClientSecret: &quot;{{ CA_CREDENTIALS.clientSecret }}&quot;<br>  connectedAppGrantType: &quot;client_credentials&quot;<br>  deploymentSettings:<br>    generateDefaultPublicUrl: true<br>    http:<br>      inbound:<br>        lastMileSecurity: true<br><br>secrets:<br>  CA_CREDENTIALS: /vault/dev/anypoint_connected_app //Stored in vault<br>  AP_CREDENTIALS: /vault/dev/environment_credentials //Stored in vault</pre><p><strong>3.</strong> Once this is done. We are ready to fetch artifacts from anypoint exchange and deploy it in runtime manager by using CI/CD tab and giving the following details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bb5lsbj5yTpWUt7x8ngbTw.png" /></figure><h3>Conclusion</h3><p>Integrating GitLab CI/CD with CloudHub 2.0 enables efficient, automated, and secure deployments. This approach enhances software quality, reduces manual intervention, and accelerates the release cycle. By leveraging GitLab pipelines, Anypoint Exchange, and Vault for secrets management, teams can streamline their development processes while ensuring compliance and reliability. This document is a blueprint for implementing a standardized CI/CD pipeline for MuleSoft applications on CloudHub 2.0, fostering operational efficiency and deployment agility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db24b23fce80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>