<?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 Isuru Liyanage on Medium]]></title>
        <description><![CDATA[Stories by Isuru Liyanage on Medium]]></description>
        <link>https://medium.com/@isuruliyanage1?source=rss-191f97f5a9de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*N-G9_w7-3L1pfyWX8bG1sg.jpeg</url>
            <title>Stories by Isuru Liyanage on Medium</title>
            <link>https://medium.com/@isuruliyanage1?source=rss-191f97f5a9de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:25:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isuruliyanage1/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[Building an MCP Server
for WSO2 Micro Integrator]]></title>
            <link>https://medium.com/codeblog/building-an-mcp-server-for-wso2-micro-integrator-42d16116ec0e?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/42d16116ec0e</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 11:14:11 GMT</pubDate>
            <atom:updated>2026-04-12T11:14:11.157Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Give your AI assistant real-time visibility into your WSO2 MI 4.2.0 deployment — list APIs, flip log levels, manage users, and more, all through natural conversation.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*rms5Zm7VjFbYCdpS.png" /></figure><h3>What is the Model Context Protocol?</h3><p>MCP is an open standard introduced by Anthropic that lets AI assistants connect to external tools and data sources in a structured, safe way. Think of it as a plugin system for AI — instead of copy-pasting logs or JSON payloads into a chat window, you give Claude direct, live access to your systems.</p><p><strong>The core idea </strong>An MCP server exposes a set of named <em>tools</em>. Claude can call those tools mid-conversation, get back structured results, and reason over them — without you ever leaving the chat.</p><h3>How the pieces fit together</h3><p>The MCP server sits between Claude Desktop (or the API) and the WSO2 MI Management API running on port 9164.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*radJj5ZNjP2SM3hpHuVBFA.png" /></figure><p>Communication between Claude and the MCP server happens over <strong>stdio</strong> — the server is spawned as a child process by Claude Desktop and exchanges JSON messages on stdin/stdout. <br>Your WSO2 MI instance stays untouched; the MCP server is purely a thin adapter layer.</p><h3>37 tools across every Management API resource</h3><p>The server maps the full WSO2 MI Management API surface into named, typed MCP tools that Claude can discover and call automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*FO2Ni-qQ9NWUDA3-AbAXCA.png" /></figure><h3>Getting it running in 3 steps</h3><ol><li><strong>Install dependencies</strong></li></ol><p>Clone the project folder from Github[1] and run npm install. The only runtime dependencies are the official MCP SDK and node-fetch.</p><p>2. <strong>Add to Claude Desktop config</strong></p><p>Edit claude_desktop_config.json (found in your OS app-support folder) and point it at the server file with your MI credentials as environment variables.</p><p>3. <strong>Restart Claude Desktop</strong></p><p>Claude Desktop spawns the server automatically. Check <em>Settings → Developer</em> to confirm it shows a green connected status.</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;wso2-mi&quot;: {<br>      &quot;command&quot;: &quot;node&quot;,<br>      &quot;args&quot;: [&quot;C:\\path\\to\\wso2-mi-mcp\\src\\index.js&quot;],<br>      &quot;env&quot;: {<br>        &quot;MI_HOST&quot;: &quot;localhost&quot;,<br>        &quot;MI_PORT&quot;: &quot;9164&quot;,<br>        &quot;MI_USERNAME&quot;: &quot;admin&quot;,<br>        &quot;MI_PASSWORD&quot;: &quot;admin&quot;,<br>        &quot;MI_TLS_SKIP&quot;: &quot;true&quot;<br>      }<br>    }<br>  }<br>}</pre><h3>Automatic JWT token management</h3><p>The MI Management API is protected by JWT authentication by default. The MCP server handles this entirely transparently — on the first tool call it exchanges your Basic credentials for a JWT, caches it for 14 minutes, then refreshes silently when needed. You never deal with tokens manually.</p><blockquote><strong>TLS note: </strong>WSO2 MI ships with a self-signed certificate. Set MI_TLS_SKIP=true for development and test environments. In production, install a valid certificate and flip this to false.</blockquote><h3>What conversations look like</h3><p>Once connected, you interact with your WSO2 MI deployment through plain English. Claude figures out which tool to call and surfaces the results in a readable way.<br>Below is the conversation that I had with Claude</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vrX6CBEU1VOE7Y22vBeAnw.png" /><figcaption>Claude Chat</figcaption></figure><p>Happy Coding :)</p><p>[1]. Github Code : <a href="https://github.com/isurul28/WSO2MI_MCP/tree/main/src">https://github.com/isurul28/WSO2MI_MCP/tree/main/src</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42d16116ec0e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/building-an-mcp-server-for-wso2-micro-integrator-42d16116ec0e">Building an MCP Server
