<?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 Sajith vijesekara on Medium]]></title>
        <description><![CDATA[Stories by Sajith vijesekara on Medium]]></description>
        <link>https://medium.com/@sajithv?source=rss-2c6f25c5dd5d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sqN6qtAGV4pgRWFik5slkA.jpeg</url>
            <title>Stories by Sajith vijesekara on Medium</title>
            <link>https://medium.com/@sajithv?source=rss-2c6f25c5dd5d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 02:11:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sajithv/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[AI-First Engineering: Why One Model Shouldn’t Do Everything]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sajithv.medium.com/ai-first-engineering-why-one-model-shouldnt-do-everything-0f7910a41017?source=rss-2c6f25c5dd5d------2"><img src="https://cdn-images-1.medium.com/max/1935/1*hnduRqzlXvXYspyO_QWjoQ.png" width="1935"></a></p><p class="medium-feed-snippet">In my previous newsletter, I discussed the shift from AI-assisted engineering to AI-agentic software engineering.</p><p class="medium-feed-link"><a href="https://sajithv.medium.com/ai-first-engineering-why-one-model-shouldnt-do-everything-0f7910a41017?source=rss-2c6f25c5dd5d------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sajithv.medium.com/ai-first-engineering-why-one-model-shouldnt-do-everything-0f7910a41017?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f7910a41017</guid>
            <category><![CDATA[typesafe-ai]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[jevs]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 10:52:12 GMT</pubDate>
            <atom:updated>2026-09-30T10:52:12.201Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Moving from AI-Assisted Engineering to AI-Agentic Software Engineering]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sajithv.medium.com/moving-from-ai-assisted-engineering-to-ai-agentic-software-engineering-612c35213a26?source=rss-2c6f25c5dd5d------2"><img src="https://cdn-images-1.medium.com/max/1672/1*nuHKEotK4A7VED60CdFdig.png" width="1672"></a></p><p class="medium-feed-snippet">The rise of AI coding assistants has transformed how developers write software.</p><p class="medium-feed-link"><a href="https://sajithv.medium.com/moving-from-ai-assisted-engineering-to-ai-agentic-software-engineering-612c35213a26?source=rss-2c6f25c5dd5d------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sajithv.medium.com/moving-from-ai-assisted-engineering-to-ai-agentic-software-engineering-612c35213a26?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/612c35213a26</guid>
            <category><![CDATA[spec-kit]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai-sdlc]]></category>
            <category><![CDATA[bmad]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 09:05:54 GMT</pubDate>
            <atom:updated>2026-09-30T18:26:31.127Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Leveraging Hazelcast for Distributed Caching in Spring Boot Microservices]]></title>
            <link>https://sajithv.medium.com/leveraging-hazelcast-for-distributed-caching-in-spring-boot-microservices-e6291e6fe057?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6291e6fe057</guid>
            <category><![CDATA[hazelcast]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 17:28:33 GMT</pubDate>
            <atom:updated>2026-10-01T10:21:42.952Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MIXcsshW0nejQ7mpmoVs8g.png" /></figure><p>Application response time is a critical factor when building high-performance applications. To optimize this time, we can use caching strategies.</p><p>Assume we have an inventory management service that connects to the database. for high availability, we have two instances of API servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*z2hX_eZteB70_-lQaIMiyQ.png" /><figcaption>API service with multiple instances</figcaption></figure><p>There are main two types of cache strategies that can be followed in microservices.</p><ol><li><strong>Distributed Cache</strong></li><li><strong>Local Cache Strategies</strong></li></ol><p>In the distributed architecture, there are two types of distributed cache available.</p><ol><li><strong>Centralized Cache</strong></li><li><strong>Embedded Cache</strong></li></ol><p>For example, we can use Redis as a centralized cache provider, since the cache instance will be available as a single instance it will synchronize the data between microservices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*lmbhBQlfgZIGgj11HG-9HA.png" /><figcaption>centralized cache in microservices</figcaption></figure><p>In the example above, we can integrate any type of cache provider to offer a centralized cache for applications. This approach is suitable for large-scale, enterprise-grade architectures, though maintaining a centralized cache introduces additional costs to the system.</p><p>The next approach is to use an application-level cache. However, if there are multiple instances, we cannot guarantee that user requests will be routed to the same instance in future requests. As a result, all cache instances need to be synchronized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*rKUa-_zPNVHUxFzcNOm1MA.png" /><figcaption>distributed cache in microservices</figcaption></figure><h3>Hazelcast</h3><p>Hazelcast is a widely used open-source distributed caching provider, particularly popular in microservices architectures. In this guide, I will outline the steps to configure a Spring Boot application with Hazelcast.</p><ol><li>Add Dependencies</li></ol><pre>&lt;dependency&gt;<br>   &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>   &lt;artifactId&gt;spring-boot-starter-cache&lt;/artifactId&gt;<br>  &lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;com.hazelcast&lt;/groupId&gt;<br>    &lt;artifactId&gt;hazelcast-spring&lt;/artifactId&gt;<br>    &lt;version&gt;5.3.1&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>2. Add Hazelcast configs file</p><pre>@Configuration<br>public class HazelcastConfig {<br><br>  private final Logger logger = LoggerFactory.getLogger(getClass());<br><br>  @Bean<br>  public HazelcastInstance hazelcastInstance() {<br>    HazelcastInstance instance = Hazelcast.newHazelcastInstance();<br>    instance.getConfig().addMapConfig(new MapConfig(&quot;inventory-api&quot;).setTimeToLiveSeconds(5));<br>    LogListener listener = logEvent -&gt; logger.info(logEvent.getLogRecord().getMessage());<br>    LoggingService loggingService = instance.getLoggingService();<br>    loggingService.addLogListener(Level.INFO, listener);<br>    return instance;<br>  }<br><br>  @Bean<br>  public ClientConfig clientConfig() {<br>    ClientConfig cfg = ClientConfig.load();<br>    cfg.setClusterName(&quot;inventory-api-cluster&quot;);<br>    return cfg;<br>  }<br>}</pre><p>3. Enable cache in the spring boot application.</p><pre>@EnableCaching<br>public class ApiServiceApplication {<br><br>    public static void main(String[] args) {<br>       SpringApplication.run(ApiServiceShrApplication.class, args);<br>    }<br><br>}</pre><p>5. Can use spring cache annotations to implement cache features</p><pre>@Cacheable(value = &quot;products&quot;, key = &quot;#category&quot;)<br>@Override<br>public List&lt;ProductSummaryDto&gt; getProductsByCategory(String category) {<br> // your logic<br>}</pre><p>Once we start the service, it will launch embedded Hazelcast instances. If multiple instances are running, you can observe that all the Hazelcast instances synchronize properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5wYPO9B6euDIH0URAb4Aw.png" /><figcaption>connect two embedded Hazelcast instances</figcaption></figure><p>Thank you for taking the time to read this blog! Your feedback and suggestions are invaluable in helping us improve the content and make it more useful for our readers. Please feel free to share your thoughts and comments below. Your input is greatly appreciated!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6291e6fe057" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CKAD Exam Guide for 2024]]></title>
            <link>https://sajithv.medium.com/ckad-exam-guide-for-2024-9d9dddb30f35?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9dddb30f35</guid>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ckad]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Sat, 13 Jan 2024 08:08:01 GMT</pubDate>
            <atom:updated>2026-09-30T18:32:15.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_h61a5nFTGY3Z8Dee0XSQ.png" /><figcaption>ckad guide 2024</figcaption></figure><p>In the year 2024, I started with good news, I had cleared my CKAD exam and I thought to share my experience to prepare and face the exam.</p><p><strong>Background</strong></p><p>I have done projects in the last 4 years using the k8 environments. Though I have worked on projects I thought to prepare for certification and prove I know k8. My first choice was to start CKA and decided to start CKAD first and then moved to CKA.</p><p><strong>Materials</strong></p><ol><li>Mumshad Mannambeth this <a href="https://www.udemy.com/course/certified-kubernetes-application-developer/">udemy</a> course I have followed.</li><li>KillerCode this Tutorial <a href="https://killercoda.com/killer-shell-ckad/">link</a></li><li>K8 Documentation <a href="https://kubernetes.io/docs/home/">https://kubernetes.io/docs/home/</a></li><li>For Network policies this <a href="https://github.com/ahmetb/kubernetes-network-policy-recipes">repository</a> is very useful</li><li>This GitHub <a href="https://github.com/dgkanatsios/CKAD-exercises">repository</a> is ok but some of the content is outdated.</li></ol><p><strong>Prepare for Exam</strong></p><p>The main challenge in this exam is time management. you will get 16–22 questions ( for me it is 16 questions ). Time is enough and don’t spend on questions if you don’t remember or have difficulty when identifying the issue. Just flag the question and move to the next one. That way at the end of the exam you can see that time is enough for the exam. Another thing needs to having to remember some of the imperative commands it will reduce your time searching the official documentation. Here at the end, I will add the commands I have noted while preparing for the exam.</p><p>The next thing is please make sure to complete the free two mock exams provided by Killercode. It will help to familiarize with the environment. especially how to copy and paste from official documentation to the remote desktop terminal.</p><p><strong>From My Note Book</strong></p><p>This is the list of commands I have put in my note.</p><ol><li>Short Keys</li></ol><pre>export do=&quot; - dry-run=client -o yaml&quot;<br>export now=&quot; - force - grace-period 0&quot;</pre><p>2. Most used commands</p><pre>// cronjobs <br>k create cj cj1 -oyaml --dry-run=client --schedule=&quot;* * * * *&quot; --image=busybox<br><br>// pods<br>k run nginx --image=nginx --restart=Never --port=80<br>k exec my-pod -- ls<br>k exec -it mynginx  -- pwd<br>kubectl run busybox --image=busybox --command &quot;sleep&quot; -- &quot;5000&quot;<br>k set image pod/nginx nginx=nginx:1.7.1<br>k get po -l app=v6<br>K get logs -f my-pod -c &lt;init-cotainer&gt;<br>k run mynginx --image=redis --env=SAMPLE=user<br>k top po -n rcluster --sort-by memory --no-headers // filter pods<br><br>// quota for node<br>k create quota myquata --hard=copu=1,memory=1G,pods=2<br><br>// deployments<br>k set image deployment.v1.apps/nginx nginx=nginx:1.7.1<br>k scale rs --replicas=5 frontend<br>k scale deploy --replicas=4 demo<br><br><br>// service<br>k expose pod redis --port=6379 --name redis-service $do -o yaml &gt; service.yaml<br>kubectl expose deployment nginx --port=80 --target-port=8000<br>kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https<br>k expose pod redis --port=6379 --type=NodePort --name redis-service<br><br><br>// Configs Maps<br>k create cm my-test —from-literal=key=value —form-literal=key=val<br><br>// Secrets<br>k create secret generic db-secret --from-literal=DB_Host=sql01 --from-literal=DB_User=root --from-literal=DB_Password=password123<br><br>// Service Account<br><br>k create sa my-test<br><br>// Taints for node<br><br>kubectl taint nodes node01 spray=mortein:NoSchedule<br><br>Remove Taint ( add - end of line)<br><br>kubectl taint nodes node01 spray=mortein:NoSchedule-<br><br>// deoployment rollout <br><br>kubectl rollout history deployment/nginx-deployment<br><br>k rollout undo deployment/nginx-deployment<br><br><br>// Ingress<br><br>k create ingress ingress-pay -n critical-space --rule=&quot;/pay=pay-service:8282&quot; --dry-run=client -o yaml &gt; ingress2.yaml<br><br>k get ingress<br><br>// Roles<br><br>kubectl create role foo --verb=get,list,watch --resource=pods,pods/status<br><br>k auth can-i create nodes — as dev-user<br><br><br>// View Contexts<br><br>k config view<br>k config use-context sajith@production<br><br>// cluster roles<br>k get clusterroles<br>k get clusterrolebindings<br><br>// labels<br>kubectl label nodes my-node app=backend<br><br><br>// Update deployment specs<br><br>k set resources deploy redis --requests=cpu=0.2 --limits=cpu=0.5<br><br><br>// helm commands<br><br>healm list<br><br>uninstall<br><br>helm uninstall &lt;&gt; -n namespace release_name<br><br>healm install internal-issue-report-apache bitnami/nginx --version=1.0.0<br><br>Update repos&#39;s<br>helm repo update<br><br>Set Values in install<br><br>helm install q30 bitnami/nginx -n helm-test --set replicaCount=2<br><br>// RBAC Commands<br><br>k auth can-i get secret/sajith100 --as sajith<br><br>Answer : # no<br><br>k create role thinkrole --verb=get,create,list --resource=secret --resource-name=sajith100<br><br><br>k create rolebinding sajith100binding --role=thinkrole --user=sajith<br><br><br>k auth can-i get secret/sajith100 --as sajith<br><br>answer : # yes</pre><p>If you are planning to sit CKAD 2024 this post will help to prepare for your exam. will see you in another post regarding CKA in the next couple of months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9dddb30f35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prometheus and Grafana on EKS Cluster using Helm Chart]]></title>
            <link>https://sajithv.medium.com/prometheus-and-grafana-on-eks-cluster-using-helm-chart-73888f83d8fa?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/73888f83d8fa</guid>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Thu, 12 May 2022 20:02:54 GMT</pubDate>
            <atom:updated>2026-10-01T10:28:04.587Z</atom:updated>
            <content:encoded><![CDATA[<h4>Kubernetes Monitor with Grafana &amp; Prometheus</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bXfmog9AjbO-vQCdI9UBOQ.png" /><figcaption>k8 monitoring with grafana &amp; prometheus</figcaption></figure><p>Last week I was able to set up Grafana and Prometheus to monitor the k8 cluster using the helm chart.</p><p>Before starting this blog I want to say that I am not an expert in Kubernetes and if any false information is in the blog please correct me. This blog is for beginners who are trying to learn Kubernetes.</p><p>Here I am not going to discuss the Kubernetes concepts. So My primary goal Is to set up Grafana + Prometheus in the Kubernetes cluster in AWS. For that, I am planning to use helm. The main advantage of using helm is, that it is providing templates that will save our configuration overhead in setup in k8.</p><p><strong>AWS K8 Cluster Setup</strong></p><p>First Create a Kubernetes cluster in AWS.</p><p>For that, I am planning to use <a href="https://eksctl.io/">eksctl</a> tool to create a cluster. Please use <a href="https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html">these</a> instructions to install the eksctl tool.</p><p>First Create the sample specification for the cluster using a configuration file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dd572e0794433d0fc7038bb222b5706/href">https://medium.com/media/4dd572e0794433d0fc7038bb222b5706/href</a></iframe><p>Then, using the following command can create an EKS cluster successfully.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6de0c5a352f2bf26dba65f0d60b2249e/href">https://medium.com/media/6de0c5a352f2bf26dba65f0d60b2249e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7f1gnTuXY0Da-fUqyk14pQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obpzxQw9Flw4-uKpOJZ7sg.png" /></figure><blockquote>Note: When create eks instance using helm it is first time adding the user permission to config maps. for that follow <a href="https://stackoverflow.com/questions/70787520/your-current-user-or-role-does-not-have-access-to-kubernetes-objects-on-this-eks">these</a> steps then it will display the cluster details in console.</blockquote><p><strong>Install Helm and Grafana Stack</strong></p><p>Let&#39;s see why we need helm to install grafana stack in Kubernetes. The main Advantage is helm gives the template-based configurations to install and manage complex Kubernetes applications.</p><p>First needs to install helm onto your local machine. After that add Prometheus repository to the helm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21b11cfb8b01c8db0eb60be35b66ed1a/href">https://medium.com/media/21b11cfb8b01c8db0eb60be35b66ed1a/href</a></iframe><p>Then Install the Prometheus Stack in K8 Cluster.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/547e46c4f46b6b63e2814ce485fa8e54/href">https://medium.com/media/547e46c4f46b6b63e2814ce485fa8e54/href</a></iframe><p>It will successfully create the deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpS8IP0vJc4VcT3mwcaFcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*wQFkwY_a-DigwDE9uRG_8w.png" /><figcaption>created pods</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4hxZkiZIQgMfF3l_mfshBw.png" /><figcaption>all the deployments</figcaption></figure><p>Inside the kube-prometheus-stack, Prometheus server, alert manager, and grafana will be available as a bundle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7f8-GqgcchcS3uUugu2JJA.png" /></figure><p><strong>Deploy Spring Boot Application And Monitor Via Grafana</strong></p><p>In the next part, we are going to deploy a spring boot application and monitor using the grafana dashboard.</p><p>These things needs to consider when writing the spring boot application.</p><ol><li>Make sure to use the spring <strong>actuator </strong>to expose administrative endpoints for access via Prometheus.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27299dcba7c48506b70d7e99a3d446d4/href">https://medium.com/media/27299dcba7c48506b70d7e99a3d446d4/href</a></iframe><p>2. Create Docker Image Repository in ECR and give the correct permissions to the AWS user.</p><p>Then we can easily deploy the Docker image to eks cluster.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ed7a4b8a4d835cf2dd4448d5a92af00/href">https://medium.com/media/9ed7a4b8a4d835cf2dd4448d5a92af00/href</a></iframe><p>And the final step is to expose the grafana dashboard to the public.</p><p>Before that, we can verify the grafana instance is up or not by using port forward.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/414c3d1db1b0db77f1c793acd23b8204/href">https://medium.com/media/414c3d1db1b0db77f1c793acd23b8204/href</a></iframe><p>This will helps to test the Grafana locally. These are the default credentials for the admin users.</p><pre>user: admin<br>pass: prom-operator</pre><p>Then you can view the cluster matrix via grafana.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDNgi73f5ahidLVV_HbZBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-JQvUpbVng80YqUwoAwDA.png" /></figure><p><strong>Summarize</strong></p><p>In this article, we have discussed how to create k8 cluster and deploy the grafana, Prometheus stack using helm and finally deploy custom created docker image. Then we have to monitor the cluster information and other custom-created matrices using the Grafana dashboard.</p><p>And the next article I am planning to deeply discuss more Kubernetes concepts until then happy coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73888f83d8fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Reasons to Choose Flutter for Your Next Project]]></title>
            <link>https://sajithv.medium.com/5-reasons-why-choose-flutter-for-your-next-startup-project-4d66c59f27a1?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d66c59f27a1</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Wed, 26 Jan 2022 03:09:51 GMT</pubDate>
            <atom:updated>2026-10-01T11:00:28.626Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why You Should Select Flutter for Your Next Project?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4q5_eroaFT4p-GQ8QYfJkQ.png" /></figure><p>If you plan to start your next mobile project or if you are a developer who plans to learn new technologies in 2022, This article is for you. Mobile Development is trending day by day and it is evolving the new technologies. As a software developer, I have familiar with most of the mobile development frameworks.</p><p>Due to the pandemic situation, I have seen so many mobile products come to the market in a quick time period. The main reason is for this Flutter and similar cross-platform frameworks.</p><h3>1. Development Time</h3><p>The first Reason for choosing Flutter for the next project is development time. Flutter is based on dart language and if you are familiar with java and similar programming language it is really easy to learn Flutter. In Flutter logic and UI will be written in the same code-base. unlikely in native android had to learn XML-based UI and it is really hard to familiar with new layout formats. But in a Flutter, all UI elements are available as widgets.</p><p>Due to this reason, it is really efficient and within a minimum time period can do MVP product to the market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/0*MlRqymaKi3OEzIU4.jpg" /><figcaption>flutter helps to minimum time to build MVP</figcaption></figure><h3>2. Same Code, All Platforms</h3><p>At the early stage of mobile development around a few years back we had the biggest issue was managing two mobile developers for android and ios. It is really hard to manage two code-base for android and IOS because to do the change in each project takes time and it is an error-prone task.</p><p>Then few cross-platform development frameworks came but those were run the UI on a web browser. Due to this reason, we haven&#39;t discovered all the core features in cross-platform, until Flutter came in 2017. The best thing is Flutter support web application as well. I hope in the future Flutter will be suitable for any web development like react-js.</p><h3>3. App Performance</h3><p>The biggest issue had in the cross-platform mobile frameworks is most of them use browser-based component rendering mechanisms. It leads to problems with application native performance not being able to achieve when building enterprise applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*__26ZwXnNn67Nnan.png" /><figcaption>how flutter internally works</figcaption></figure><p>Dart compiler converts the Flutter application to native code, this is the reason Flutter gives the native features. Read <a href="https://learnlanga.medium.com/how-does-jit-and-aot-work-in-dart-cab2f31d9cb5">here</a> for how the Flutter compiler works.</p><h3>4. Rich UI features</h3><p>In Native android development biggest challenge was to be familiar with XML layout to build the UI components. Flutter has matured UI library and it can be easily added to the project. The main advantage of the Flutter is It support Hot Reload the UI components.</p><p>All the UI libraries come up as a widget, due to this reason within minimal code we can include the library and test.</p><p>For example, assume needs to implement a full circle shape image. In a native way had to write so many XML files to do that. But in Flutter, just a few lines of code are enough.</p><p>Ex: <strong>Circle Image</strong></p><pre>ClipRRect(<br>    borderRadius: BorderRadius.circular(8.0),<br>    child: Image.network(<br>        subject[&#39;images&#39;][&#39;large&#39;],<br>        height: 150.0,<br>        width: 100.0,<br>    ),<br>)</pre><p>These are the few sample apps UI that is written in Flutter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/0*Sb2i8Pl4MYiqF5fT.png" /><figcaption>flutter sample apps</figcaption></figure><h3>5. Powerful support</h3><p>Flutter during the last couple of years steadily become one of the best cross-platform frameworks for mobile development. As below graph, the popularity of the Flutter becomes high than react native in 2020.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/0*Vw56feHzfvyCbAEZ" /><figcaption>mobile development frameworks in 2019 and 2020</figcaption></figure><p>At the initial stage of the Flutter, there were few community-driven projects and libraries available. But once Flutter become an industry-leading framework most of the developers wrote libraries and plugins for Flutter.</p><p>The Flutter platform community has also grown in the last couple of years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*cLxkYH2jT1zSAg1YLwBgcQ.png" /><figcaption>flutter contribution</figcaption></figure><p>Flutter now has a very grown community for the support. These are a few Flutter communities. <a href="https://flutter.dev/community">Official Dev</a>, <a href="https://www.youtube.com/c/flutterdev">Youtube</a></p><p>Thanks for reading this article and hope you find this helpful.</p><h3>Learn More</h3><ul><li><a href="https://enlear.academy/how-to-implement-a-customized-google-map-with-flutter-d6fb40534cda">How To Implement a Customized Google Map with Flutter</a></li><li><a href="https://enlear.academy/authentication-for-flutter-with-aws-amplify-c9c9f7ff1a78">Authentication for Flutter with AWS Amplify</a></li><li><a href="https://enlear.academy/mobile-app-development-in-2021-is-it-worth-learning-dart-when-you-already-know-javascript-db3d9e88f881">Mobile App Development in 2022</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d66c59f27a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Driven Architecture with AWS SQS]]></title>
            <link>https://sajithv.medium.com/event-driven-architecture-with-aws-sqs-d277851442c6?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d277851442c6</guid>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[aws-sqs]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 13:09:00 GMT</pubDate>
            <atom:updated>2022-01-10T15:11:32.489Z</atom:updated>
            <content:encoded><![CDATA[<h4>Cloud-native Queue Service in Microservice Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixMMyD7HsRHSawGBH1aR7A.png" /><figcaption>spring boot with aws sqs</figcaption></figure><h3>What is Message Queue Service?</h3><p>Before learning the AWS SQS we have to learn what is message queue service first. Message Queue service is “<strong>the system that pushes a message into a queue by providing an asynchronous communications protocol</strong>”. There are two parties involved in queue service. Those parties are called Sender and Receiver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*PctJBO1lJX8iy5BCXdm6yQ.png" /></figure><h3>Event-Driven Architecture</h3><p>Before starting, the development has to check what is event-driven architecture in microservices.</p><p>As an example assumes in e-commerce platform contains the following microservices. <strong>Checkout Service, Inventory Service, Shipping Service, Notification Service</strong>. When a customer does some product checkout needs to inform to other three microservices. Normally Checkout Service Send requests to each service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*i8Yo7gOPgWS3FfRAzxBnQg.png" /><figcaption>Request Driven Architecture</figcaption></figure><p>But sending requests to each module is a very time-consuming task and it is taking more resources. In asynchronous architecture, we can use the following way to resolve the above issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*6tmTe50GJq8lf2Rtz56WyQ.png" /><figcaption>Event Driven Communication</figcaption></figure><p>AWS Simple queue service provides the following two type of queue creation. Standard queue and FIFO queue.</p><h3>Case Study</h3><p>To Explain the AWS SQS I will use this case study. Assume there is a quiz micro-service and once the user published the quiz it needs to send a notification to the user with score and message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*Rs-lxHMXpv2fS0lYkL46sg.png" /><figcaption>Case Study for Event Send</figcaption></figure><h3>AWS Configurations</h3><p>First Create an AWS user and give the programmatic access. Once user creation is completed needs to create an SQS instance in AWS.</p><p>Create an SQS instance and choose the type as Standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AceEfarwws7syVnllwE1kw.png" /><figcaption>Create sqs instance in aws</figcaption></figure><p>After the queue is created please get the queue URL in here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e3I2lO-HD3loTzQNBIMs-Q.png" /></figure><h3><strong>Event Sending Module [Quiz Service]</strong></h3><p>First, create a spring boot project and add the following dependencies to the project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50f01fb763269eea257bb79053f53af1/href">https://medium.com/media/50f01fb763269eea257bb79053f53af1/href</a></iframe><pre>&lt;<strong>spring.cloud-version</strong>&gt;Hoxton.SR8&lt;/<strong>spring.cloud-version</strong>&gt;</pre><p>Add the AWS credentials in the application.yml file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30e4a112d4a75ef0a8334bad0c72b873/href">https://medium.com/media/30e4a112d4a75ef0a8334bad0c72b873/href</a></iframe><p>Now all the configurations are done. The next step is to write logic to send events to the queue. For sending all the details to SQS needs to create a custom object which contains all the details.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45a7ffdfb1ef78694bd5420f9f90f367/href">https://medium.com/media/45a7ffdfb1ef78694bd5420f9f90f367/href</a></iframe><p>The next step is to create a spring configuration class to create all the required beans for sending objects to the AWS Queue.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/838cc239bbdbe8df3ef05311082eed1a/href">https://medium.com/media/838cc239bbdbe8df3ef05311082eed1a/href</a></iframe><p>And all the beans configurations are done now we can send objects to the queue.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6982049572a0d14dadc18ecc7508910/href">https://medium.com/media/b6982049572a0d14dadc18ecc7508910/href</a></iframe><p>Now you can view the send object in the AWS SQS console. Go to the <strong>Queue</strong> <strong>-&gt;</strong> <strong>Send and receive messages</strong> <strong>-&gt;</strong> <strong>Poll for Messages</strong> then you can view the send messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*BIKTCtzsvLUwfc-tvr6QyA.png" /></figure><p><strong>Event Receiving Module [Notification Service]</strong></p><p>In here all the AWS configurations need to be done. After that through RestController will be able to receive the Messages sent by Quiz Module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/deace7347e4495fe0443f1229a657a9e/href">https://medium.com/media/deace7347e4495fe0443f1229a657a9e/href</a></iframe><p>And final we have to exclude these configurations in the spring boot project to start the module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/728c97df6feaf53c5369ce0ee7075a12/href">https://medium.com/media/728c97df6feaf53c5369ce0ee7075a12/href</a></iframe><p>And that is it all the events sent by the quiz module are now received by the notification service. Hope you guys understand the concept of the queue service with AWS SQS. Please let me know if you have any clarifications.</p><h3>Learn More</h3><ul><li><a href="https://enlear.academy/my-aws-solutions-architect-professional-exam-experience-98e691d93e6f">My AWS Solutions Architect Professional Exam Experience</a></li><li><a href="https://enlear.academy/spring-boot-with-amazon-sqs-5f7693314a99">Using AWS SQS With Spring Boot</a></li><li><a href="https://enlear.academy/how-to-manage-database-connections-with-amazon-rds-proxy-f07e37580bf8">Managing Database Connections with Amazon RDS Proxy</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d277851442c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Log Aggregation with Loki & Grafana]]></title>
            <link>https://sajithv.medium.com/log-aggregation-with-loki-grafana-4089fdc24acd?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4089fdc24acd</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[promtail]]></category>
            <category><![CDATA[loki]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[aggregation]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 19:52:50 GMT</pubDate>
            <atom:updated>2021-12-15T05:41:44.776Z</atom:updated>
            <content:encoded><![CDATA[<p>Microservice log aggregation with grafana &amp; loki</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTb6fpeI2UBE7cL4tUJcoQ.png" /></figure><p>This is the continuation of the tech series for micro-service monitoring. <a href="https://enlear.academy/spring-boot-monitor-with-prometheus-and-grafana-122613b325d0">Last article</a> we have discussed how to integrate prometheus with grafana. In this thread we are going to discuss the how to integrate the loki with grafana.</p><h4>What is Loki ?</h4><p>Grafana Loki is logging aggregation system which allows high available and multi tenancy.</p><p>In micro-service paradigm to read the logs from each micro-service is really hard when we do one by one. To identify one issue have to tail logs in multiple modules. But what loki does is support the log aggregation in single dashboard and will allow to query the results form dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arOBlPEmSUlUB79UULxfhQ.png" /><figcaption>logs aggregator</figcaption></figure><p>In here Promtail push the logs to loki and it can be view in the grafana dashboard.</p><h4>Configurations</h4><p>First in this setup have to setup promtail configurations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c93db2a137c399ad236f83f5f2b24332/href">https://medium.com/media/c93db2a137c399ad236f83f5f2b24332/href</a></iframe><p>Here We have scrape configs for docker logs scrapping. To Enable the docker logs to promtail needs to install docker <a href="https://grafana.com/docs/loki/latest/clients/docker-driver/">plugin</a> for that.</p><pre>docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions</pre><p>After install the plugin , can verify this way. And needs to restart the docker demon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*6mUaWhiwQr5ROaWGvSx7SQ.png" /></figure><p>Next step is to add loki configs. Normally we don’t have any additional configs needs other than default configs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/075662d604b0f09c7eda9e9649a0bcda/href">https://medium.com/media/075662d604b0f09c7eda9e9649a0bcda/href</a></iframe><p>Now all the module specific configurations added. Now needs to run the loki,promtail, grafana and other microservices ad docker compose file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c39516bc2016a38ee4c0e4271dc4c4d/href">https://medium.com/media/1c39516bc2016a38ee4c0e4271dc4c4d/href</a></iframe><h4>Verify Setup</h4><p>Open the loki &amp; check the setup.</p><p><a href="http://localhost:3100/ready">http://localhost:3100/ready</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJcWQWPq7BiclGB-W5JYrg.png" /><figcaption>verify grafana loki setup</figcaption></figure><h4>Testing</h4><p>Now login to grafana dashboard and add loki as data source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1KI66LjBuk3kGZPWtj6mQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Ge2Ztv9ZrrZIjneWkm4Uw.png" /></figure><p>And final step is query the logs from microservices.</p><p>when you go to explore tab you can filter the logs based on containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFPtB3LYyoMyDROkgsS_Jw.png" /></figure><p>Note: If container search option not showing please follow <a href="https://grafana.com/docs/loki/latest/clients/docker-driver/configuration/">this</a> configuration guide and restart the docker demon again.</p><p>I hope now you familiar with setup loki with grafana to aggregate docker container logs. Put your comments and feedback’s bellow here.</p><p>Thanks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4089fdc24acd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Monitoring with grafana & prometheus]]></title>
            <link>https://sajithv.medium.com/spring-boot-monitor-with-prometheus-and-grafana-122613b325d0?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/122613b325d0</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Sat, 04 Dec 2021 18:58:14 GMT</pubDate>
            <atom:updated>2021-12-06T06:31:01.867Z</atom:updated>
            <content:encoded><![CDATA[<h3>Microservice Monitoring with Grafana &amp; Prometheus</h3><h4>Monitoring Spring Boot Application using Prometheus and Grafana</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1mJBlytg3EHu1-ct1kU10Q.jpeg" /></figure><p>When Dealing with multiple micro-services it is always better to monitor the systems using a monitoring tool. Here I am going to explain how we can monitor spring boot applications using Prometheus and Grafana.</p><h3>What is Prometheus?</h3><p>Prometheus is an open-source monitoring system that helps to periodically monitor the JVM Based systems.</p><h3>What is Grafana?</h3><p>Grafana is a tool that can inject various data sources and display them in a comprehensive graphical experience. It supports various data sources like ELK, Prometheus, Graphite. And It also supports sending alerts base on different conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*Ed-yzmEEgLXBsbKScacTWQ.png" /></figure><p>First Create the Spring microservice and add enable the actuator endpoints for the module.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03e4e9403431ef56e62d953f87660311/href">https://medium.com/media/03e4e9403431ef56e62d953f87660311/href</a></iframe><p>In Spring web flux have to explicitly enable actuator endpoint. To do that have to add the following configuration application.yml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/743130b9f1baaff2f231b0963f06e192/href">https://medium.com/media/743130b9f1baaff2f231b0963f06e192/href</a></iframe><p>After that, once the spring boot application started it will show the exposed Prometheus endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*xWEcoWSsMzUJoC3XBQdN3g.png" /><figcaption>actuator details</figcaption></figure><p>As the Next step create a docker image from the spring boot microservice.</p><p>The next step is to start Prometheus API Server. To-Do that needs to create a separate config for the Prometheus server. create a file called “<strong>prometheus.yml</strong>‘’.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75d3cae52e4571d44a250158319f6bba/href">https://medium.com/media/75d3cae52e4571d44a250158319f6bba/href</a></iframe><p>The next step is to start to spring boot Microservice, Prometheus and grafana instances. for that here using the docker-compose to start all the modules.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d2739040bd0313ab8b969ab09f32cba/href">https://medium.com/media/6d2739040bd0313ab8b969ab09f32cba/href</a></iframe><p>Once all the modules are started can verify the instance is available in Prometheus dashboard.</p><p>url : <a href="http://localhost:9090/graph">http://localhost:9090/graph</a></p><p>search by “process_cpu_usage”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BloUaFtKTbEmvbIyDI_AvQ.png" /></figure><p>After all, module startup go to grafana dashboard and setup data source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bB4Y0zwHL1guOncH_52zRA.png" /></figure><p>add the correct Prometheus URL in config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuEWl8lvZC_r_CczJSL4Cg.png" /></figure><p>verify the Prometheus setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XkLyNrq--rKcYYFvPzO8rA.png" /></figure><p>The final step is to create a dashboard panel and view the analytics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRjw7-Rz6h2mAAjxv4KTLQ.png" /><figcaption>view cpu usage of the micro service</figcaption></figure><h3>Conclusion</h3><p>To view the JVM statistics in grafana needs to first enable the actuator and enable the Prometheus endpoint for the Prometheus server. The next step is to set up Prometheus and open Prometheus as the data source in grafana.</p><p>I really hope you will understand the concepts of setup monitor tools integration in JVM-related frameworks.</p><h3>Learn More</h3><ul><li><a href="https://enlear.academy/spring-boot-with-amazon-sqs-5f7693314a99">Using AWS SQS With Spring Boot</a></li><li><a href="https://enlear.academy/getting-started-with-springboot-and-mongodb-e96c22c4729f">Getting Started with SpringBoot and MongoDB</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=122613b325d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Service Discovery in Microservices — Spring Boot Web Flux]]></title>
            <link>https://sajithv.medium.com/service-discovery-in-microservices-spring-boot-web-flux-3029f1cf6e68?source=rss-2c6f25c5dd5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3029f1cf6e68</guid>
            <category><![CDATA[webflux]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[eureka]]></category>
            <category><![CDATA[microservices-pattern]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Sajith vijesekara]]></dc:creator>
            <pubDate>Sat, 16 Oct 2021 20:00:19 GMT</pubDate>
            <atom:updated>2021-10-21T09:07:25.989Z</atom:updated>
            <content:encoded><![CDATA[<h3>Service Discovery in Microservices— Spring Boot Web Flux</h3><p>Spring cloud Discovery Server with web flux</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GCIGL-jqDHE7KjA7HaQT_g.jpeg" /></figure><p>As we lest in our last article we are continue the micro-services case study. In this thread we are discussing about the service discovery in micro services.</p><h3>Why Need Service Discovery</h3><p>First why we need service discovery? In the real world when we dealing with communicate with micro services needs to check whether service is up and ruining ? If the service is not reachable we can communicate to other instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*PUOJJPhT55BUNMCx7mCXeg.png" /></figure><p>In above example first instance of service B will be not available to access. So when request originated from service A It will be failed to connect to service B if it access the first instance. So there came up design pattern to keeps the registry of instances in separate server. So that one will give the instance details when connecting to service B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*aj195oo4tuov-7TMFi5vcw.png" /><figcaption>service registry design pattern</figcaption></figure><p>Here when start the Service B instance It will be register in Service Registry. Then there are no hard coded instance details in Service A. It will helps to dynamically connects to the Service B. Assume if the one of the Service B instance got failed, So service registry prevent to connect with that one with Service A.</p><h3>Spring Boot With Netflix Eureka</h3><p>Lets implement the discovery pattern using netflix eureka library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*widwNwnAm1e6u7rogNzAVw.png" /></figure><p>First Our web bff module act as discovery server. These are the main configs changes needs to add to pom.xml &amp; Annotations.</p><p><strong>Web Bff Module</strong></p><p>Dependencies</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d0a4b1a961ddd27279dd30cfd39d96e/href">https://medium.com/media/2d0a4b1a961ddd27279dd30cfd39d96e/href</a></iframe><p>Config Changes</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a285685ea664514c128487ab6f68dd43/href">https://medium.com/media/a285685ea664514c128487ab6f68dd43/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00452b47cf63002ed1c0438e7ee44c03/href">https://medium.com/media/00452b47cf63002ed1c0438e7ee44c03/href</a></iframe><p><strong>Shop Service Module</strong></p><p>Here This module needs to register as eureka client modules. So They will automatically register with the eureka server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c63dccb29591c987fa98b7b0a524add/href">https://medium.com/media/8c63dccb29591c987fa98b7b0a524add/href</a></iframe><p>Here we have to set Application Name &amp; Instance ID for the micro service.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/138367b88a81f07c7e14546aec1dd0a9/href">https://medium.com/media/138367b88a81f07c7e14546aec1dd0a9/href</a></iframe><p>And add following annotation for the spring boot application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b032cba3d69087c2415e3291f38ee45/href">https://medium.com/media/8b032cba3d69087c2415e3291f38ee45/href</a></iframe><p>Those registered micro-services will be display in discovery server admin portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XknE5V9MMKHkxioqPcr86w.png" /></figure><h4>Load Balancing with Webclient</h4><p>Here is the tricky part. Most of the times we are using RestTemplate to connect micro-services. But In this scenario we have to use <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/reactive/function/client/WebClient.html">WebClient</a>.</p><p>Make sure to add spring-cloud-loadbalancer to the Project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/122119857dc781d67ec7a11992c233b4/href">https://medium.com/media/122119857dc781d67ec7a11992c233b4/href</a></iframe><p>And We can’t use @LoadBalanced Annotation as we used in RestTemplate.In Order to use Load Balancing behavior in WebClient needs to use <a href="https://javadoc.io/doc/org.springframework.cloud/spring-cloud-commons/latest/org/springframework/cloud/client/loadbalancer/reactive/ReactorLoadBalancerExchangeFilterFunction.html">ReactorLoadBalancerExchangeFilterFunction</a> class as filter config in WebClient.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa2a060f531550316f18aec2d4c7d26d/href">https://medium.com/media/fa2a060f531550316f18aec2d4c7d26d/href</a></iframe><p>This will demonstrate how to use spring webflux with Spring Cloud Discovery Service.</p><p>Here you can access the code base.</p><p><a href="https://github.com/sajith4u/pet-web-bff">Pet-Web-Bff</a></p><p><a href="https://github.com/sajith4u/pet-shop-service">Pet-Shop-Service</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3029f1cf6e68" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>