<?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 Kaveesha Baddage on Medium]]></title>
        <description><![CDATA[Stories by Kaveesha Baddage on Medium]]></description>
        <link>https://medium.com/@kaveeshabaddage?source=rss-bfd41eacb8cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Xts82MeC7O6b_occdIVn2Q.jpeg</url>
            <title>Stories by Kaveesha Baddage on Medium</title>
            <link>https://medium.com/@kaveeshabaddage?source=rss-bfd41eacb8cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:23:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kaveeshabaddage/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[The Hidden Cost of Broken Integrations: An Introduction to Contract Testing]]></title>
            <link>https://kaveeshabaddage.medium.com/the-hidden-cost-of-broken-integrations-an-introduction-to-contract-testing-e9f7dacc3ddd?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9f7dacc3ddd</guid>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[types-of-contract-testing]]></category>
            <category><![CDATA[contract-broker]]></category>
            <category><![CDATA[contract-testing]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 12:58:39 GMT</pubDate>
            <atom:updated>2026-08-19T12:58:39.584Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why do integrations fail?</h4><p>Modern applications are often built using microservices, where different teams own and maintain services for specific business domains. While this enables independent development and deployment, it also creates challenges when services need to communicate with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*phq-GIRZ1JXWdmD4c-r6_Q.png" /></figure><p>Consider a scenario where one team updates its API request format and deploys the change to production. Although the service functions correctly from the provider’s perspective, requests from other microservices begin to fail because they are still using the previous request format. The consuming teams were unaware of the change and therefore did not update their implementations.</p><p>The issue is not necessarily a software defect, but a mismatch between the expectations of the service provider and its consumers. As systems grow and teams operate independently, such integration failures become increasingly common. Changes such as renamed fields, modified data types, new mandatory attributes, or altered response structures can easily break dependent services.</p><p>Traditional unit and integration tests often validate services in isolation and may not detect these incompatibilities until services interact in a shared environment — or even in production. This challenge is one of the primary reasons organisations adopt contract testing to verify compatibility between service consumers and providers before deployment.</p><h3>What is contract Testing?</h3><p><strong>Contract Testing</strong> is a testing methodology used to ensure <strong>reliable communication between services, components, or systems</strong> by verifying that their interactions conform to a predefined <strong>contract</strong>.</p><p>A <strong>contract</strong> is a formal specification that defines the expected behaviour and communication rules between two or more parties. It describes:</p><ul><li><strong>Inputs</strong> — the requests, messages, or data a service receives.</li><li><strong>Outputs</strong> — the responses, messages, or data a service returns.</li><li><strong>Interactions</strong> — the communication patterns and rules that both parties must follow.</li></ul><p>Rather than testing the actual integration between services, contract testing validates that:</p><ol><li>The <strong>provider</strong> service can produce responses and messages in the format expected by the consumer.</li><li>The <strong>consumer</strong> service can correctly consume and process the provider’s responses and messages.</li><li>Both parties adhere to the agreed contract, ensuring compatibility even when services are developed, tested, and deployed independently.</li></ol><blockquote>In summary, <strong>contract testing verifies that a consumer and provider share the same understanding of how they communicate, reducing integration issues and enabling independent development of distributed systems.</strong></blockquote><h3>Types of Contract Testing</h3><h4>1. Consumer-Driven Contract Testing (CDCT)</h4><p>In Consumer-Driven Contract Testing, the <strong>consumer defines its expectations</strong> of the provider. The consumer generates a contract based on the requests it sends and the responses it expects.</p><p><strong>Workflow:</strong></p><ol><li>Consumer creates contract expectations.</li><li>Consumer tests generate a contract artifact.</li><li>The contract is shared with the provider.</li><li>Provider verifies that it can satisfy the contract.</li></ol><p><strong>Artifacts Generated:</strong></p><ul><li>Consumer Contract (contract file)</li><li>Provider Verification Report</li></ul><p><strong>Advantages</strong></p><ul><li>Consumer requirements are explicitly captured and validated.</li><li>Reduces integration failures by ensuring the provider supports real consumer use cases.</li><li>Helps prevent providers from building unnecessary APIs or response fields that no consumer uses.</li><li>Enables independent development and testing of consumers and providers.</li></ul><p><strong>Disadvantages</strong></p><ul><li>The provider must remain compatible with the contracts agreed upon with consumers.</li><li>Managing many consumer contracts can become complex as the number of consumers grows.</li></ul><h4>2. Provider-Driven Contract Testing</h4><p>In Provider-Driven Contract Testing, the <strong>provider defines the contract</strong> and publishes it for consumers to follow.</p><p>The provider acts as the source of truth, and consumers validate their integrations against the published contract.</p><p><strong>Workflow:</strong></p><ol><li>Provider publishes API specification.</li><li>Consumers validate their requests and responses against the specification.</li><li>Changes to the contract are managed by the provider.</li></ol><p><strong>Artifacts Generated:</strong></p><ul><li>OpenAPI Specification for REST APIs (openapi.yaml)</li><li>AsyncAPI Specification for Event-driven APIs(asyncapi.yaml)</li><li>Provider Validation Report</li></ul><p><strong>Advantages</strong></p><ul><li>Single source of truth managed by the provider.</li><li>Scales well for multiple consumers.</li><li>Supports API-first development and documentation.</li><li>Lower maintenance overhead than managing many consumer contracts.</li></ul><p><strong>Disadvantages</strong></p><ul><li>Consumer requirements may not be fully represented.</li><li>Breaking changes can still impact consumers.</li><li>Contract accuracy depends on keeping the specification synchronised with the implementation.</li></ul><h4>3. Bidirectional Contract Testing</h4><p>Bidirectional Contract Testing combines both approaches.</p><p><strong>Workflow:</strong></p><ul><li>Provider publishes an API specification.</li><li>Consumers publish their expectations.</li><li>A contract broker verifies compatibility between both artifacts without requiring full end-to-end integration tests.</li></ul><p><strong>Artifacts Generated:</strong></p><ul><li>Provider API Specification</li><li>Consumer Pact Contracts</li><li>Compatibility Verification Results</li></ul><p><strong>Advantages</strong></p><ul><li>Scales well for multiple consumers.</li><li>Faster verification and CI/CD feedback.</li><li>Allows consumers and providers to evolve independently.</li></ul><p><strong>Disadvantages</strong></p><ul><li>Relies heavily on accurate provider specifications.</li><li>May miss runtime implementation issues.</li><li>Provides less confidence than full consumer-driven verification.</li></ul><h3>Contract testing vs schema validation</h3><p><strong>Contract testing</strong> and <strong>schema validation</strong> are related, but they verify different things. The following table compares how they differ from eachother.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tT5wywvcaLSPKbiJESm7Vg.png" /></figure><p><em>Note: The table may appear slightly blurry because it has been embedded as an image. Medium’s editor does not currently support creating tables directly.</em></p><h3>Contract Broker in Contract Testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*op22G4JdMZ91zQkOO8WqGg.png" /><figcaption>Contract Broker Workflow</figcaption></figure><p>A contract broker is a centralised repository used in contract testing to store, manage, and share contracts between service consumers and providers. It acts as an intermediary that enables teams to collaborate without requiring direct coordination for every API change.</p><p>In a typical contract testing workflow,</p><ol><li>the consumer application generates a contract that describes its expectations of the provider service.</li><li>This contract is then published to the contract broker.</li><li>The provider application retrieves the contract from the broker.</li><li>It verifies that its implementation satisfies the agreed-upon expectations.</li><li>The verification results are subsequently published back to the broker.</li></ol><p>A contract broker provides several benefits, including centralised contract management, version tracking, visibility into service compatibility, and support for automated CI/CD pipelines. It also helps teams determine whether specific versions of consumer and provider applications can be safely deployed together, reducing the risk of integration failures.</p><p>Popular contract broker solutions include Pact Broker and PactFlow, which are widely used in microservice architectures to facilitate consumer-driven contract testing. They also support provider-driven, specification-based, and event-driven contract testing by enabling contract management, versioning, and compatibility tracking.</p><blockquote><strong>Contract testing</strong> helps ensure that interacting services remain compatible as they evolve independently. By validating the agreements between consumers and providers, it detects integration issues early, reduces the need for complex end-to-end testing, and supports faster, safer deployments.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9f7dacc3ddd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding The Bridge Between LLMs and Real-World Tools: Model Context Protocol (MCP)]]></title>
            <link>https://kaveeshabaddage.medium.com/understanding-the-bridge-between-llms-and-real-world-tools-model-context-protocol-mcp-1ada6083065a?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ada6083065a</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 13:55:04 GMT</pubDate>
            <atom:updated>2025-09-29T13:55:04.709Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>These days, Large Language Models (LLMs) are showing up almost everywhere. It may answer questions as chatbots, help developers with code suggestions or act as research assistants. Without access to real-time data or external tools, an LLM might give answers that sound correct but are actually false, misleading, or completely made up (hallucinations).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uuv-gmu9r-evGv-CGhUA_g.png" /></figure><p>So LLM needs to communicate with external services, and there should be a standardised way to avoid issues. <strong>Model Context Protocol (MCP)</strong> solves this by providing standards for LLMs to access contextual information, resources and tools, making room for safe and consistent communication.</p><h3><strong>Why Do We Need a Standard to Communicate?</strong></h3><p>If we don’t have a standard way to communicate, everyone might “speak their own language” leading to confusion and errors. In the digital world, <strong>protocols</strong> provide structure and order to communication between different systems or devices, helping to avoid these issues. So protocols ensure that every system follows the same rules when exchanging information and different system can work together as long as they follow the same protocol.</p><h3><strong>What is Model Context Protocol (MCP)?</strong></h3><p>Model Context Protocol is an <strong>open standard </strong>which<strong> </strong>defines a <strong>common language to</strong> exchange data reliably and securely between LLMs and external services. This external service can be</p><ul><li><strong>Resources</strong>: Structured data sources (e.g., databases, documents, APIs).</li><li><strong>Prompts</strong>: a question, a command, or a context that guides the AI on what you want.</li><li><strong>Tools (Actions)</strong>: Operations that the LLM can trigger.</li></ul><p>MCP is built on <strong>JSON-RPC</strong>, which is a stateless, light-weight remote procedure call (RPC) protocol. The communication between the LLM client and server can be done in two ways.</p><ol><li><strong>STDIO — </strong>When<strong> the </strong>LLM client and server are running locally</li><li><strong>WebSockets</strong> — When<strong> the </strong>LLM client and server are running remotely</li></ol><p>MCP client does <strong>not create a fresh connection for each request</strong>. It maintains a persistent connection (via STDIO or WebSocket) for the session, and all requests flow through that until the session ends. So MCP can be <em>stateless</em> at the protocol level, even though it often uses a <em>stateful transport connection</em> for efficiency.</p><h3>MCP Architecture</h3><p>The key participants in the MCP architecture are:</p><ul><li><strong>MCP Host</strong>: The AI application that coordinates and manages one or multiple MCP clients. (<strong>e.g.</strong>, Visual Studio Code with LLM)</li><li><strong>MCP Server</strong>: A program that provides context to MCP clients (<strong>e.g.</strong>, GitHub MCP Server )</li><li><strong>MCP Client</strong>: A component that maintains a connection between MCP server and the MCP host</li></ul><p>This separation means <strong>any LLM can talk to any MCP server</strong> as long as it understands the protocol. A single MCP host can manage multiple simultaneous connections to different MCP servers (via one client connection per server).</p><p><strong>Example Walkthrough</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ApvQ2nZrVvRjM_qGTf_kYQ.jpeg" /></figure><p><strong>MCP Host (Visual Studio Code with LLM)</strong></p><ul><li>Developer chatting with an AI assistant inside VS Code</li><li>The AI is powered by the MCP host, which knows how to talk MCP.</li></ul><p><strong>MCP Client (inside Visual Studio Code)</strong></p><ul><li>The host includes an MCP client that speaks JSON-RPC.</li><li>When the developer ask: <em>“Summarise open pull requests in my repo”</em>, the client prepares an MCP request.</li></ul><p><strong>MCP Server (GitHub MCP Server)</strong></p><ul><li>Runs locally or remotely, exposing GitHub as an MCP resource.</li><li>It receives the client’s request (resources/list, prompts/list, tools/execute), queries GitHub’s API, and sends back structured data.</li><li>LLM turns it into a human-readable answer:<br> <em>“There are 2 open PRs: #63 (bug fix), #62 (feature request)”</em></li></ul><h3><strong>Conclusion</strong></h3><p>Model Context Protocol (MCP) is a game-changer for making LLMs useful beyond text generation. If the last decade was about <strong>APIs for integrations</strong>, the next one may be about <strong>protocols for AI — </strong>and right now, MCP is leading the way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ada6083065a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate Event-Driven Ansible with Webhook?]]></title>
            <link>https://kaveeshabaddage.medium.com/how-to-integrate-event-driven-ansible-with-webhook-3b3c108ed172?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b3c108ed172</guid>
            <category><![CDATA[redhat-ansible]]></category>
            <category><![CDATA[webhook-integration]]></category>
            <category><![CDATA[ansible-rulebook]]></category>
            <category><![CDATA[event-driven-ansible]]></category>
            <category><![CDATA[ansible-playbook]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Sat, 04 May 2024 06:58:49 GMT</pubDate>
            <atom:updated>2024-05-04T06:58:49.705Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This article demonstrates how to integrate Event-Driven Ansible with Webhook along with the configuration and trigger an action based on a specific event. You can learn about what is Event-Driven Ansible from <a href="https://medium.com/devops-dev/event-driven-ansible-101-612e5565a391">here</a> .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*a5esTwoX-CehD9OuanJ_hw.png" /></figure><p>First of all, you need to have ansible-rulebook CLI on your machine to try this integration. Otherwise, you can do the installation according to the guidelines <a href="https://ansible.readthedocs.io/projects/rulebook/en/latest/installation.html">here</a>. To run ansible-rulebook, you need to have the following files to provide the required configuration.</p><ul><li>inventory.yml</li><li>var.yml</li><li>playbook.yml</li><li>rulebook.yml</li></ul><p>Here’s a breakdown of each file and why they are necessary.</p><h4>Inventory</h4><p>Ansible uses inventory file to define the hosts and groups of hosts where automation tasks will be executed. Although Ansible users can pass host names at the command line, they create inventory files to easily organize hosts and groups. Moreover, we can run automation tasks on multiple hosts simultaneously.</p><p>Following is the content of the inventory.yml file that will be executed.</p><pre>[testHost]<br>127.0.0.1</pre><p>This inventory file is used to define the localhost(127.0.0.1) under the testHost server group since this demonstration will be executed on the local machine environment.</p><p>You can check whether the inventory.yml file can executes without any issues using the following command.</p><p><em>ansible-inventory -i &lt;inventoryfileLocation&gt; — list</em></p><p>This command is used to display the current inventory in JSON format and it helps to understand how Ansible has interpreted the inventory file(s) and what hosts and groups are available to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/0*8q3mBgoV1v3FE33P" /></figure><h4>Var</h4><p>Ansible uses var file to define variables. This file is used to save variables separately from the playbook files since it makes it easier to manage and reuse variable values across multiple playbooks. YAML is the most common format of the var files due to its readability and flexibility. Further, it can be written in JSON, or INI format.</p><p>Following is the content of the var.yml file that will be executed.</p><pre>eventSource: webHook</pre><p>This var file is used to define a variable called “eventSource” assigning “webHook” as its value. This has been added to this execution to show how we can add an external var file for the execution.</p><h4>Playbook</h4><p>Ansible Playbook is used to define a set of tasks to be executed on a defined group of hosts. That task may be to perform specific actions, such as restarting services, installing packages, copying files or running arbitrary commands.</p><p>Following is the content of the playbook.yml file that will be executed.</p><pre>---<br>- name: Playbook to print debug message<br>  hosts: testHost<br>  connection: local<br>  tasks:<br>    - name: Print a simple statement<br>      debug:<br>        msg: &quot;Ansible event driven action is taken based on the event source :{{ eventSource }}&quot;</pre><p>This playbook is used to define a task that will print a debug message using a value passed through a variable named “eventSource”.</p><p>By default, Ansible tries to connect through SSH to the defined host in the playbook configuration. Since the localhost is grouped under the testHost server group, you should set the connection to local. Then the playbook will be executed on the control node itself, rather than on remote managed hosts.</p><p>You can check whether this playbook.yml file can execute without any issues using the following command with the required arguments using a separate file.</p><p><em>ansible-playbook &lt;playbookfileLocation&gt; — vars vars.yml</em></p><h4>Rulebook</h4><p>Ansible Rulebook is used to define the event source and explains which action/s needs to take place when a specific event/s occurs. EDA support different event sources such as Kafka, watchdog, webhook using a plugin system.</p><p>Following is the content of the rulebook.yml file that will be executed.</p><pre>---<br>- name: Rulebook to print debug message based on webhook event<br>  hosts: testHost<br>  gather_facts: false<br><br>  sources:<br>      - ansible.eda.webhook:<br>          host: 127.0.0.1<br>          port: 6000<br><br>  rules:<br>      - name: Launch playbook on start command<br>        condition: event.payload.command == &#39;start&#39;<br>        action:<br>           run_playbook:<br>               name: playbook.yml<br>               extra_vars:<br>                   eventSource: &quot;{{ eventSource }}&quot;  </pre><p>This rulebook file is used to define an action to be executed on a specific webhook event. When the Event-Driven Ansible starts, it looks for the requests payloads coming to the webhook running on localhost opening 6000 port. When a request comes with a payload like {“cmd”:”start”} it will start to execute actions defined in the playbook.yml by providing the value to the parameters by referring vars.yml file.</p><h3>Execution of the Event-Driven Ansible</h3><p>First, you need to have all those yml files in the same location to start the Event-Driven Ansible using the following command.</p><p><em>ansible-rulebook — inventory inventory.yml — rulebook rulebook.yml — vars vars.yml</em></p><p>Here,</p><p><strong>— inventory inventory.yml</strong> specifies the inventory file in the same execution location.</p><p><strong>— vars vars.yml</strong> specifies the var file in the same execution location.</p><p><strong>— rulebook rulebook.yml </strong>specifies the rulebook file in the same execution location.</p><p>When executing the Ansible command, you can use -v or — verbose option to increase the verbosity level of the output. It will provide more detailed information about the tasks being executed.</p><p><strong>-v</strong>: Display more verbose output, including task names and results.</p><p><strong>-vv</strong>: Display even more verbose output, including extra information about the execution process.</p><p><strong>-vvv</strong> (or -vvvv): Display extremely verbose output, including detailed debugging information.</p><p>This command execution will start the Event-Driven Ansible exposing webhook and give terminal output as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bz0SRdMCy0RTuXSW" /></figure><p>After that, you can execute the following command to send a POST request to the webhook.</p><pre>curl --location --request POST &#39;http://localhost:6000&#39; \<br>--header &#39;Content-type: application/json&#39; \<br>--data-raw &#39;{&quot;command&quot;:&quot;start&quot;}&#39;</pre><p>It will meet the required condition to trigger the action defined in the rulebook and start the execution of the playbook. As a result of that, the debug message will be printed in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3EDwN9OyZOEyYwOI" /></figure><p>So this is how we can integrate Event-Driven Ansible with Webhook and trigger an action based on a specific POST request.</p><p>Stay tuned for more articles!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b3c108ed172" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Driven Ansible 101]]></title>
            <link>https://blog.devops.dev/event-driven-ansible-101-612e5565a391?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/612e5565a391</guid>
            <category><![CDATA[redhat-ansible]]></category>
            <category><![CDATA[it-automation]]></category>
            <category><![CDATA[ansible-rulebook]]></category>
            <category><![CDATA[event-driven-ansible]]></category>
            <category><![CDATA[ansible]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Fri, 08 Mar 2024 04:38:00 GMT</pubDate>
            <atom:updated>2024-05-04T06:59:52.231Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is Ansible?</h4><p>Ansible is an open-source IT automation tool written in Python. It allows the automation of various tasks such as application deployment, configuration management, cloud provisioning, and orchestration of complex workflows. Ansible began as a project in February 2012 and later it was acquired by <a href="https://en.wikipedia.org/wiki/Red_Hat">Red Hat</a> in 2015.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*hwiW9AGq1sZY_4YC" /></figure><p>One of its main features is its agentless architecture. So it doesn’t require any agents to be installed on the target systems, making it lightweight and easy to set up and use. Ansible uses SSH for communication with target systems. Also, it uses the YAML as its configuration language, which makes it highly readable and accessible.</p><h4>What is Ansible Automation Platform?</h4><p>The Ansible Automation Platform (AAP) is an end-to-end automation platform that enables enterprises to scale automation across their organizations. AAP has evolved beyond its origins as a command-line Ansible package with support, and the platform now encompasses more than just a graphical user interface for Ansible.</p><p>The following high-level diagram details various components available in Ansible Automation Platform version 2.1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*khFe9cKjtuAryIbr" /><figcaption>Component Diagram of Ansible Automation Platform version 2.1</figcaption></figure><p>The latest version of the Ansible Automation Platform is 2.4 and the following are some of the new features that come with it.</p><ul><li><strong>Event-Driven Ansible</strong> to recognises the specified event and takes appropriate action automatically.</li><li><strong>Collection repository management</strong> to facilitate more control over the accessibility of automation content.</li><li><strong>Validated content integration</strong> to address the most common automation use cases.</li><li><strong>Ansible Builder 3.0 </strong>to make the execution environment (EE) creation process much more efficient.</li><li><strong>Updated user interface </strong>to<strong> </strong>unify the user experience across the various platform components.</li></ul><h4>What is Event Driven Ansible?</h4><p>Event-Driven Ansible(EDA) is a new approach to enhance and expand automation based on events. It can listen to various event sources such as webhook, watchdog and many more. When the specific event is received from the event source, it is detected by the EDA controller. As the next step, it automatically executes the pre-defined actions to handle that event. Moreover, you can automate a combination of processes, including issue remediation, user administration tasks, and operational logic with the help of the automation controller.</p><h4>How does Event-Driven Ansible work?</h4><p>Event-Driven Ansible contains a decision framework that was built using Drools. Drools is an open-source Business Rules Management System (BRMS) solution which matches incoming data, or facts, to the conditions of rules and determines whether and how to execute the rules. Drools is written in Java.</p><p>In Event-Driven Ansible, there should be a way to define the following things.</p><ul><li>What are the event sources that EDA needs to listen?</li><li>What are the conditions that need to match with the event status?</li><li>What are the targeted actions needed to execute on successful conditions meet?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ViZ-raNh2_J6KS9J" /></figure><blockquote><strong>Ansible Rulebook</strong> is the solution to address those points and it defines the event source and explains which action/s needs to take place when a specific event/s occurs.</blockquote><p>Ansible Rulebook is designed with flexibility. It can:</p><ul><li>monitor one event source/ multiple event sources.</li><li>include one rule/ multiple rules.</li><li>trigger one action/ multiple actions.</li></ul><p>Let’s take a look at event sources, rules and actions.</p><p><a href="https://ansible.readthedocs.io/projects/rulebook/en/latest/sources.html">Event Sources</a></p><p>EDA support different event sources using a plugin system. <a href="https://github.com/ansible/event-driven-ansible">Ansible.eda</a> collection includes their initial set of event source plugins to connect EDA with Kafka, watchdog, webhook etc. Moreover, You can build a custom event source plugin in Python and use it.</p><p><a href="https://ansible.readthedocs.io/projects/rulebook/en/latest/rules.html">Rules</a></p><p>A rulebook can contain one or multiple rules. It also supports integers, strings, booleans (like and, or, and not), floats, and null condition data types. As well as it supports all traditional mathematical operators like =, ≠, &gt;, and &lt;.</p><p><a href="https://ansible.readthedocs.io/projects/rulebook/en/latest/actions.html">Actions</a></p><p>When a rule matches the event condition(s), it fires the corresponding action for the rule. There are different types of actions such as run_playbook, run_module, run_job_template, run_workflow_template, and set_fact which can be used based on the requirement.</p><blockquote><strong>Note</strong>: Ansible also uses Ansible Playbook to define the automation tasks. The difference between Ansible Playbook &amp; Ansible Rulebook is once the Playbook has been completed it will exit, but the Rulebook will continue to run waiting for events and matching those events with actions. Ansible Rulebook only exits if there is an issue with the event source itself or upon a shutdown action.</blockquote><p>This <a href="https://kaveeshabaddage.medium.com/how-to-integrate-event-driven-ansible-with-webhook-3b3c108ed172">article</a> demonstrates how to integrate Event-Driven Ansible with Webhook and trigger an action based on a specific event.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=612e5565a391" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/event-driven-ansible-101-612e5565a391">Event Driven Ansible 101</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to send emails based on log messages in Spring Boot?]]></title>
            <link>https://kaveeshabaddage.medium.com/how-to-send-emails-based-on-log-messages-in-spring-boot-34ffc09d04f5?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/34ffc09d04f5</guid>
            <category><![CDATA[monitoring-system]]></category>
            <category><![CDATA[email-notifications]]></category>
            <category><![CDATA[spring-boot-profiles]]></category>
            <category><![CDATA[logback-logging]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 03:14:12 GMT</pubDate>
            <atom:updated>2023-09-14T03:14:12.311Z</atom:updated>
            <content:encoded><![CDATA[<p>Spring Boot is a powerful and popular framework for building Java-based applications, particularly web and microservices applications. It aims to simplify the development process by providing a set of conventions and reducing the configuration and boilerplate code required for setting up an application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*MCn1MQEx2iJrZQ39lebTgg.jpeg" /></figure><p>Logging is a prominent and essential aspect of application development for several important reasons such as debugging, troubleshooting, monitoring and performance analysis. When considering monitoring an application execution, we can do that more easily by sending emails based on the application log. Instead of checking application log files manually, we can just check the email to find out the application execution status.</p><p>Spring Boot provides a convenient way to externalize and manage logging configurations separately from the application.yml or application.properties configuration files. Simply you can place a file with one of the following predefined names on the classpath, and Spring Boot will automatically load it to configure the logging settings.</p><ul><li>logback-spring.xml</li><li>logback.xml</li><li>log4j2-spring.xml</li><li>logback-spring.groovy</li><li>logback.groovy</li></ul><h3>What is an appender in logback?</h3><p>An appender is a logback component which is responsible for directing log messages to specific targets such as consoles, files, databases, or remote servers. So there are various types of appenders available in Logback to fulfil the directing log messages to different targets. Some of them are</p><ol><li><strong>ConsoleAppender</strong>: Outputs log messages to the console.</li><li><strong>FileAppender</strong>: Writes log messages to a file.</li><li><strong>RollingFileAppender</strong>: Writes log messages to a file with automatic log rotation based on size or time.</li><li><strong>SMTPAppender</strong>: Sends log messages via email.</li><li><strong>SocketAppender</strong>: Sends log messages to a remote server via TCP or UDP.</li></ol><h3>What is SMTPAppender in logback?</h3><p>As brief in the appender types, SMTPAppender is used to send log messages via email. When a user-specified event occurs, It collects logging events in one or more fixed-size buffers and sends the contents of the appropriate buffer in an email.</p><p>When configuring SMTPAppender, there are several properties to define. Mainly we have to use the following properties.</p><ul><li><strong>smtpHost</strong>: Hostname of the SMTP server</li><li><strong>smtpPort</strong>: The port where the SMTP server is listening. Defaults is 25.</li><li><strong>to</strong>: The email address of the recipient</li><li><strong>from</strong>: The originator of the email messages sent by SMTPAppender</li><li><strong>subject</strong>: The subject of the email.</li><li><strong>username</strong>: username for SMTP authentication</li><li><strong>password</strong>: password for SMTP authentication</li></ul><p>You can find more details about the mentioned properties and all other properties from <a href="https://logback.qos.ch/manual/appenders.html#SMTPAppender">here</a>.</p><p>After configuring this SMTPAppender, your logback.xml file will take the following format.</p><figure><img alt="logback.xml file format with SMTPAppender" src="https://cdn-images-1.medium.com/max/734/1*PaZG4d0chaO4q0wLR8nCLQ.png" /></figure><p>Please note that you have to add relevant dependencies to your project to send email using SMTPAppender. So please add the following dependency to your pom.xml file.</p><pre>&lt;dependency&gt;<br>     &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>     &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h3>Sending emails based on certain log messages</h3><p>Previously SMTPAppender has used <strong>&lt;layout&gt;</strong> and <strong>&lt;pattern&gt;</strong> elements to define the log message format pattern using placeholders and conversion words.</p><p>Moreover, you can use the <strong>&lt;evaluator&gt;</strong> element in your logback.xml configuration file to send emails based on certain logs. Suppose you have to send email only when the log file contains a log message which contains “Application Execution Status”. You can use &lt;evaluator&gt; element as follows to fulfil your requirement.</p><figure><img alt="SMTPAppender format to send email based on certain log messages" src="https://cdn-images-1.medium.com/max/801/1*Ql9Bq8bu0WjfezsfHXZtIQ.png" /></figure><p>If you configure your appender including &lt;evaluator&gt; element, you have to add the following dependency also.</p><pre>&lt;dependency&gt;<br>     &lt;groupId&gt;org.codehaus.janino&lt;/groupId&gt;<br>     &lt;artifactId&gt;janino&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h3>Adding separate SMTPAppenders based on the execution environment</h3><p>Suppose you are deploying your application on a test/staging or prod environment and those have different SMTP configurations and also emails send based on different log message content. For that, you can use <strong>&lt;springProfile&gt;</strong> element to do configuration based on the active Spring profiles in your Spring Boot application. Then you can add several SMTPAppenders within a single logback.xml but inside different &lt;springProfile&gt; elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*vSi1isB3GuLnSxoyKslcmQ.png" /></figure><p>You can use the spring.profiles.active property in your application.properties or application.yml file to specify which spring profile is going to be activated in your Spring Boot application.</p><pre>spring.profiles.active=dev</pre><blockquote>In this article, we discussed</blockquote><ul><li>How to send the application log via email</li><li>How to send email based on certain application log messages</li><li>How to add different logging configurations based on the environment in the same logging configuration file</li></ul><p>I hope this article has provided you with valuable insights that you can apply to your project.</p><p>Thank You.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34ffc09d04f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get inspired with Arduino MEGA 2560]]></title>
            <link>https://kaveeshabaddage.medium.com/get-inspired-with-arduino-mega-2560-a1eabd40155c?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1eabd40155c</guid>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Mon, 03 Jul 2023 16:57:47 GMT</pubDate>
            <atom:updated>2023-07-03T16:57:47.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Arduino Mega 2560?</h3><p>The Mega 2560 is a microcontroller board which is designed for more complex projects like 3D printers and robotics projects. It has</p><ul><li><strong>54 digital input/output pins</strong> — 15 can be used as PWM outputs</li><li><strong>4 UARTs</strong> — referred to as universal asynchronous receiver/transmitter that translates data in asynchronous serial communication format</li><li><strong>a 16 MHz crystal oscillator </strong>— used to create an electrical signal with a precise frequency.</li><li><strong>an ICSP header</strong> — referred to as in-circuit serial programming that used to programme microcontrollers</li></ul><p>It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*15X53qHhqrVTWuWo.png" /></figure><h3>Programming</h3><p>The Mega 2560 board can be programmed with the See the <a href="https://www.arduino.cc/en/Main/Software">Arduino Software(IDE)</a>. <br><a href="https://www.arduino.cc/en/Reference/HomePage">reference</a> and <a href="https://www.arduino.cc/en/Tutorial/HomePage">tutorials</a> to get more details.</p><p>The Mega 2560 can be powered via a USB connection or with an external power supply. The power source is selected automatically.</p><p>The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and written with the EEPROM library).</p><h3>Input and Output</h3><p>Each of the 54 digital pins on the Mega can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive 20 mA as a recommended operating condition. In addition, some pins have specialized functions <br> The Mega 2560 has 16 analogue inputs. By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.</p><h3>Communication</h3><p>The Mega 2560 board has a number of facilities for communicating with a computer, another board, or other microcontrollers. It provides four hardware UARTs for TTL (5V) serial communication. The Mega 2560 also supports TWI and SPI communication.</p><h3>Automatic Reset</h3><p>Rather than requiring a physical press of the reset button before an upload, the Mega 2560 is designed in a way that allows it to be reset by software running on a connected computer.</p><p>Next, I’ll post a simple Arduino project using Arduino Mega 2560. <br> If you enjoyed this post, I’d be very grateful if you’d help it spread by sharing. Thank you!</p><p><em>Originally published at </em><a href="https://guywithtech.blogspot.com/2016/07/get-inspired-with-arduino-mega-2560.html"><em>https://guywithtech.blogspot.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1eabd40155c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to resolve Coreference Resolution using Python?]]></title>
            <link>https://kaveeshabaddage.medium.com/how-to-resolve-coreference-resolution-using-python-97fcd6b2cedb?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/97fcd6b2cedb</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coreference-resolution]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[machine-translation]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Sun, 27 Jun 2021 12:04:07 GMT</pubDate>
            <atom:updated>2021-06-27T12:04:07.803Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Coreference resolution is a challenging part of natural language processing which is used in information retrieval, machine translation, semantic search, and other decision support systems. If you are not familiar with ‘Coreference Resolution’ you could get a better understanding of that from <a href="https://kaveeshabaddage.medium.com/introduction-to-coreference-resolution-in-nlp-e7d108cd5fae">this article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*9cz8U1tPPDT333dOSEs6bQ.png" /></figure><p>We do Coreference Resolution with the aim of find, group and then substitute any ambiguous expressions with real-world entities they are referring to. This article is focused on how we can simply do the Coreference Resolution’ using the Python programming language.</p><p>Several open-source libraries can be used to resolve Coreference Resolution. This example is done using spaCy and <a href="https://github.com/huggingface/neuralcoref">NeuralCoref</a> modules. spaCy is an open-source software library for advanced natural language processing. And <a href="https://github.com/huggingface/neuralcoref">NeuralCoref</a> is a pipeline extension for spaCy which was introduced by <a href="https://huggingface.co/">Huggingface</a> .</p><p>I used the following sample web text to try Coreference Resolution.</p><blockquote>Alex said that he wants to go his home. Then Peter gave the key of his car to Alex saying that he needs it back on Monday.</blockquote><p>And I used the following source code which was written using the previously mentioned python libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4wmRojcBkWb4uH8a6U_Bg.png" /><figcaption>image representation of the sample source code</figcaption></figure><p>Initially, it imports the relevant libraries into the runtime. Then it loads the model which returns a language object containing all components and data needed to process the text. Here I used the ‘en_core_web_sm’ pipeline package.</p><p>spaCy pipeline packages have a naming convention of <strong>[lang]_[name]</strong>. According to that, ‘en’ is belongs to <strong>[lang]</strong> component and ‘core_web_sm’ belongs to <strong>[name] </strong>component. Furthermore<strong> [name] </strong>is divided into three components as follows.</p><ol><li>Type: Describe the pipeline’s capabilities</li></ol><p><em>Available types</em></p><ul><li><strong>Core</strong> — a general-purpose pipeline with vocabulary, syntax, entities and word vectors</li><li><strong>Dep</strong> — a pipeline only with vocabulary and syntax</li></ul><p>2. Genre: Describe the type of text that the pipeline is trained on</p><p><em>Available Genres</em></p><ul><li><strong>web</strong></li><li><strong>news</strong></li></ul><p>3. Size: Describe the pipeline size</p><p><em>Available Sizes</em></p><ul><li><strong>sm</strong></li><li><strong>md</strong></li><li><strong>lg</strong></li></ul><p>According to the naming conversion, the selected smaller pipeline package ‘‘en_core_web_sm’’ can be used in web texts in the English language as a general-purpose pipeline with vocabulary, syntax, entities, and word vectors. <br> <br>After that NeuralCoref is instantiated and add it to SpaCY’s pipeline of annotations. Finally, it used the following NeuralCoref attributes to resolve the Coreference Resolution and get the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*Z9-VA2-AwguqD7SLYUd6Ig.png" /></figure><p>Input for the Coreference Resolution solving program as follows.</p><blockquote>Alex said that he wants to go his home. Then Peter gave the key of his car to Alex saying that he needs it back on Monday.</blockquote><p>And below shows the final output after resolving the Coreference Resolution.</p><blockquote>Alex said that Alex wants to go Alex home. Then Peter gave the key of Peter car to Alex saying that Peter needs it back on Monday.</blockquote><p>As you can see It finds and groups the words which refer to the same entities and replaces pronouns with noun phrases.</p><p>Please find the <a href="https://colab.research.google.com/drive/1z0YSkVqylS5QZx-53o_J0apDKX-4ZwjE?usp=sharing">Google Colaboratory</a> notebook contains the above example.</p><h3>Reference</h3><p><a href="https://github.com/huggingface/neuralcoref">https://github.com/huggingface/neuralcoref</a></p><p><a href="https://spacy.io/">https://spacy.io/</a></p><p><a href="https://towardsdatascience.com/most-popular-coreference-resolution-frameworks-574ba8a8cc2d">https://towardsdatascience.com/most-popular-coreference-resolution-frameworks-574ba8a8cc2d</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97fcd6b2cedb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Coreference Resolution in NLP]]></title>
            <link>https://kaveeshabaddage.medium.com/introduction-to-coreference-resolution-in-nlp-e7d108cd5fae?source=rss-bfd41eacb8cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d108cd5fae</guid>
            <category><![CDATA[natural-language-processi]]></category>
            <category><![CDATA[coreference-resolution]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Kaveesha Baddage]]></dc:creator>
            <pubDate>Thu, 27 May 2021 09:30:00 GMT</pubDate>
            <atom:updated>2021-05-27T11:25:26.017Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Natural Language Processing(NLP)?</h3><p>Most probably you may have experience of using Google Home with voice commands or finding something on the internet using Siri on your iPhone. These are two practical applications built using NLP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yYijKiRfp2hi8Es9" /></figure><p>Natural Language Processing is a branch of Artificial Intelligence that makes it possible for computers to interpret, understand and manipulate human language. It tries to fill the gap between computer understanding and human communication. Speech recognition, spelling checking, keyword search, and many more techniques come under NLP.</p><h3>What is Coreference Resolution?</h3><p>Coreference Resolution comes with NLP and it tries to find all linguistic expressions in a given text that refer to the same real-world entity. This is how it works.</p><p>Suppose you have to find the pronouns in a sentence and replace them with relevant nouns. Coreference resolution can be used to do that. It finds and groups the words which refer to the same entities and replaces pronouns with noun phrases. Let’s consider an example for better understanding.</p><p>Consider the following sentence.</p><blockquote>“I gave my laptop to Andrew because he told me that he needs it to do his assignment” Peter said.</blockquote><p>In Coreference Resolution first, it groups the words into several groups by considering entities. In this sentence the main entities are</p><ul><li>Andrew</li><li>Peter</li><li>Peter’s Laptop</li></ul><p>According to those entities, it can divide nouns and pronouns into several groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rm4cDUmEWglfC4J_h1avbA.png" /></figure><p>After that, it replaces all the pronouns in the sentence with relevant nouns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*HEXGq57ZNYhZDxsr5vK2Jw.png" /></figure><h3>When do we use Coreference Resolution?</h3><p>Coreference resolution is using in a variety of NLP tasks such as,</p><ul><li>Text understanding</li><li>Document summarization</li><li>Information extraction</li><li>Sentiment analysis</li><li>Machine translation</li></ul><h3>Pre-processing in Coreference resolution</h3><p>Coreference resolution requires a pre-processing pipeline that consists of a variety of NLP tasks. It may includes</p><p><strong>Named Entity Recognition</strong>: which finds and classifies named entities in a text into predefined categories such as locations, organizations or names of persons.</p><p><strong>Entity Linking or Wikification</strong>: which aligns textual mentions of named entities to their corresponding entries in a knowledge base.</p><p><strong>Part-of-Speech Tagging</strong>: a process of assigning parts of speech to words in a sentence.</p><p><strong>Stemming</strong>: a process of cutting off the beginning or end of the word, using a list of common prefixes and suffixes that can be found in an inflected word.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*GyGAmJ0NFzr2hucwZkXQtg.png" /></figure><p><strong>Lemmatization: </strong>do a<strong> </strong>morphological analysis of words with the aim of remove inflectional endings and return the base or dictionary form of a word</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*YFoWcsFXu1LgX5gMFsFSfA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d108cd5fae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>