for WSO2 Micro Integrator</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Chrome Extension Side Panel to Monitor WSO2 MI CAR Status: A Developer’s Journey]]></title>
            <link>https://medium.com/codeblog/building-a-chrome-extension-side-panel-to-monitor-wso2-mi-car-status-a-developers-journey-31b7db814192?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/31b7db814192</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[micoservices]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Thu, 26 Jun 2025 19:19:05 GMT</pubDate>
            <atom:updated>2025-06-26T19:19:05.666Z</atom:updated>
            <content:encoded><![CDATA[<p>As developers, we often work with local services and APIs. Constantly switching between our development environment, terminal, and browser tabs to check the status of these services can be disruptive. What if you could have a quick, always-accessible overview of your critical application metrics, right there in your browser’s side panel?</p><p>That’s precisely the problem I aimed to solve by building a Google Chrome extension. This post will walk you through the process, from setting up a basic side panel to handling API authentication, parsing complex JSON, and overcoming common Chrome Extension development hurdles like Content Security Policy (CSP).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rRJxK282kJS5IAnKPGerNg.png" /></figure><h3>The Problem: A Glimpse into Local Application Health</h3><p>Imagine you’re developing APIs in WSO2 MI. MI service exposes some management APIs, and specifically, you’re interested in:</p><ul><li>The number of <strong>active applications</strong>.</li><li>The number of <strong>faulty applications</strong>.</li><li>A detailed list of <strong>faulty applications</strong>, including their specific “artifacts” (diagnostic data), categorized by type.</li></ul><p>Instead of navigating to a separate tab or curling the endpoint repeatedly, a Chrome side panel offers an elegant solution.</p><h3>Building the Foundation: Chrome Extension Basics</h3><p>Every Chrome Extension starts with a manifest.json. This file declares your extension&#39;s name, version, permissions, and what components it uses.</p><pre>{<br>  &quot;manifest_version&quot;: 3,<br>  &quot;name&quot;: &quot;Application Viewer Side Panel&quot;,<br>  &quot;version&quot;: &quot;1.0&quot;,<br>  &quot;description&quot;: &quot;A Chrome extension to display CAR status in a side panel.&quot;,<br>  &quot;permissions&quot;: [<br>    &quot;sidePanel&quot;<br>  ],<br>  &quot;host_permissions&quot;: [<br>    &quot;http://localhost:9164/&quot;<br>  ],<br>  &quot;background&quot;: {<br>    &quot;service_worker&quot;: &quot;background.js&quot;<br>  },<br>  &quot;side_panel&quot;: {<br>    &quot;default_path&quot;: &quot;sidepanel.html&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;default_title&quot;: &quot;Open API Viewer&quot;<br>  }<br>}</pre><p><strong>Key takeaways from the </strong><strong>manifest.json:</strong></p><ul><li>&quot;manifest_version&quot;: 3: The latest manifest version, which deprecates background pages in favor of service workers.</li><li>&quot;permissions&quot;: [&quot;sidePanel&quot;]: This is crucial for enabling the new side panel API.</li><li>&quot;host_permissions&quot;: [&quot;http://localhost:9164/&quot;]: This grants the extension explicit permission to make requests to our local WSO2 MI management API endpoint, bypassing CORS restrictions that would normally apply. This is essential for local development.</li><li>&quot;background&quot;: { &quot;service_worker&quot;: &quot;background.js&quot; }: Our background script that sets up the side panel.</li><li>&quot;side_panel&quot;: { &quot;default_path&quot;: &quot;sidepanel.html&quot; }: Points to the HTML file that will be loaded into our side panel.</li></ul><p>The background.js is minimal, simply enabling the side panel on installation:</p><pre>// background.js<br>chrome.runtime.onInstalled.addListener(() =&gt; {<br>  chrome.sidePanel.setOptions({<br>    path: &#39;sidepanel.html&#39;,<br>    enabled: true<br>  });<br>});</pre><h3>The Heart of the Extension: sidepanel.html and sidepanel.js</h3><p>The sidepanel.html is a standard HTML file that provides the structure for our UI. It includes a basic header, placeholders for our data counts, and a section for the faulty application list.</p><p>The real magic happens in sidepanel.js. This script is responsible for:</p><ol><li><strong>Authentication</strong>: Our API requires a two-step authentication process:</li></ol><ul><li>A GET request to /management/login with Basic authentication.</li><li>Extracting an AccessToken from the login response.</li><li>Using this AccessTokenas a Bearer token for the subsequent API calls.</li></ul><pre>const loginUrl = &#39;http://localhost:9164/management/login&#39;;<br>const basicAuthHeader = &#39;Basic XXXXX==&#39;; // Base64 encoded credentials<br><br>const loginResponse = await fetch(loginUrl, {<br>    method: &#39;GET&#39;,<br>    headers: { &#39;Authorization&#39;: basicAuthHeader }<br>});<br>const loginData = await loginResponse.json();<br>const accessToken = loginData.access_token; // Adjust field name as per your API<br><br>const applicationsUrl = &#39;http://localhost:9164/management/applications&#39;;<br>const bearerAuthHeader = `Bearer ${accessToken}`;<br><br>const applicationsResponse = await fetch(applicationsUrl, {<br>    method: &#39;GET&#39;,<br>    headers: { &#39;Authorization&#39;: bearerAuthHeader }<br>});<br>const applicationsData = await applicationsResponse.json();</pre><p><strong>Displaying Key Metrics</strong>: It extracts activeCount and faultyCount from the applicationsData and updates dedicated p tags in the HTML.<strong>Handling the </strong><strong>faultyList</strong>: This is where it gets interesting. Each item in the faultyList has a name and an artifacts object. We dynamically create &lt;li&gt; elements for each faulty application. The application name is made clickable.<br>When clicked, a hidden div containing the artifacts is toggled to visible.</p><p><strong>Categorizing Artifacts</strong>: The artifacts object itself can be complex. To improve readability, we group artifacts by their type field. For example, all &quot;ERROR&quot; type artifacts will appear under an &quot;ERROR&quot; heading.</p><pre>// Inside the loop for each faulty item<br>const categorizedArtifacts = {};<br>if (item.artifacts &amp;&amp; typeof item.artifacts === &#39;object&#39;) {<br>    for (const key in item.artifacts) {<br>        if (Object.hasOwnProperty.call(item.artifacts, key)) {<br>            const artifact = item.artifacts[key];<br>            // Default to &#39;Other&#39; if no type or not an object<br>            const type = (artifact &amp;&amp; typeof artifact === &#39;object&#39; &amp;&amp; artifact.type) ? artifact.type : &#39;Other&#39;; <br><br>            if (!categorizedArtifacts[type]) {<br>                categorizedArtifacts[type] = [];<br>            }<br>            categorizedArtifacts[type].push({ key: key, value: artifact });<br>        }<br>    }<br>}<br><br>// Then, iterate through categorizedArtifacts to build the UI<br>// ... (code for creating category headers and artifact items)</pre><p><strong>Interactive UI</strong>: The faulty-item-name element has a click listener (and a keyboard listener for accessibility) that toggles a visible class on the faulty-artifacts-wrapper. CSS transitions handle the smooth reveal/hide effect.</p><h3>Overcoming Hurdles: The CSP Challenge</h3><p>One of the most common stumbling blocks in Chrome Extension development is the Content Security Policy (CSP). Extensions have very strict CSPs by default, which prevent loading external scripts, styles, or even some inline scripts for security reasons.</p><p>My initial approach involved linking Tailwind CSS from a CDN: &lt;!-- &lt;script src=&quot;https://cdn.tailwindcss.com&quot;&gt;&lt;/script&gt; --&gt;</p><p>This immediately triggered a Refused to load the script ... because it violates the following Content Security Policy directive error.</p><p><strong>The Solution</strong>: To comply with the CSP, I removed the external CDN link and instead <strong>inlined all the necessary CSS directly into the </strong><strong>&lt;style&gt; tags within </strong><strong>sidepanel.html</strong>. This ensures that all styling resources are part of the extension&#39;s local package, bypassing the CSP restrictions on external sources.</p><p>This is a critical best practice for Chrome Extension development: minimize external dependencies and inline or bundle assets where possible.</p><h3>How to Get Started</h3><p>Want to try this extension yourself?</p><ol><li><strong>Save the Files</strong>: Create a folder (e.g., api_monitor_extension). Inside, save manifest.json, background.js, sidepanel.html, and sidepanel.js with the code provided in the snippets above (or the full code from the previous responses if you&#39;re building it step-by-step).</li><li><strong>Load in Chrome</strong>:</li></ol><ul><li>Open Chrome and go to chrome://extensions.</li><li>Toggle “Developer mode” on (top right).</li><li>Click “Load unpacked” and select your api_monitor_extension folder.</li></ul><p>3<strong>. Open Side Panel</strong>: Click the “Side panel” icon in your Chrome toolbar and select “API Viewer Side Panel”.</p><p>Remember, for this to work, your local management API service at <a href="http://localhost:9164/">http://localhost:9164</a> must be running and accessible!</p><h3>Conclusion</h3><p>Building a Chrome extension to monitor local APIs in a side panel is a practical way to streamline your development workflow. It showcases several key Chrome Extension development concepts: manifest configuration, background service workers, side panel API usage, dynamic DOM manipulation, authentication handling, and crucially, navigating Chrome’s robust Content Security Policy.</p><p>This extension provides a quick, visual dashboard for your application’s health, directly within your browsing experience. There’s always room for enhancement, such as adding refresh buttons, configurable API endpoints, or more sophisticated error logging, but this provides a solid foundation.</p><p>Github Link : <a href="https://github.com/isurul28/WSO2MIGoogleChromeExtension/tree/main">https://github.com/isurul28/WSO2MIGoogleChromeExtension/tree/main</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31b7db814192" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/building-a-chrome-extension-side-panel-to-monitor-wso2-mi-car-status-a-developers-journey-31b7db814192">Building a Chrome Extension Side Panel to Monitor WSO2 MI CAR Status: A Developer’s Journey</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Ballerina: Hello World!]]></title>
            <link>https://medium.com/codeblog/getting-started-with-ballerina-hello-world-ad51b4e51e68?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad51b4e51e68</guid>
            <category><![CDATA[ballerina]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[hello-world]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Fri, 14 Feb 2025 17:43:43 GMT</pubDate>
            <atom:updated>2025-02-14T17:43:43.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_H5Q4sXsXyefOAIUF1xMhw.jpeg" /><figcaption>WSO2 ballerina</figcaption></figure><p>Ballerina is an open-source programming language created by WSO2, designed for cloud-native integration and microservices. In this blog post, we’ll walk you through running a simple “Hello World” program in Ballerina, helping you get started with this powerful tool in just a few easy steps!</p><h4><strong>Install Ballerina</strong></h4><p>First, head over to the official <a href="https://ballerina.io/downloads/">Ballerina download page</a>. You’ll find the latest versions of Ballerina for multiple operating systems. Since I’m using Windows, I’ll download the Windows installer. Once downloaded, simply run the installer and follow the prompts to complete the installation.</p><p>After installation, confirm it by opening your command prompt (CMD) or PowerShell and typing bal -v. If the installation was successful, you should see the installed version of Ballerina.</p><h4><strong>Setup VS code IDE</strong></h4><p>Next, let’s set up VS Code for coding in Ballerina. Open VS Code and navigate to the Extensions marketplace (the square icon on the sidebar). In the search bar, type “Ballerina” and select the Ballerina extension.</p><p>Click “Install” to add it to your editor. This extension provides syntax highlighting, code suggestions, and debugging support for Ballerina, making your coding experience smoother. Once the extension is installed, you can test it by opening a new Ballerina file and checking if the syntax is highlighted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*mi_hEIH53162Rk_-2LQxrQ.png" /></figure><h4><strong>Create a .bal file</strong></h4><p>A .bal file is the Ballerina equivalent of a .java file in Java. In this section, we will write our &quot;Hello World&quot; program in a .bal file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*FPBXLpMcnvAumFAbYJIjCQ.png" /></figure><h4>Writing “Hello World”</h4><ol><li><strong>Importing the I/O Library</strong><br>First, we need to import the <a href="https://central.ballerina.io/ballerina/io/latest">ballerina/io</a> library into our helloworld.bal file. This library provides functions for handling file input/output operations, as well as printing to the console.</li><li>Add the following line at the top of your .bal file:</li></ol><pre>import ballerina/io;</pre><p><strong>Creating the Main Function</strong><br>Next, we will create the main function. This is the entry point of any Ballerina program.</p><pre>public function main() {<br><br>}</pre><p>As you can see, Ballerina’s syntax is quite similar to other programming languages like Java, C#, and C++. This makes it easier for programmers familiar with those languages to pick up Ballerina quickly.</p><p><strong>Printing “Hello, World!”</strong><br>To print “Hello, World!” to the console, we use the <a href="https://central.ballerina.io/ballerina/io/latest#println">io:println</a> function from the ballerina/io library we imported earlier. This is equivalent to System.out.println in Java.</p><p>The code will look like this:</p><pre>io:println(&quot;Hello, World!&quot;);</pre><h4>Final Code</h4><p>Here’s the final version of the helloworld.bal file:</p><pre>import ballerina/io;<br><br>public function main() {<br>    io:println(&quot;Hello, World!&quot;);<br>}</pre><h3>Running the “Hello World” Program</h3><p>Now that we’ve written the code, it’s time to run our program!</p><ol><li><strong>Navigate to the Folder Containing the </strong><strong>.bal File</strong><br>Open your terminal or command prompt and navigate to the folder where you saved the helloworld.bal file.</li><li><strong>Running the Program</strong><br>To run the program, use the following command:</li></ol><pre>bal run .\helloworld.bal </pre><h4>Output :</h4><p>If everything is set up correctly, you should see the following output in your terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2pkKulwn9ce42VJp58dpQ.png" /></figure><p><strong>Tadaaa! We’ve run “Hello, World!” in Ballerina!</strong><br>See? It’s super easy to understand and run code in Ballerina. Once you get the basics down, you can start building more complex applications and integrations.</p><h3>Conclusion</h3><p>Congratulations! You’ve just written and run your first program in Ballerina. As you can see, the syntax is simple and similar to other programming languages. Now that you have the basics, you can start exploring more advanced features of Ballerina, such as working with APIs, microservices, and cloud-native applications.</p><p><strong>Happy coding, Ballerinas!</strong> 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad51b4e51e68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/getting-started-with-ballerina-hello-world-ad51b4e51e68">Getting Started with Ballerina: Hello World!</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Email Reminders Using WSO2 Choreo and Google APIs: A Step-by-Step Guide]]></title>
            <link>https://medium.com/codeblog/automating-email-reminders-using-wso2-choreo-and-google-apis-a-step-by-step-guide-8ec3f7f21bff?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ec3f7f21bff</guid>
            <category><![CDATA[choreo]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Sun, 06 Oct 2024 12:36:02 GMT</pubDate>
            <atom:updated>2026-04-12T09:51:20.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/784/0*If3cRwwcwnbHpuSk.jpg" /></figure><p>In this blog, you’ll learn how to create a scheduled task that reads data from a Google Sheet stored in Google Drive and automatically sends an email to a specific user based on that data.</p><p><strong>Use Case:</strong><br>At Organization “ABC,” there’s a requirement to notify cleaning staff a day before their scheduled duty. Currently, the organization maintains a timetable in a Google Sheet and manually checks it each day to send reminder emails. To streamline this process, they want to automate these reminders, reducing the daily manual effort.</p><p>To automate this process, we’ll leverage the following tools:</p><ul><li><a href="https://wso2.com/choreo/">WSO2 Choreo</a> : A powerful developer platform that will serve two primary purposes:<br>1. Deploying the Python script<br>2. Creating a scheduled task for automation</li><li><a href="https://www.python.org/">Python</a> : The programming language used to develop the script that will handle the logic</li><li><a href="https://developers.google.com/apis-explorer">Google APIs</a>: To access and interact with Google Drive and Google Sheets, where the timetable is stored..</li></ul><p>Let’s now visualize this with a high-level diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*sVmCL4-MrjwGfXIuzhxGcA.png" /><figcaption>High Level Diagram</figcaption></figure><p>Before diving into the implementation, let’s take a look at the structure of the Google Sheet that will serve as our data source. The sheet is organized in the following format:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81asW62LfEyz9KJxP1uA5g.png" /></figure><ul><li><strong>First column</strong>: Lists the days of the week (e.g., Monday, Tuesday, etc.)</li><li><strong>Second column</strong>: Contains the corresponding dates in numerical format (e.g., 1, 2, 3, etc.)</li><li><strong>Subsequent columns</strong>: Contain the email addresses of the cleaning staff, with each column representing a different staff member.</li></ul><h3>Step 1 : Creating Python Script</h3><p>We’ll begin by writing a Python script that reads the Google Sheet and sends an email to the appropriate user. The full code can be accessed on <a href="https://github.com/isurul28/CleanTaskChore">GitHub [here]</a>. In this section, I’ll highlight some key aspects of the code.</p><p>First, we need to define the <strong>scope</strong> and <strong>credentials</strong> required to access the Google Sheets API. This is done using the credentials1.json file, which securely stores the necessary Google API credentials. The script will authenticate using this file, ensuring it has the proper permissions to read the data from Google Sheets and trigger the email process..</p><pre>scope = [&#39;https://spreadsheets.google.com/feeds&#39;, &#39;https://www.googleapis.com/auth/drive&#39;]<br>credentials = ServiceAccountCredentials.from_json_keyfile_name(&#39;/credentials1.json&#39;, scope)  # Replace &#39;credentials.json&#39; with your credentials file</pre><p>From below code snippet we will be iterating through out the Google sheet to find the person who will be cleaning tomorrow</p><pre># Get tomorrow&#39;s date (the day before the ticket scan day)<br>tomorrow = datetime.date.today() + datetime.timedelta(days=1)<br><br># Find the row index corresponding to tomorrow&#39;s date in column B<br>row_index = None<br>dates = worksheet.col_values(2)<br>for index, date in enumerate(dates):<br>    if date == tomorrow.strftime(&#39;%-m/%-d/%Y&#39;):  # Adjusted date format for comparison<br>        row_index = index + 1  # Adding 1 because index starts from 0, but row numbering starts from 1<br>        break<br><br>if row_index is None:<br>    print(&quot;Tomorrow&#39;s date not found in the sheet.&quot;)<br>else:<br>    # Get the email address of the person assigned for tomorrow from columns C to K<br>    def get_column_letter(column_index):<br>        letters = &#39;&#39;<br>        while column_index &gt; 0:<br>            column_index, remainder = divmod(column_index - 1, 26)<br>            letters = chr(65 + remainder) + letters<br>        return letters<br><br>word = &quot;Clean&quot;<br>print(row_index)<br>row_values = worksheet.row_values(row_index)<br><br>column_alphabet = None<br>for col_index, cell_value in enumerate(row_values, start=1):<br>    if isinstance(cell_value, str) and word in cell_value:<br>        column_alphabet = get_column_letter(col_index)<br>        print(column_alphabet)<br>        break<br><br>if column_alphabet is None:<br>    print(&quot;Column with &#39;Clean&#39; not found.&quot;)<br>else:<br>    Email_index = 1<br>    Email_reference = f&quot;{column_alphabet}{Email_index}&quot;<br>    print(Email_reference)<br>    default_email_prefix = &quot;@gmail.com&quot;<br>    assigned_person_email_name = worksheet.acell(Email_reference).value<br>    assigned_person_email = assigned_person_email_name + default_email_prefix<br>    print(assigned_person_email)</pre><p>Once we identify the person from the Google Sheet, the script will send an email to them via Gmail. Additionally, I’ve embedded a button in the email content, allowing the recipient to easily create a reminder in their Google Calendar with a single click.</p><pre> if assigned_person_email is None:<br>        print(&quot;Assigned person&#39;s email not found.&quot;)<br>    else:<br>        # Create a function to generate the Google Calendar event link<br>        def generate_google_calendar_link():<br>            event_title = &quot;Cleaning Task Reminder&quot;<br>            event_description = &quot;Kind reminder,You have been allocated to do the Cleaning Task for tomorrow&quot;<br>            event_start_date = tomorrow.strftime(&#39;%Y%m%d&#39;)  # Format as YYYYMMDD<br>            event_start_time = &quot;030000&quot;  # Start time is 03:00 AM in UTC<br>            event_end_time = &quot;040000&quot;    # End time is 04:00 AM in UTC<br><br>            google_calendar_link = f&quot;https://www.google.com/calendar/render?action=TEMPLATE&amp;text={event_title}&amp;details={event_description}&amp;dates={event_start_date}T{event_start_time}Z/{event_start_date}T{event_end_time}Z&quot;<br>            return google_calendar_link<br><br>        # Send an email to the assigned person<br>        sender_email = os.environ.get(&quot;emailaddress&quot;)<br>        sender_password = os.environ.get(&quot;emailpass&quot;) <br><br>        message = MIMEMultipart()<br>        message[&#39;From&#39;] = sender_email<br>        message[&#39;To&#39;] = assigned_person_email<br>        message[&#39;Subject&#39;] = &#39;Cleaning Task Reminder Tomorrow&#39;<br><br>        google_calendar_link = generate_google_calendar_link()<br>        button_html = f&#39;&lt;a href=&quot;{google_calendar_link}&quot; target=&quot;_blank&quot;&gt;&lt;button style=&quot;background-color: #2196F3; color: white; border: none; border-radius: 4px; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer;&quot;&gt;Add to Google Calendar&lt;/button&gt;&lt;/a&gt;&#39;<br>        body = f&#39;Hello,&lt;br&gt; Kind reminder,You have been allocated to do Cleaning Task for tomorrow.&lt;br&gt; {button_html} &lt;br&gt;&lt;br&gt; &lt;i&gt;This is an auto-generated email.&lt;/i&gt;&#39;<br>        message.attach(MIMEText(body, &#39;html&#39;))<br><br>        server = smtplib.SMTP(&#39;smtp.gmail.com&#39;, 587)<br>        server.starttls()<br>        server.login(sender_email, sender_password)<br>        server.send_message(message)<br>        server.quit()</pre><h3>Steps 2 : Deploy the Python Script in WSO2 Choreo</h3><p>Next, we’ll deploy the Python script using <strong>WSO2 Choreo</strong>. Start by navigating to the Choreo home page and selecting your project. Within the project, you’ll need to create a <strong>Scheduled Task</strong> component, which will handle the automation of running the script at predefined intervals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yYpiwPV7Iy-Iy8qyIIhUw.png" /></figure><p>Now you will get redirect to a page where you need to give a name to your Scheduled task and a description for it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6l-YGwjOdeCLp-qj00oUg.png" /></figure><p>After configuring the Scheduled Task, you’ll need to provide the URL of your public repository or connect directly to GitHub. In this case, I’ll be using the repository URL: <a href="https://github.com/isurul28/CleanTaskChoreo">https://github.com/isurul28/CleanTaskChoreo</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDFx__lctck0Utt_NyRSpA.png" /></figure><p>Next, we need to select the appropriate <strong>Build Pack</strong>. In this case, we’ll choose the <strong>Python Build Pack</strong>. Then, specify the directory where the profile file is located and select the Python version you’d like to use for building the script. Finally, click the <strong>Create</strong> button to complete the process, and this will create the scheduled task in Choreo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKOPQXszwlaX4QNV9NaOFQ.png" /></figure><p>After its created you will be redirect to below over view page of the created Scheduled task</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpU3pOFb0QY_lajhaFcaGQ.png" /></figure><h3>Build :</h3><p>Now it’s time to build our project. To do this, navigate to the left-side menu where you’ll find the <strong>Build</strong> option, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BpI25oZAI9jOxP-ocoLK5g.png" /></figure><p>In the Build page click on Build latest button to build the python project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9QJuNIVJeUJtbNeN4kBi0A.png" /></figure><p>After you clicked it, the project will start to build and you can track the progress by view Build details below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bl_EwmsUTsTtvSzI9i5vfw.png" /></figure><p>You will see successful status once the build is completed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_RXI92lkOLaFj8LzxEn8Q.png" /></figure><p>Before we deploy the project to Choreo, we need to create a Google Cloud project to enable the Google Sheets and Google Drive APIs, which are essential for our Python script to function properly.</p><h3>STEP 3 : Configuring Google APIs</h3><ul><li>Go to <a href="https://console.cloud.google.com/">Google Cloud Console</a> and select your project. If you haven’t created a project yet, you can easily set one up.</li><li>After creating the project, navigate to the left-side menu, click on <strong>APIs &amp; Services</strong>, and then select <strong>Library</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvIg_vrl4b9APONiO0qfug.png" /></figure><p>In the Library view you can search for Google Sheet API and Google Drive. Enable these API for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1UCFFHykqFCdH07oxRhfA.png" /></figure><p>After enabling them in your project you need to go to the left side menu and select IAM &amp; Admin &gt;&gt; Service Accounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTmlQ3spF7d66I88zl40Eg.png" /></figure><p>Create a <strong>Service Account</strong> by following the prompts in the Google Cloud Console. For this project, I’ve named my service account <strong>“TicketScan.”</strong> This service account will be used to invoke the Google APIs we enabled in the API Library.</p><p>Please note that a unique email address will be generated for the service account. To grant the service account access to your Google Sheet, you must share the sheet with this email address. Only then will the service account be able to read the Cleaning Time table.</p><p>Next, we need to obtain the key file for this service account, which will be referenced as <strong>/credentials1.json</strong> in our Python code. Here’s how to do it:</p><ol><li>From the left-side menu, navigate to <strong>Service Accounts</strong> and click on the service account you created.</li><li>Go to the <strong>Keys</strong> section and select <strong>Add Key</strong> &gt; <strong>Create New Key</strong>.</li><li>When prompted for the key file format, choose the <strong>JSON</strong> option. This will download a JSON file to your machine. Rename this file to <strong>credentials1.json</strong>.</li></ol><p>Now, to send emails, you’ll need a Gmail account. However, you cannot use your regular Gmail password within the Python project to send emails to the cleaners. Instead, follow these steps to create an App Password:</p><ol><li>Go to your Google Account settings.</li><li>Navigate to <strong>Security</strong>.</li><li>Under <strong>Signing in to Google</strong>, find <strong>App passwords</strong> and create a new App Password.</li><li>Make sure to note down this password, as it will be used as the email password when deploying to WSO2 Choreo.</li></ol><h3>Deploy :</h3><p>Now it’s time to deploy the built project. To do this, navigate to the left-side menu and click on <strong>Deploy</strong>. In the deployment menu, you will see two environments: <strong>Development</strong> and <strong>Production</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3_tmNjijNs6aMMIhsf45g.png" /></figure><p>Next, click on the <strong>Configure &amp; Deploy</strong> option. A window will pop up on the right side, allowing you to configure environment variables for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*EL-5z-aQnjCr35I4-Y7t8g.png" /></figure><p>Since our project requires the following environment variables, we will add them now:</p><ul><li><strong>emailaddress</strong></li><li><strong>emailpass</strong></li></ul><p>When entering the <strong>emailpass</strong>, which you obtained from the Google App Password, make sure to check the <strong>Secret</strong> option. This will encrypt the email password for enhanced security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*PyT-3Eiq_YERpuJUDsHImg.png" /></figure><p>Click <strong>Next</strong>, and you will be prompted to mount a file. For this step, add the key details you obtained from the Google Service Account and save it as <strong>/credentials1.json</strong>. Remember to mark it as a <strong>Secret</strong> as well, since it contains sensitive information.</p><p>After this, click <strong>Next</strong>, and you will arrive at the <strong>Scheduled Task Configuration</strong> view, where you can configure the following settings:</p><ul><li><strong>Time Zone</strong></li><li><strong>Triggering Frequency</strong> of the task</li><li><strong>Job Timeout</strong></li></ul><p>Alternatively, you can provide a custom cron expression.</p><p>Once you’ve configured these settings, you can deploy the scheduled task to the <strong>Development</strong> environment. In my setup, the scheduled task is configured to run every day at <strong>9 AM Dubai Time</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*6sC27jiyUoJCLSc5V8S28A.png" /></figure><p>But wait — it’s currently 10:25 AM. Do I really have to wait until tomorrow to check if the scheduled task is working correctly?</p><p>Absolutely not! You can manually trigger your scheduled task by navigating to the <strong>Execute</strong> option in the left-side menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*XsPhRRFk_Tsr39WLDTyA8g.png" /></figure><p>In the <strong>Execute</strong> view, you will see the <strong>Run Now</strong> button at the top right corner. <strong>Go ahead and click it!</strong> We’ve all been waiting for this moment. Once you press <strong>Run</strong>, you’ll notice a new execution entry starting to appear in the execution list below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAczaksQX4E-t6IaB_kAuQ.png" /></figure><p>You can click on the execution and it will give a left side popup window as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JODpRtEtagTpJs-Ba6_y3A.png" /></figure><p>Click on view log and it will give the full log what happen during the execution of the python project as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cp3j5MqgKZUVQhaKOSfPIA.png" /></figure><p>Now, let’s check who received the email reminder. Today is <strong>06/08/2024</strong>, and tomorrow will be <strong>07/08/2024</strong>. According to our Google Sheet, <strong>Isuru Liyanage (ME)</strong> is scheduled for cleaning duty tomorrow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H37WPxvS2zQVlHg_1RO-Jg.png" /></figure><p>Let’s check my email inbox to see if I’ve received the reminder. As you can see, I have received the cleaning reminder email, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3g9yJSeVBTK-2QFQUDtQog.png" /></figure><p>By clicking the <strong>Add to Google Calendar</strong> button, I can easily add a reminder to my Google Calendar, ensuring I won’t forget it.</p><p>This is how I created an email reminder task using <strong>WSO2 Choreo</strong>, <strong>Google APIs</strong>, and <strong>Python</strong>. I hope this guide helps someone out there.</p><p><strong>Happy coding!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ec3f7f21bff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/automating-email-reminders-using-wso2-choreo-and-google-apis-a-step-by-step-guide-8ec3f7f21bff">Automating Email Reminders Using WSO2 Choreo and Google APIs: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying WSO2 MI Seamlessly with Kubernetes]]></title>
            <link>https://medium.com/codeblog/deploying-wso2-mi-seamlessly-with-kubernetes-4afae9cade92?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/4afae9cade92</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[wso2-mi]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Tue, 26 Dec 2023 18:11:03 GMT</pubDate>
            <atom:updated>2023-12-26T18:11:03.042Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*BHE05P6gNXipMkNr_zSGJw.png" /></figure><p>Greetings, Geeks! In today’s tutorial, we’ll embark on an exciting journey into the world of Kubernetes, exploring the installation of Rancher Desktop on your local machine. But that’s not all — we’ll take it a step further by demonstrating how to deploy the powerful WSO2 Micro Integrator (MI) server in a Kubernetes cluster. So, buckle up and get ready for a hands-on experience that will enhance your skills in managing containerized applications.</p><p><strong>Steps :</strong></p><h4><strong>1. Installing Rancher</strong></h4><p>lets install Rancher on our machines. Navigate to the official <a href="https://rancherdesktop.io/">Rancher Website</a> and download Rancher. Now Install the application.</p><h4><strong>2. Configure Rancher for Kubernetes</strong></h4><p>After you have install the application you need to Open Rancher Desktop. Click on the setting Icon located at right top of Rancher Desktop window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QseKz2knB9J1d5lThNm8jw.png" /></figure><p>Go to application Section and put the tick for Administrative Access. Now go to virtual machine section and provide needed CPUs and memory needed for Rancher pods.<br>Now go to kubernetes section and disable (untick) ‘Traefik’. We are disabling Traefix because we are going to install Ingress load balancer in our setup.</p><h4>3. <strong>Installing Helm</strong></h4><p>Helm is installed with Rancher desktop So we do not need to install Helm.</p><h4>4.<strong> Setting up Ingress-Nginx controller in K8 cluster</strong></h4><p>To install the Ingress controller on your Kubernetes cluster, simply execute the following command:</p><pre>helm upgrade --install ingress-nginx ingress-nginx   --repo https://kubernetes.github.io/ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace</pre><p>You can conveniently monitor the Ingress controller’s status through the Rancher Desktop cluster dashboard. Navigate to the “Cluster &gt;&gt; Namespace” section to find the newly created “ingress-nginx” namespace, which should be in an active state, indicating successful installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZL6ZqDMWnTCUXVQW5zBFQ.png" /><figcaption>Cluster Dashboard</figcaption></figure><p>You can run the below command in terminal and get the same output</p><pre>kubectl get pods -o wide -n ingress-nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULXuAxZYay1oTJAFS1bDow.png" /></figure><p>Now we need to know IP address of the Ingress load balancer. This IP address is needed to route the traffic to the services inside the K8 cluster.</p><p>So lets go to cluster dashboard and go to Service Directory &gt;&gt; Services. You will see the services deployed in the K8 cluster. Click on “<a href="http://127.0.0.1:6120/c/local/explorer/service/ingress-nginx/ingress-nginx-controller">ingress-nginx-controller</a>” and you will see the load balancer IP address on the top as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFbh1hR0XqjLPfxKWyuXlQ.png" /></figure><p>So in our setup the Load balancer IP address will be 192.168.1.5. You can view the same using kubectl commands in the terminal.</p><pre>kubectl get services -o wide -n ingress-nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsiQH36obiMM4QKG0V3Nrw.png" /></figure><h4>5. <strong>Building WSO2 MI docker Image</strong></h4><p>Okay let’s structure the instructions for creating the Dockerfile:</p><ul><li>Create a folder named “Docker_Artifacts” and within it, another folder named “MI_Image.”</li></ul><pre>mkdir Docker_Artifacts<br>cd Docker_Artifacts<br>mkdir MI_Image<br>cd MI_Image</pre><ul><li>Inside the “MI_Image” folder, create a file named “Dockerfile.”</li></ul><pre>touch Dockerfile</pre><ul><li>Open the “Dockerfile” and add the WSO2 Docker image tag. You can refer to the <a href="https://ei.docs.wso2.com/en/latest/micro-integrator/setup/installation/run_in_containers/">WSO2 MI Docker documentation</a> for more details.</li></ul><pre>FROM wso2/wso2mi:latest</pre><p>let’s continue building the Dockerfile by adding instructions to include the Hello World API in the MI server. Assuming you have the CAR file for your Hello World API, you can follow these steps:</p><ul><li>Create a “carbonapps” folder inside the “MI_Image” folder:</li></ul><pre>mkdir carbonapps</pre><p>Copy the CAR file of your Hello World API to the “carbonapps” directory. Replace YourHelloWorldAPI.car with the actual filename:</p><pre>cp /path/to/YourHelloWorldAPI.car MI_Image/carbonapps/</pre><p>Now, open the Dockerfile and add the following lines to include the “carbonapps” folder inside the Docker image:</p><pre># Dockerfile<br><br># Use the base WSO2 MI Docker image<br>FROM wso2/micro-integrator:latest<br><br># Create a directory for carbonapps and copy the Hello World API CAR file<br>COPY carbonapps /home/wso2carbon/wso2mi/repository/deployment/server/carbonapps</pre><p>We have copied our CAR file to the docker image.</p><p>Next, We need to add the Ingress-controllers certificate to WSO2 MI server. This is because MI server is deployed inside a K8 cluster, So to communicate with outside, the MI server need to go through load balancer. To do this communication the client certificate of ingress contoller should be present in MI server side.</p><p>Now, let’s download the certificate of the ingress server with below command</p><pre>openssl s_client -showcerts -connect 192.168.1.5:443 &lt;/dev/null 2&gt;/dev/null | openssl x509 -outform PEM &gt; ingress_certificate.pem</pre><p><strong><em>Note :</em></strong><em> You need to replace the IP address with the IP address of your load balancer that we found in our previous steps.</em></p><p>You will get the certificate as ‘ingress_certificate.pem’.</p><p>Now lets copy client-truststore.jks file to “MI_Image” folder. You can find the client-truststore.jks from a downloaded WSO2 MI pack which is located in [MI_HOME]/repository/resources/security directory. <br><br>Let’s import the certificate to the ‘client-truststore.jks’ using the below command</p><pre>keytool -import -alias ingresscert -file ingress_certificate.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>Now we need to add the client-truststore.jks to our Docker image. We can do it by adding the below COPY line in Dockerfile</p><pre>COPY --chown=wso2carbon:wso2 client-truststore.jks /home/wso2carbon/wso2mi-4.2.0/repository/resources/security</pre><p>Below is my full Dockerfile after adding above lines</p><pre><br># set base docker image to public docker image of WSO2<br>FROM wso2/wso2mi:latest<br><br>#Adding Hello World API CAR to the docker image<br>COPY --chown=wso2carbon:wso2 carbonapps /home/wso2carbon/wso2mi-4.2.0/repository/deployment/server/<br># add client-truststore to the docker image<br>COPY --chown=wso2carbon:wso2 client-truststore.jks /home/wso2carbon/wso2mi-4.2.0/repository/resources/security</pre><p>Now we are done with creating our Docker image. Now we need to build this docker image. <br>Run the below command from the place where the Dockerfile is saved (“MI_Image directory”).</p><pre>docker build . -t my_wso2mi:4.2.0</pre><p>This will build our docker image “my_wso2mi:4.2.0”.</p><h4>6. Preparing MI Helm charts</h4><p>Now we need to clone WSO2 MI helm charts from <a href="https://github.com/wso2/kubernetes-mi">WSO2 MI Helm Github repository</a>.</p><p>Run the below command to clone repository to your machine</p><pre>git clone https://github.com/wso2/kubernetes-mi.git</pre><p>Now we have cloned the WSO2 MI helm chars to our machine, Lets do some small adjustment for the configurations.</p><ul><li>Rancher Desktop uses local-path storage classes. The default MI helm uses nfs storage classes. So lets change the nfs storage classes to local-path storage classes.<br>Open the ‘values.yaml’ file in your ‘HELM_HOME’.<br>Update the ‘nfsServerProvisioner’ section and make it false as we are using the ‘local-path’ storage class.</li><li>Update the ‘storageClass’ parameter as below</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwELc8rspHPiit0mB4qbkg.png" /></figure><ul><li>We have built our own docker image in this example. So let’s use that in the configurations as below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*7XmOMwq_P09gBPTOHNdNZg.png" /></figure><ul><li>By default it will try to download the docker image. To avoid that Change the ‘imagePullPolicy’ value to IfNotPresent</li><li>Lets increase the default resource allocated of the pod as below</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*yEzxFfJNiL4RqztQ6lA5eg.png" /></figure><p>Now we are done with the configurations. Lets deploy 😎</p><h4>7. Deploying the updated Helm chart</h4><p>Now our artifacts are ready to be deployed to Kubernetes cluster. Lets execute the below command from the the directory we cloned (kubernetes-mi/helm/micro-integrator/)</p><pre>helm install wso2mi . --version 4.2.0 --namespace mi --dependency-update  --create-namespace</pre><p>Here we are creating a release named “wso2mi” with namespace “mi”. <br>In Rancher Desktop cluster dashboard lets go to Workloads &gt;&gt; Pods. <br>In this view you can see the status of the pod we created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68GzgQf62p7s5cBMqVwwPA.png" /></figure><h4>8. DNS Mapping</h4><p>Invoke the below command in the terminal. This will list ingress in the MI namespace</p><pre>kubectl get ing -o wide -n mi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swarn3iN3gus8ENkmUjsGQ.png" /></figure><p>As you can see the MI service hotname is mi.wso2.com. So if we run a the below CURL command to our Hello Word API, it will throw a connection refused error</p><pre>curl --location &#39;https://mi.wso2.com/HelloWorld&#39;</pre><p>This is because the machine can not resolve the mi.wso2.com host name. So we need to add a hots entry in the machine.</p><p>Open up the ‘/etc/hosts’ file of your system and add the below entry.</p><pre>192.168.1.5 mi.wso2.com management.mi.wso2.com wso2mi-micro-integrator-management-ingress</pre><p>Now lets run the below CURL command again and you will get a sucssfull response</p><pre>curl --location &#39;https://mi.wso2.com/HelloWorld&#39;</pre><p>Thats it Geeks! We have successfully deploy the WSO2 MI in K8 cluster.</p><p>Merry Christmas and Happy New Year !</p><p>Reference :</p><p>[1]. Hello World API synapse configuration:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;api context=&quot;/HelloWorld&quot; name=&quot;HelloWorld&quot; xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;<br>    &lt;resource methods=&quot;GET&quot;&gt;<br>        &lt;inSequence&gt;<br>            &lt;payloadFactory media-type=&quot;json&quot;&gt;<br>                &lt;format&gt;{&quot;Hello&quot;:&quot;World&quot;}&lt;/format&gt;<br>                &lt;args/&gt;<br>            &lt;/payloadFactory&gt;<br>            &lt;respond/&gt;<br>        &lt;/inSequence&gt;<br>        &lt;outSequence/&gt;<br>        &lt;faultSequence/&gt;<br>    &lt;/resource&gt;<br>&lt;/api&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4afae9cade92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/deploying-wso2-mi-seamlessly-with-kubernetes-4afae9cade92">Deploying WSO2 MI Seamlessly with Kubernetes</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choreo Chronicles: How to Deploy Your ReactJS and NodeJS WebApp with Choreo Magic in Minutes!]]></title>
            <link>https://medium.com/choreo-tech-blog/choreo-chronicles-how-to-deploy-your-reactjs-and-nodejs-webapp-with-choreo-magic-in-minutes-c64587f292cb?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/c64587f292cb</guid>
            <category><![CDATA[choreo]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Thu, 07 Dec 2023 09:51:12 GMT</pubDate>
            <atom:updated>2024-08-12T11:46:10.980Z</atom:updated>
            <content:encoded><![CDATA[<h3>Choreo Chronicles: How to Deploy Your ReactJS and NodeJS WebApp with Choreo in Minutes!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*ubXLWKYh7efCsWdN6k9FPg.png" /></figure><p>In this blog post, I’ll demonstrate the simplicity of deploying your ReactJS and NodeJS web app to the internet, thanks to WSO2’s innovative new product, <a href="https://choreo.dev/?utm_source=me&amp;utm_medium=orgpost&amp;utm_campaign=me_orgpost_choreo_chronicles_240812">Choreo</a>. If you’re curious about Choreo and want to learn more, you can check out <a href="https://choreo.dev/?utm_source=me&amp;utm_medium=orgpost&amp;utm_campaign=me_orgpost_choreo_chronicles_240812">this link</a>. Let’s dive right in and get started! 😊</p><p>I have created my <a href="https://github.com/isurul28/react-jwt-auth">front-end application</a> with Reactjs and my back-end application with <a href="https://github.com/isurul28/node-js-jwt-auth">Nodejs</a>. Now I need to deploy these two web apps so I can access them via the Internet.</p><p>Let’s delve into the functionality of my web application. The front-end is designed to send data to the backend, which, in turn, stores this information in a MySQL database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wXBE74mjtbJErroAJtiM-A.png" /><figcaption>Architecture Diagram</figcaption></figure><p>So what I expect from Choreo is to,</p><ul><li>Deploy my Reactjs front-end</li><li>Deploy my Nodejs backend</li><li>Create a MYSQL database and connect that to my backend</li></ul><p>Let’s explore if Choreo can fulfil these wishes, making it the ultimate gift for my web development needs this Christmas.</p><h3>Deploying ReactJS Front-end Application</h3><p><strong>Step 1: SignUp and Login to Choreo</strong></p><p>Begin by visiting <a href="https://console.choreo.dev/signup">https://console.choreo.dev/signup</a> to create your Choreo account. Once registered, proceed to log in. During the initial setup, Choreo will prompt you to create an organization, where you can choose any name that suits your preference. This marks the first step in your Choreo journey.</p><p><strong>Step 2: Create Organization and Project</strong></p><p>Now you will be redirected to the organization overview page shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSPp92iBp7qkuUBe9D2cjA.png" /></figure><p>Click on the “Default Project” card, or if you prefer, create a new project with a name of your choice. This action will redirect you to the following page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kjuVmn68EiaPkm2gcejwA.png" /></figure><p>Upon reaching this page, you’ll notice various options for building in Choreo. For our specific goal of deploying the ReactJS web app, select <strong>Web Application</strong>. This choice will lead you to the next page, where you’ll need to input the Component Name and provide a brief description of the component you’re creating. For this instance, let’s name the component <strong>Front-End.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKukFkXp3HrYuzGu94r_Rg.png" /></figure><p><strong>Step 3: Connect to the code repository</strong></p><p>Next, click on the <strong>Authorize with Github</strong> option to establish a connection between your Github repository and Choreo. This step allows us to seamlessly reference and deploy your application. Alternatively, Choreo provides flexibility by offering the option to connect with Bitbucket or a Container Registry based on your preference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*GsNJwCHYBswlFLbifMKgog.png" /></figure><p>Once Choreo is successfully connected to Github, you’ll be prompted to choose the organization, repository, and branch where your ReactJS code is housed. Note that with the Developer plan, you can only connect to public repositories. If you decide to upgrade your Choreo plan, you’ll gain the ability to point to private repositories as well. Make your selection accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQjLOLueqmsQx702lFEkHQ.png" /></figure><p>As the next step we need to select the buildpack. In our example, we&#39;ll be selecting theReact Build pack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hU68FGlpR4c60IvMfphYrw.png" /></figure><p>Then you have to fill the below fields according to your Reactjs project</p><ul><li>Project Directory: /</li><li>Build Command: npm run build</li><li>Build Path: /build</li><li>Node Version: 21</li></ul><p>Press the create button and it will create your front-end application on Choreo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*iKhJYu36_spRMMfkIisaRg.png" /></figure><p>After the Web app has been successfully created you will be redirected to the below page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DW5Ct3HLkNmfSY3CPSu3Hw.png" /></figure><p><strong>4th Step: Build the Web App</strong></p><p>Now let&#39;s build our web application. Go to the left menu and Click on the Build option. You will see a page like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKQUnckq-duekTbjN8WOBg.png" /></figure><p>Click the “Build” button located in the lower right corner. This action will open a side window displaying recent commits for the selected branch. Choose the latest commit and initiate the build process by clicking the “Build” button. Subsequently, Choreo will provide you with a visual representation of the building&#39;s progress, keeping you informed about each step along the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*RoHlwzSRQTELz7eLOuIn3Q.png" /></figure><p>When the build is successful you can see the status of your build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDjX-eDrO5ONLGY32nIt_w.png" /></figure><p>To proceed with deploying our build, access the left-side menu and click on the “Deploy” option. Subsequently, click on the “Deploy” button located within the setup card. This action will set in motion the deployment process, ensuring that your application is successfully deployed and ready for use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*uHaoJCGpF91kWdsR-dpxaQ.png" /></figure><p>Once you click on “Deploy,” the build will be deployed to the Development environment. You’ll be able to monitor and track the deployment progress as it unfolds. The Development environment serves as a staging ground for testing and refining your application before going live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QZ-bGiqhEo7SlsB_muctQ.png" /></figure><p>Now, click on the “Web App URL,” and it will redirect you to your ReactJS web app. Tada! In just a few minutes, you’ve successfully deployed your ReactJS web app, making it accessible through the provided URL. Congratulations on this efficient and hassle-free deployment using Choreo!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmE8XCxJMD-AioyLuhoGEg.png" /></figure><p>Similarly, if everything is functioning as expected in the Development environment, you can promote the build to production. Head to the build page and click on the “Promote” button under the Development card. This ensures a smooth transition from the testing phase to the live production environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP6aAY-IYVNeV2wXr5z_5A.png" /></figure><p>In Part 2 of the Choreo Chronicles, I’ll guide you through the deployment process for our Node.js back-end on <a href="https://choreo.dev/?utm_source=me&amp;utm_medium=orgpost&amp;utm_campaign=me_orgpost_choreo_chronicles_240812">Choreo</a>. This comprehensive tutorial aims to assist you in effortlessly deploying not just React.js applications but various other applications as well.</p><p>Wishing you a seamless and joyous deployment experience! Happy Deploying!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c64587f292cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/choreo-tech-blog/choreo-chronicles-how-to-deploy-your-reactjs-and-nodejs-webapp-with-choreo-magic-in-minutes-c64587f292cb">Choreo Chronicles: How to Deploy Your ReactJS and NodeJS WebApp with Choreo Magic in Minutes!</a> was originally published in <a href="https://medium.com/choreo-tech-blog">Choreo Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Performance Insights: Connecting JConsole to WSO2 MI Docker Container with Ease]]></title>
            <link>https://medium.com/codeblog/unlocking-performance-insights-connecting-jconsole-to-wso2-mi-docker-container-with-ease-889299fbb08a?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/889299fbb08a</guid>
            <category><![CDATA[jconsole]]></category>
            <category><![CDATA[mi]]></category>
            <category><![CDATA[jmx]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 18:14:15 GMT</pubDate>
            <atom:updated>2023-12-05T18:14:15.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ySRf0JaJMXpErNov.jpg" /></figure><p>In this blog post, I will guide you through the process of configuring JConsole to connect to a WSO2 MI instance running within a Docker container.</p><p>To begin, we’ll initiate the creation of our WSO2 MI Docker image. Our approach involves pulling the latest Docker image from the designated tag docker.wso2.com/wso2mi:4.1.0.0. It’s important to note that a subscription is required to access and pull this specific image. This task will be accomplished using a Dockerfile to streamline the process.</p><pre>FROM docker.wso2.com/wso2mi:4.1.0.0</pre><p>Next, we must activate JMX in our MI server. This involves incorporating the following parameters into the micro-integrator.sh file. To obtain the micro-integrator.sh file, you can download the MI pack from the official <a href="https://wso2.com/micro-integrator/">WSO2 MI website</a> and secure a copy of the file to the directory where your Dockerfile is located. Once obtained, open the file and append the specified parameters.</p><p>I will be configuring the JMX remote port to operate on 9999 without any authentication.</p><pre>    -Dcom.sun.management.jmxremote.port=9999 \<br>    -Dcom.sun.management.jmxremote.authenticate=false \<br>    -Dcom.sun.management.jmxremote.ssl=false \</pre><p>Following the file modifications, it’s essential to include it in our Docker image. To achieve this, you can add the following line to your Dockerfile:</p><pre>COPY micro-integrator.sh /home/wso2carbon/wso2mi-4.1.0/bin</pre><p>Now my dockerfile will look like the below</p><pre>FROM docker.wso2.com/wso2mi:4.1.0.0<br>COPY micro-integrator.sh /home/wso2carbon/wso2mi-4.1.0/bin</pre><p>To construct the Docker image, execute the following command in the directory where you’ve crafted the Dockerfile:</p><pre>docker build .</pre><p>Once you’ve successfully created the Docker image, launch it using the following command, where the -p flag denotes port forwarding:</p><pre>docker run -p 8290:8290 -p 9999:9999 8031b100b4dd97ed1ddf369a2e35ed207a9c8a7c4a26aa95583d09879b07d9f9</pre><p>In case a Docker image tag was not assigned during the build, you’ll need to utilize the Docker image ID when running the Docker image.</p><p>Now, let’s initiate JConsole by navigating to the [JDK_HOME]/bin directory. This action will prompt the following window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*dVlLQPGApU7BQC0Z0IIA3g.png" /></figure><p>Next, click on the “Remote Process”. Provide the hostname and JMX port as follows, then click the “Connect” button:</p><pre>localhost:9999</pre><p>You will now be presented with the following window, showcasing a comprehensive array of monitoring statistics for your analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*XToupsc0bymmrhTqnziLoA.png" /></figure><p>This guide should prove invaluable for your day-to-day monitoring of WSO2 MI.</p><p>Happy monitoring!!!!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=889299fbb08a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/unlocking-performance-insights-connecting-jconsole-to-wso2-mi-docker-container-with-ease-889299fbb08a">Unlocking Performance Insights: Connecting JConsole to WSO2 MI Docker Container with Ease</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLACE + WSO2 MI]]></title>
            <link>https://medium.com/codeblog/solace-wso2-mi-f289c4e8e826?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/f289c4e8e826</guid>
            <category><![CDATA[solace]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[message-queue]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 11:50:48 GMT</pubDate>
            <atom:updated>2023-11-28T11:50:48.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*XvuDcimfKZZo6zvhUepwYw.png" /></figure><p>Greetings, Tech Enthusiasts! 🚀 Today we are going to dive into our latest blog where we unravel the intricacies of configuring Solace as a message broker in WSO2 Micro Integrator (MI)</p><p>Pre-requisites</p><ul><li><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">Docker install on your environment</a></li><li><a href="https://wso2.com/micro-integrator/">WSO2 MI</a></li></ul><h4><strong>Configure Solace</strong></h4><p>To begin, let’s set up Solace on our local machine. Navigate to the provided link [1] and use the following commands to pull a Docker image from Solace:</p><p><strong>Windows / Linux Users</strong></p><pre>docker run -d -p 8080:8080 -p 55555:55555 -p 8008:8008 -p 1883:1883 -p 8000:8000 -p 5672:5672 -p 9000:9000 -p 2222:2222 --shm-size=2g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard</pre><p><strong>Mac OS users</strong></p><pre>docker run -d -p 8080:8080 -p 55554:55555 -p 8008:8008 -p 1883:1883 -p 8000:8000 -p 5672:5672 -p 9000:9000 -p 2222:2222 --shm-size=2g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard</pre><p>Next, open your preferred browser and enter the following URL: <a href="http://localhost:8080/">http://localhost:8080</a>. This will unveil the Solace dashboard. Access it by logging in with the credentials: user — admin, password — admin.</p><p>Now, let’s forge ahead by creating a new queue named “MyWso2Q.” Navigate to the queue section, click on the default box, and then select “Queues” from the left-side menu. To add a new queue, click on the +Queue option as illustrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V24dkPaGhhCWxFnuZnNCiw.png" /></figure><p>After you have created the Queue, you can see it in the Queue list below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGZY8FJ28lHx4W6g8JVIZw.png" /><figcaption>Queue List</figcaption></figure><p>Now we need to go to the JMS JNDI menu from the left side menu bar and go to the queue section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvO6xFB_VX3JnRt5UEHjKw.png" /></figure><p>Let&#39;s create a JMS Queue by clicking the right top button “+ JMS Queue”. Give “MyWso2Q” as the JNDI name and select “MyWso2Q” as the physical name from the drop-down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cnsLqUVSEdbjF_U2t53kg.png" /><figcaption>Solace JMS Queue</figcaption></figure><p>Congratulations! 🎉 We’ve successfully completed the setup process and created a new queue in Solace</p><h3>Configuring WSO2 MI</h3><p>Now, let’s proceed with configuring the WSO2 MI server. Navigate to the [MI_HOME]/conf directory and open the deployment.toml file.</p><p>Create a connection factory for the Solace transport sender by adding the following configuration to the deployment.toml file:</p><pre>[[transport.jms.sender]]<br>name = &quot;myQueueSender&quot;<br>parameter.initial_naming_factory = &quot;com.solacesystems.jndi.SolJNDIInitialContextFactory&quot;<br>parameter.provider_url = &quot;smf://admin:admin@localhost:55555&quot;<br>parameter.connection_factory_name = &quot;/jms/cf/default&quot;<br>parameter.connection_factory_type = &quot;queue&quot;<br>parameter.cache_level = &quot;producer&quot;</pre><p>Be sure to customize the Solace broker URL, client username, and client password with your specific credentials.</p><p>Following the configuration changes, it’s crucial to enhance your MI server by incorporating the following two Solace JARs into the [MI_HOME]/lib directory:</p><ol><li>sol-jcsmp-10.13.0.jar</li><li>sol-jms-10.13.0.jar</li></ol><p>Ensure these JAR files are correctly placed in the specified directory.</p><p>Now, let’s initiate the MI server and verify its ability to establish a connection with Solace. Navigate to the [MI_HOME]/bin directory, open the terminal, and execute the following command:</p><pre>./micro-integrator.sh</pre><p>Monitor the logs to confirm the successful establishment of the connection as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5uZl_hgeeru2_hhZgnTr7Q.png" /><figcaption>Terminal Log</figcaption></figure><p>Now let&#39;s create an API which will publish messages to our MyWso2Q queue in the Solace. You can use Integration Studio[2] to develop your API. <br>Below is my API synapse configuration</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;api context=&quot;/hellorestapi&quot; name=&quot;HelloRestAPI&quot; xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;<br>    &lt;resource methods=&quot;POST&quot;&gt;<br>        &lt;inSequence&gt;<br>            &lt;property name=&quot;OUT_ONLY&quot; scope=&quot;default&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;<br>            &lt;property name=&quot;FORCE_SC_ACCEPTED&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;<br>            &lt;send&gt;<br>                &lt;endpoint&gt;<br>                    &lt;address uri=&quot;jms:/MyWso2Q?transport.jms.ConnectionFactory=myQueueSender&amp;amp;transport.jms.DestinationType=queue&quot;&gt;<br>                        &lt;suspendOnFailure&gt;<br>                            &lt;initialDuration&gt;-1&lt;/initialDuration&gt;<br>                            &lt;progressionFactor&gt;-1&lt;/progressionFactor&gt;<br>                            &lt;maximumDuration&gt;0&lt;/maximumDuration&gt;<br>                        &lt;/suspendOnFailure&gt;<br>                        &lt;markForSuspension&gt;<br>                            &lt;retriesBeforeSuspension&gt;0&lt;/retriesBeforeSuspension&gt;<br>                        &lt;/markForSuspension&gt;<br>                    &lt;/address&gt;<br>                &lt;/endpoint&gt;<br>            &lt;/send&gt;<br>        &lt;/inSequence&gt;<br>        &lt;outSequence&gt;<br>            &lt;send/&gt;<br>        &lt;/outSequence&gt;<br>        &lt;faultSequence/&gt;<br>    &lt;/resource&gt;<br>&lt;/api&gt;</pre><p>Now export the CAR app and place it in the [MI_HOME]/carbonapps directory</p><p>let’s invoke HelloRestAPI using the below CURL command</p><pre>curl --location &#39;http://localhost:8290/hellorestapi&#39; \<br>--header &#39;Content-Type: application/xml&#39; \<br>--data &#39;&lt;name&gt;Hello World!!&lt;/name&gt;&#39;</pre><p>Now we will go to the Solace dashboard &gt;&gt; Queue &gt;&gt; MyWso2Q &gt;&gt; Message Queued section. You will see that the message that we sent from WSO2 MI is in the queue as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0x9KVPVT5lmYx5d5IgJaDw.png" /></figure><p>Fantastic news! 🎉 The mission is accomplished as we’ve successfully published a message from WSO2 MI to the Solace JMS queue. Your integration journey just hit a major milestone. May this accomplishment contribute to seamless and efficient day-to-day integrations.</p><p>Happy coding, everyone! 🚀💻</p><p>[1].<a href="https://solace.com/products/event-broker/software/getting-started/">https://solace.com/products/event-broker/software/getting-started/</a></p><p>[2].<a href="https://ei.docs.wso2.com/en/latest/micro-integrator/develop/installing-WSO2-Integration-Studio/">https://ei.docs.wso2.com/en/latest/micro-integrator/develop/installing-WSO2-Integration-Studio/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f289c4e8e826" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/solace-wso2-mi-f289c4e8e826">SOLACE + WSO2 MI</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring WSO2 IS 5.11 as 3rd party key-manager in WSO2 APIM 4.2.0]]></title>
            <link>https://medium.com/codeblog/configuring-wso2-is-5-11-as-3rd-party-key-manager-in-wso2-apim-4-2-0-2cea6785a47e?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cea6785a47e</guid>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[key-manager]]></category>
            <category><![CDATA[access-token]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Mon, 27 Nov 2023 10:44:23 GMT</pubDate>
            <atom:updated>2023-11-27T11:28:23.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/240/0*Kr-BFZETVNii2Enz" /></figure><p>In this blog post, I will demonstrate the process of setting up the WSO2 Identity Server (IS) as a third-party key manager for WSO2 API Manager (APIM) 4.2.0, eliminating the need for external calls to WSO2 IS for token validation.</p><h3>Step 1 — Configure WSO2 IS</h3><p>1. Download and install the <a href="https://wso2.com/identity-server/">WSO2 Identity Server 5.11.0</a>.</p><p>If you downloaded the archive, extract it. &lt;IS_HOME&gt; refers to the root folder of the extracted WSO2 IS.</p><p>2. Add following configurations in the &lt;IS_HOME&gt;/repository/conf/deployment.toml file.</p><pre>[[event_listener]]<br>id = &quot;token_revocation&quot;<br>type = &quot;org.wso2.carbon.identity.core.handler.AbstractIdentityHandler&quot;<br>name = &quot;org.wso2.is.notification.ApimOauthEventInterceptor&quot;<br>order = 1<br><br>[event_listener.properties]<br>notification_endpoint = &quot;https://localhost:9443/internal/data/v1/notify&quot;<br>username = &quot;${admin.username}&quot;<br>password = &quot;${admin.password}&quot;<br>&#39;header.X-WSO2-KEY-MANAGER&#39; = &quot;WSO2-IS&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.)/keymanager-operations/user-info/claims(.)&quot;<br>secure = true<br>http_method = &quot;GET&quot;<br>permissions = &quot;/permission/admin/manage/identity/usermgt/list&quot;<br>scopes = &quot;internal_user_mgt_list&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/user-info/claims/generate&quot;<br>secure = true<br>http_method = &quot;POST&quot;<br>permissions = &quot;/permission/admin/manage/identity/usermgt/list&quot;<br>scopes = &quot;internal_user_mgt_list&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/dcr/register&quot;<br>secure = true<br>http_method = &quot;POST&quot;<br>permissions = &quot;/permission/admin/manage/identity/applicationmgt/create&quot;<br>scopes = &quot;internal_application_mgt_create&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/dcr/register(.*)&quot;<br>secure = true<br>http_method = &quot;GET&quot;<br>permissions = &quot;/permission/admin/manage/identity/applicationmgt/view&quot;<br>scopes = &quot;internal_application_mgt_view&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/dcr/register(.*)&quot;<br>secure = true<br>http_method = &quot;PUT&quot;<br>permissions = &quot;/permission/admin/manage/identity/applicationmgt/update&quot;<br>scopes = &quot;internal_application_mgt_update&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/dcr/register(.*)&quot;<br>secure = true<br>http_method = &quot;POST&quot;<br>permissions = &quot;/permission/admin/manage/identity/applicationmgt/update&quot;<br>scopes = &quot;internal_application_mgt_update&quot;<br><br>[[resource.access_control]]<br>context = &quot;(.*)/keymanager-operations/dcr/register(.*)&quot;<br>secure = true<br>http_method = &quot;DELETE&quot;<br>permissions = &quot;/permission/admin/manage/identity/applicationmgt/delete&quot;<br>scopes = &quot;internal_application_mgt_delete&quot;<br><br>[tenant_context.rewrite]<br>custom_webapps = [&quot;/keymanager-operations/&quot;]</pre><p>3. Download the <a href="https://apim.docs.wso2.com/en/4.1.0/assets/attachments/administer/wso2is-extensions-1.4.2.zip">WSO2 IS Connector</a>.</p><p>4. Extract the distribution and copy the following JAR files to the &lt;IS_HOME&gt;/repository/components/dropins directory.</p><ul><li>wso2is.key.manager.core-1.4.2</li><li>wso2is.notification.event.handlers-1.4.2</li></ul><p>5. Add keymanager-operations.war to the &lt;IS_HOME&gt;/repository/deployment/server/webapps directory.</p><p>6. Change the host of the wso2 IS server by changing the host parameter in the deployment.toml file located in &lt;IS_HOME&gt;/repository/conf</p><pre>[server]<br>hostname = &quot;wso2is&quot;</pre><p>7. Run the below command (Linux) to Open the host file. This is to map the hostname to localhost</p><pre>sudo vim /etc/hosts</pre><p>8. Add the below entry and save the file</p><p>127.0.0.1 wso2is</p><p>9. Now we need to create a new keystore with a new WSO2 IS hostname. Go to wso2is-5.11.0/repository/resources/security directory and backup the wso2carbon.jks file</p><p>10. Delete the wso2carbon.jks file and run the below command to generate a new keystore</p><pre>keytool -genkey -alias wso2carbon -keyalg RSA -keystore wso2carbon.jks -keysize 2048</pre><p>When it asks for first and last name, Please give wso2is (hostname we set for WSO2 IS)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/0*okFGFO6YvbMnKi1D" /></figure><p>11. Now let’s export the certificate from the newly created keystore and import it to the client-truststore.jks with the below command</p><p><strong>Export command:</strong></p><pre>keytool -export -alias wso2carbon -keystore wso2carbon.jks -file publickey_is.pem</pre><p><strong>Import command :</strong></p><pre>keytool -import -alias wso2 -file publickey_is.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>12. We also need to import the WSO2 APIM 4.1.0 certificate to the WSO2 IS client-truststore.jks</p><p>So let’s go to directory wso2apim-4.1.0/repository/resources/security and run the below command to export the WSO2 APIM certificate from wso2carbon.jks</p><pre>keytool -export -alias wso2carbon -keystore wso2carbon.jks -file publickey_APIM.pem</pre><p>Now let’s copy the publickey_APIM.pem and go to directory wso2is-5.11.0/repository/resources/security and paste the PEM file and run the below command to import the certificate to client-truststore of WSO2 IS</p><pre>keytool -import -alias wso2 -file publickey_APIM.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>13. Start WSO2 Identity Server with a port offset. portOffset is required only if you are running both API-m and ID in the same JVM.</p><pre>sh wso2server.sh -DportOffset=1</pre><p>14. Go to WSO2 IS carbon console <a href="https://wso2is:9444/carbon/">https://wso2is:9444/carbon/</a></p><p>15. Go to add service provider from the left side menu</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/0*VStJ6jjCUeq5tSQe" /></figure><p>16. Give a service provider name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VM33Co_QMpImzLt8" /></figure><p>17. Go to OAuth/OpenID Connect Configuration &gt;&gt; Configure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_ywq4Z8nfO7ILUuy" /></figure><p>18. Uncheck the code and implicit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ekjWPKvnzkq4hRAK" /></figure><p>19. Check the JWT for the Token issuer and click Add. Now you have created an application from the WSO2 IS side</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YvYNKjSwwSw_PrN3" /></figure><p>20. Go to Service Providers &gt;&gt; List and go to the created application “Myapp”.</p><p>21. Go to Inbound Authentication Configuration &gt;&gt; OAuth/OpenID Connect Configuration and you will see the Client key and the Client secret as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bLE6iqATRh7fiRR4" /></figure><p>This will be needed when we are requesting the access_token from WSO2 IS for “Myapp” application</p><p>22. Now let’s invoke the token endpoint of WSO2 IS and get the access token</p><pre>curl - location &#39;https://wso2is:9444/oauth2/token&#39; \<br> - header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br> - data-urlencode &#39;client_id=0fzNn23kQaUdjU2k0fPjc_BrSIQa&#39; \<br> - data-urlencode &#39;client_secret=ad8SL9e2ttay1LAZ8bTxTHf7sP0a&#39; \<br> - data-urlencode &#39;grant_type=password&#39; \<br> - data-urlencode &#39;username=admin&#39; \<br> - data-urlencode &#39;password=admin&#39;<br>You will get the out similar to below</pre><p>You will get the out similar to the below</p><pre>{<br>    &quot;access_token&quot;: &quot;eyJ4NXQiOiJPREprTmpVellqTmlZVEZoWkdSaE5UaGtNemc0WTJVd09XTTJOVE0xTkRObU9UWmxNV1ExTnciLCJraWQiOiJNVFl6TldWbE1qazRNbU00WlRNNU5USm1aakl3TURRM09UZGtOR0V5TURoalltUmlOVFV3WkRGbU1tSmtaRFkyWm1NNE1EbGpNMlk0WWpBM01ESXpOZ19SUzI1NiIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJhZG1pbiIsImF1dCI6IkFQUExJQ0FUSU9OX1VTRVIiLCJhdWQiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwibmJmIjoxNzAwMTIyMjQ4LCJhenAiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwic2NvcGUiOiJkZWZhdWx0IiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQ0XC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzAwMTI1ODQ4LCJpYXQiOjE3MDAxMjIyNDgsImp0aSI6IjI3OGQzZGRiLWEwYTMtNGQ2Zi04YzlmLTEyZWU1NDM4ZjhjZSJ9.c0fh2rhiNHIXWKcaYDxrYwxYXRDEUQ8-4Ppu904mXfGu7SISiDRazJnRbILsskl29lwfumyyfg1c1b4ekcnsNxFK9BIFMXZHU5FP8iuyEIbQny3ulKa8QuN65NhFQJ3mAZLjgnrgORsFU0Xawvuv_5G8r-qeYBf_iQ4ItfumehB9z4h3iwbunB3-_vKQhW4Qb4OW-xmrIzaBZPE2UgZIMylBYmZnBp-hl6hWh3LBw1hoWR4gHjBaSnxz4PLrZBTn-cdLhUt2_Bb_Tj3OYGolClf2Z7yFErktAFWIP0O2NzoBoNeHadxJMxk8ARFp-iwtWnDGtNiKGTzrC7BkZ6c8oA&quot;,<br>    &quot;refresh_token&quot;: &quot;ed49c0a0-0472-3e7e-a1a0-44a079ec0770&quot;,<br>    &quot;scope&quot;: &quot;default&quot;,<br>    &quot;token_type&quot;: &quot;Bearer&quot;,<br>    &quot;expires_in&quot;: 3600<br>}</pre><p>23. Now let’s decode the access_token and let’s get the kid value. We can use <a href="https://wso2-cs.github.io/cs-tools/">[1]</a> to decode the token. For this example, the kid will be “kid”: “MTYzNWVlMjk4MmM4ZTM5NTJmZjIwMDQ3OTdkNGEyMDhjYmRiNTUwZDFmMmJkZDY2ZmM4MDljM2Y4YjA3MDIzNg_RS256”,</p><h3>Step 2 — Configure WSO2 API Manager</h3><p>22. We need to import the WSO2 IS certificate to WSO2 APIM using kid as the alias. Go to wso2apim-4.1.0/repository/resources/security directory and run the below command. Please note the certificate should be WSO2 IS certificate (Please check step 11)</p><pre>keytool -import -alias wso2 -file publickey_IS.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>23 . Start WSO2 API Manager.<br>&lt;APIM_HOME&gt; refers to the root folder of the extracted WSO2 APIM.</p><p>24. Sign in to the Admin Portal: https://&lt;hostname&gt;:9443/admin</p><p>25. Click <strong>Key Managers</strong>.</p><p>26. Click <strong>Add Key Manager</strong> to add the configuration related to a new Key Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wO_uMAXBipBC8BHh" /></figure><p>27. Add the Key Manager configuration as below</p><pre>Well-known-url: https://wso2is:9444/oauth2/token/.well-known/openid-configuration<br><br>Issuer : https://localhost:9444/oauth2/token<br><br>Client Registration Endpoint : https://wso2is:9444/keymanager-operations/dcr/register<br><br>Introspection Endpoint:https://wso2is:9444/oauth2/introspect<br><br>Token Endpoint: https://wso2is:9444/oauth2/token<br><br>Display Token Endpoint: https://wso2is:9444/oauth2/token<br><br>Revoke Endpoint: https://wso2is:9444/oauth2/revoke<br><br>Display Revoke Endpoint: https://wso2is:9444/oauth2/revoke<br><br>Userinfo Endpoint: https://wso2is:9444/oauth2/userinfo?schema=openid<br><br><br>Authorize Endpoint: https://wso2is:9444/oauth2/authorize<br><br>Scope Management Endpoint: https://wso2is:9444/api/identity/oauth2/v1.0/scopes</pre><p>28. For the certificate upload/paste the WSO2 IS certificate</p><p>29. For Connector Configurations give the superuser username and password of WSO2 IS and add the key manager</p><p>30. Now We have configured the WSO2 IS as 3rd party key manager. Now let&#39;s create an application via Devportal. Login to the APIM dev portal and create an application.</p><p>31. After creating an application, Go to the application and go to subscription. Now subscribe to the API. (If you have not created an API. You need to create an API [2] )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O43SymF1BfX3irLt" /></figure><p>32. Now go to the Production Keys page. Select WSO2IS key manager. Click on Provide Existing OAuth keys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*facPu5KQTg9tQ7cE" /></figure><p>33. Give the client ID and client secret that you got during the application creation in WSO2 IS in step 21</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0--N9F9yB86gOhbU" /></figure><p>34. Now you can generate an access token from WSO2 IS with the below CURL command</p><pre>curl --location &#39;https://wso2is:9444/oauth2/token&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--data-urlencode &#39;client_id=uLJ6LxKuW_KokDx_niKdFIePJ38a&#39; \<br>--data-urlencode &#39;client_secret=6nUH1iq7ivb0vllkNZmbvfToTzwa&#39; \<br>--data-urlencode &#39;grant_type=password&#39; \<br>--data-urlencode &#39;username=admin&#39; \<br>--data-urlencode &#39;password=admin&#39;</pre><p>You will get a response below</p><pre>{<br>    &quot;access_token&quot;: &quot;eyJ4NXQiOiJPREprTmpVellqTmlZVEZoWkdSaE5UaGtNemc0WTJVd09XTTJOVE0xTkRObU9UWmxNV1ExTnciLCJraWQiOiJNVFl6TldWbE1qazRNbU00WlRNNU5USm1aakl3TURRM09UZGtOR0V5TURoalltUmlOVFV3WkRGbU1tSmtaRFkyWm1NNE1EbGpNMlk0WWpBM01ESXpOZ19SUzI1NiIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJhZG1pbiIsImF1dCI6IkFQUExJQ0FUSU9OX1VTRVIiLCJhdWQiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwibmJmIjoxNzAwMTk5OTgzLCJhenAiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwic2NvcGUiOiJhZG1pbnNjb3BlIiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQ0XC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzAwMjAzNTgzLCJpYXQiOjE3MDAxOTk5ODMsImp0aSI6IjA2ZTg1Nzk1LTI3NTQtNDkwOS05ZDRkLTBmZjNiYTY2NTlhYSJ9.HSdfgjD0zA8aVB-5VP_U-goD4c--attGctY5CVF54VAEt2bukPAYOjqZRDoarE0-HCTD-nusFkqvFItigT3sdHUs8uxi6F61tJI78tfSb7joybUavFmlITTUAU4E3vuYwPEBePyG34iKRYHTWftWD07D5FLU6Q6dPvG1xUTT9OovORhjwobKIrKp1WkbGuH0laf2AQQaDLeyPJWAJhB99dSYC9Y-YsAm-NdEDc95iKXRQfcMkSC4II3RnQ3ns21bq0gWXVPo1hLL1mmrCCKnc6zry308N96SOcR2IgL0_P8fiTSdgB3AxSb6bo-Kf377BLRk78CorqvBXKuIAslYZQ&quot;,<br>    &quot;refresh_token&quot;: &quot;946112ef-df2a-3923-9e0f-bd0597151283&quot;,<br>    &quot;scope&quot;: &quot;adminscope&quot;,<br>    &quot;token_type&quot;: &quot;Bearer&quot;,<br>    &quot;expires_in&quot;: 3600<br>}</pre><p>35. Now copy the access token from the above response and invoke the subscribed API with the below command</p><pre>curl --location &#39;https://localhost:8243/pizzashack/1.0.0/menu&#39; \<br>--header &#39;Accept: application/json&#39; \<br>--header &#39;Authorization: Bearer eyJ4NXQiOiJPREprTmpVellqTmlZVEZoWkdSaE5UaGtNemc0WTJVd09XTTJOVE0xTkRObU9UWmxNV1ExTnciLCJraWQiOiJNVFl6TldWbE1qazRNbU00WlRNNU5USm1aakl3TURRM09UZGtOR0V5TURoalltUmlOVFV3WkRGbU1tSmtaRFkyWm1NNE1EbGpNMlk0WWpBM01ESXpOZ19SUzI1NiIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJhZG1pbiIsImF1dCI6IkFQUExJQ0FUSU9OX1VTRVIiLCJhdWQiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwibmJmIjoxNzAwMTk5OTgzLCJhenAiOiJ1TEo2THhLdVdfS29rRHhfbmlLZEZJZVBKMzhhIiwic2NvcGUiOiJhZG1pbnNjb3BlIiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQ0XC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzAwMjAzNTgzLCJpYXQiOjE3MDAxOTk5ODMsImp0aSI6IjA2ZTg1Nzk1LTI3NTQtNDkwOS05ZDRkLTBmZjNiYTY2NTlhYSJ9.HSdfgjD0zA8aVB-5VP_U-goD4c--attGctY5CVF54VAEt2bukPAYOjqZRDoarE0-HCTD-nusFkqvFItigT3sdHUs8uxi6F61tJI78tfSb7joybUavFmlITTUAU4E3vuYwPEBePyG34iKRYHTWftWD07D5FLU6Q6dPvG1xUTT9OovORhjwobKIrKp1WkbGuH0laf2AQQaDLeyPJWAJhB99dSYC9Y-YsAm-NdEDc95iKXRQfcMkSC4II3RnQ3ns21bq0gWXVPo1hLL1mmrCCKnc6zry308N96SOcR2IgL0_P8fiTSdgB3AxSb6bo-Kf377BLRk78CorqvBXKuIAslYZQ&#39;</pre><p>You will able to see the API get invoked with the above CURL and will see the API response.</p><p>Hope this will help you during your day-to-day integrations.</p><p>Happy Coding :)</p><p>[1].<a href="https://jwt.io/">https://jwt.io/</a></p><p>[2].https://apim.docs.wso2.com/en/4.1.0/design/create-api/create-rest-api/create-a-rest-api/</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cea6785a47e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/configuring-wso2-is-5-11-as-3rd-party-key-manager-in-wso2-apim-4-2-0-2cea6785a47e">Configuring WSO2 IS 5.11 as 3rd party key-manager in WSO2 APIM 4.2.0</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Access Sequence using a Java Class mediator in WSO2 MI/EI]]></title>
            <link>https://medium.com/codeblog/access-sequence-using-a-java-class-mediator-in-wso2-mi-ei-cf3e4db66930?source=rss-191f97f5a9de------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf3e4db66930</guid>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[class]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[mircoservices]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Isuru Liyanage]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 08:59:44 GMT</pubDate>
            <atom:updated>2024-02-19T09:26:07.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*TOGmGG9tcu1wpnjGFInAbg.png" /></figure><p>In the article, I&#39;m going to show you how to invoke a sequence that is deployed in the WSO2 MI server via a custom class mediator.</p><p>We are going to use org.apache.synapse.Mediator to invoke the sequence that is deployed in the MI server.</p><p>First, we are going to create a mediator project via WSO2 Integration Studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*qnWRmtD4J4i5oITUC4hoNw.png" /></figure><p>After that, we are going to import the org.apache.synapse.Mediator to the java class so we can create an object of org.apache.synapse.Mediator to get and invoke the sequence from the custom Java class.</p><pre> Mediator sequenceMediator = context.getSequence(&quot;WorkflowCallbackService&quot;);</pre><p>In the above code, we have created an object named “sequenceMediator” and from the context we are getting the sequence named “WorkflowCallbackService” which is deployed in the MI server.</p><p>After that, we are going to invoke this sequence using the mediate method as below.</p><pre>    sequenceMediator.mediate(context);</pre><p>From this method, the custom Java class will invoke the sequenceMediator which is deployed in the MI server.</p><p>Below is the full code snippet for this example :</p><pre>package LdapProject;<br><br>import org.apache.synapse.MessageContext;<br><br><br>import org.apache.synapse.Mediator;<br>import org.apache.synapse.mediators.AbstractMediator;<br><br><br>public class Ldap extends AbstractMediator { <br><br> public boolean mediate(MessageContext context) { <br>  System.out.println(&quot;Mediation Start&quot;);<br>   <br> <br>  try {<br>  // get the sequence from message context <br>  Mediator sequenceMediator = context.getSequence(&quot;WorkflowCallbackService&quot;);<br>  if (sequenceMediator != null) {<br>   // Mediate the sequence<br>    sequenceMediator.mediate(context);<br>    } else {<br>   log.error(&quot;Sequence not found&quot;);<br>    // You can handle this case as needed<br>    }<br>  } catch (Exception e) {<br>   log.error(&quot;Error while invoking sequence: &quot; + e);<br>    // You can handle the exception as needed<br>  }<br><br>  return true;<br> }<br>}</pre><p><strong>Note :</strong></p><ul><li>If there are Call mediators used inside the sequence, this approach is not recommended</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf3e4db66930" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codeblog/access-sequence-using-a-java-class-mediator-in-wso2-mi-ei-cf3e4db66930">Access Sequence using a Java Class mediator in WSO2 MI/EI</a> was originally published in <a href="https://medium.com/codeblog">CodeBlog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>