<?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 Arup Mishra on Medium]]></title>
        <description><![CDATA[Stories by Arup Mishra on Medium]]></description>
        <link>https://medium.com/@arupmishra91?source=rss-53a369f3d73b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YBAI97j2kakvSrGE</url>
            <title>Stories by Arup Mishra on Medium</title>
            <link>https://medium.com/@arupmishra91?source=rss-53a369f3d73b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:11:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arupmishra91/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[AWS SQS as Messaging Queue In Spring Boot]]></title>
            <link>https://arupmishra91.medium.com/aws-sqs-as-messaging-queue-in-spring-boot-58c60b9d2fbf?source=rss-53a369f3d73b------2</link>
            <guid isPermaLink="false">https://medium.com/p/58c60b9d2fbf</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[message-queue]]></category>
            <category><![CDATA[aws-sqs]]></category>
            <dc:creator><![CDATA[Arup Mishra]]></dc:creator>
            <pubDate>Thu, 05 Nov 2020 19:29:49 GMT</pubDate>
            <atom:updated>2026-05-31T06:48:20.074Z</atom:updated>
            <content:encoded><![CDATA[<p>Messaging queues are a basic de-facto when it comes in handling asynchronous operations. We will try to achieve communication using AWS SQS in Spring Boot</p><p><strong>What is a Messaging Queue?</strong></p><p>A Messaging Queue can be thought of as a container which holds messages in either ordered or un-ordered manner. It does the basic push and pop operations on the messages.</p><p>Note, a message queue is different than message brokers. Message queue present in market is ActiveMQ, RabbitMQ, etc, whereas Apache Kafka is a message broker.</p><p><strong>Why do we need a Messaging Queue?</strong></p><p>Messaging queues help in establishing asynchronous communication between services. Services can communicate with the queue for publishing and consuming messages instead of each other.</p><p><strong>What is AWS SQS?</strong></p><p>AWS SQS (Simple Queue Service) is an AWS hosted and managed queue service which provides all the MQ (Message Queue) capabilities to decouple micro-services, distributed systems and serverless applications.</p><p>SQS provides two types of messaging queues :</p><ol><li>FIFO Queue (First In First Out Order)</li><li>Standard Queue (Best Effort Ordering)</li></ol><p><strong>Basic Attributes of an SQS Queue :</strong></p><p><strong>Naming:</strong> A FIFO queue can be identified with the name having an extension of <em>“.fifo”, </em>else it is a Standard Queue</p><p><strong>Visibility Timeout:</strong> This is the length of time that a message received from a queue (by one consumer) will not be visible to the other message consumers. This can be from 0 seconds to max 12 hours.</p><p>Basically this means, once a message has been popped out of the queue, it will be visible to the consumer only who requested it and will not be visible for the configured time to anyone else. Once, the time period is completed the message goes back to the queue.</p><p><strong>Message retention period: </strong>This is the time period till which the message will be retained in the queue. This can be between 1 minute to max 4 days.</p><p>Say, we send a message to the queue, then the message will be retained in the queue for the configured retain period and after that it will be automatically deleted.</p><p><strong>Delivery delay: </strong>This is the time period which states that after you make a send message call to queue, the message will be physically present after a certain delay. This can be configured to be in between 0 seconds to 15 minutes.</p><p><strong>Maximum message size: </strong>This is self explanatory. The message size can be configured in between 1 KB to 256 KB.</p><p><strong>Receive message wait time: </strong>This is the maximum amount of time that polling or consumer will wait for messages to become available to receive. The time period is configurable between 0 seconds to 20 seconds</p><p><strong>Content Based Deduplication:</strong> This is an optional configuration only for FIFO queues. If this is enabled, it makes message de-duplication optional.</p><p>We will keep this out of scope for this blog.</p><p><strong>Dead Letter Queue: </strong>This is one of the features AWS SQS provides which helps in moving trouble-some messages automatically.</p><p>Let’s say, a message in the queue is unable to get processed due to some faulty message content and keeps on failing. This message can be moved into a separate queue after some particular retries and can be debugged separately.</p><p>We can define a DLQ similar to creating a Standard / FIFO queue and assign it to the primary queue as a DLQ and define the number of receives after which messages should be moved from primary queue to DLQ.</p><p><strong>Messages in Queue:</strong></p><p>Both FIFO / Standard Queue messages have few common properties -</p><p><strong>Body</strong>: Here the message content is sent</p><p><strong>Message Attributes</strong>: Optional Key-Value pairs can be sent along-with the message body</p><p><strong>Delivery Delay</strong>: This can be configured only while producing Standard Queue messages.</p><p><strong>Message group ID</strong>: This is a property only for FIFO messages and has to be provided some value. Messages are ordered in FIFO queues based on group ids.</p><p><strong>Message deduplication ID</strong>: This is also specific to FIFO messages only. This is optional, if Content-Based Deduplication is enabled.</p><p>In SQS, if the same message with same group id is coming within an interval of 5 mins to the queue, the message does not get stored.</p><p>So, message deduplication values help in differentiating between the messages. If content-based deduplication is enabled, it will ignore if no value present.</p><p><strong>Code Sample</strong></p><p>In this code sample, we used the below configurations :</p><ol><li>Java 8</li><li>Spring Boot 2.3.5</li><li>AWS Account (<a href="https://aws.amazon.com/sqs/">https://aws.amazon.com/sqs/</a>)</li><li>Gradle</li></ol><p>So, for this example, let us see the basic gradle dependencies required. You can either create a sample spring boot project from <a href="https://start.spring.io/">spring-initializer</a> or setup manually.</p><p>So, “build.gradle” should look like this below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac2f3d65ef80250a2d85c282a34df518/href">https://medium.com/media/ac2f3d65ef80250a2d85c282a34df518/href</a></iframe><p>Now, let us have the configuration ready to communicate with AWS services.</p><p>In Spring Boot, it is pretty easy to setup a SQSClient. We have to define few property values.</p><p>So, our “application.yml” should look something like this -:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56d98b3a5a7a33a32b5ddbaaf639416a/href">https://medium.com/media/56d98b3a5a7a33a32b5ddbaaf639416a/href</a></iframe><p>In the above, we define the IAM programmatic keys and the region to communicate with the SQS.</p><p>We have asked specifically here to pick the credentials from the yml file, so the <strong>instance-profile</strong> and <strong>use-default-aws-credentials-chain</strong> has been set to false.</p><p>After this, in our main application class, we add the EnableSQS annotation and exclude the ContextInstanceDataAutoConfiguration from autoloading.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce10ebffc4560512ac4d0affcf7dbf29/href">https://medium.com/media/ce10ebffc4560512ac4d0affcf7dbf29/href</a></iframe><p>Our code is now ready for communication with AWS SQS. We can now use the “<strong>AmazonSQSAsync”</strong> client for performing all the operations with our AWS SQS.</p><p>Let us go ahead and create the queues for further operations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba4152c80408ae4eec76f9c371ea9e0b/href">https://medium.com/media/ba4152c80408ae4eec76f9c371ea9e0b/href</a></iframe><p>So, If we notice above there are 2 additional attributes between creating a FIFO queue and Standard Queue.</p><p>In the FIFO Queue, we have enabled the <strong><em>ContentBasedDeduplication</em></strong>. We will see how it behaves later.</p><p>When a queue is created, the <strong><em>CreateQueueResult</em></strong> holds the queue url through which we can communicate to send or receive messages.</p><p>Now we can publish and receive messages with the queues we just created. Spring Boot provides <strong><em>QueueMessagingTemplate</em></strong> for publishing and consuming messages from SQS. In this blog, we will use that for our purpose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/740ea97b9cd4b1162e18756e07e89db2/href">https://medium.com/media/740ea97b9cd4b1162e18756e07e89db2/href</a></iframe><p>We have to define the <strong>QueueMessagingTemplate</strong> bean for using it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d451b42036cea969c99afb2b6fb7d9e2/href">https://medium.com/media/d451b42036cea969c99afb2b6fb7d9e2/href</a></iframe><p>Now, above code sends messages to a FIFO queue and one to the Standard Queue. We notice that for sending message to the FIFO queue we need few headers to avoid sending failures.</p><p>We can also send message attributes in the headers as key-value pairs along with the message.</p><p>Now, we will consume the messages sent to the queue and it will be an active listener method. We will use the <strong><em>SQSListener</em></strong> annotation provided by Spring Boot on our listener method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1172c468edf54117b5e988adce94d026/href">https://medium.com/media/1172c468edf54117b5e988adce94d026/href</a></iframe><p>Here, we have added listeners each for FIFO queue and Standard Queue. As soon as a message is available in the Queues, it will be consumed by these listeners.</p><p>Note, there is a deletion policy mentioned which has been set to <strong>“Never”</strong>. It means once, the acknowledgement is manually done then only the message will be removed else it will return back to the queue after the visibility timeout happens for the message.</p><p>We have different set of Deletion policies which we can use for separate use-cases.</p><p>Finally, let us see how we can delete the queues.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5f83395e5f36122e153aa7283f42956/href">https://medium.com/media/e5f83395e5f36122e153aa7283f42956/href</a></iframe><p><strong>Advantages of using AWS SQS as Messaging Queue</strong></p><ol><li>All Message Communication happens through HTTP</li><li>Security, Availability and Customisation becomes easier</li><li>DLQs can be configured for faulty message processing</li><li>AWS Lambda functions can be integrated with SQS</li><li>Responsibility of managing queue service is handed to cloud and focus can be pertained for communication</li><li>Faster message processing and option of choosing between ordered and non-ordered queues</li></ol><p><strong>Conclusion</strong></p><p>We noticed how we can use AWS SQS as a messaging queue and how to use it using spring boot. It is pretty easy to configure and spring boot provides out-of-box features to support the same.</p><p>The full code is available <a href="https://github.com/arup91/sqs-demo">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5cab3d2f1fd02815f4f7e243beb83690/href">https://medium.com/media/5cab3d2f1fd02815f4f7e243beb83690/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58c60b9d2fbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Example of Spring Boot Microservice using Istio as Service Mesh]]></title>
            <link>https://arupmishra91.medium.com/basic-example-of-spring-boot-microservice-using-istio-as-service-mesh-673073dcab07?source=rss-53a369f3d73b------2</link>
            <guid isPermaLink="false">https://medium.com/p/673073dcab07</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[istio-service-mesh]]></category>
            <dc:creator><![CDATA[Arup Mishra]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 06:44:34 GMT</pubDate>
            <atom:updated>2020-11-09T13:25:34.861Z</atom:updated>
            <content:encoded><![CDATA[<p>I searched a lot for some basic examples of Istio service mesh with Spring Boot, but was of no avail. So, in this blog have tried to cover it.</p><p><strong>What does a service mesh do?</strong></p><p>A <strong>service mesh</strong>, like the open source project Istio, is a way to control how different parts of an application share data with one another. Unlike other systems for managing this communication, a <strong>service mesh</strong> is a dedicated infrastructure layer built right into an app.</p><p><strong>What is Istio?</strong></p><p>Istio makes it easy to create a network of deployed services with load balancing, service-to-service authentication, monitoring, and more, with few or no code changes in service code. You add Istio support to services by deploying a special sidecar proxy throughout your environment that intercepts all network communication between microservices, then configure and manage Istio using its control plane functionality.</p><p><strong>Istio Architecture -:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHSq6_HLGTp7gM28vm_l4Q.png" /></figure><p>Now, we know some basics about Istio, let us try implementing it in Spring Boot.</p><p><strong>Prerequisites -:</strong></p><ol><li>Docker</li><li>Kubernetes</li><li>Spring Boot</li><li>Maven</li><li>Istio</li></ol><p><strong>Creating the Micro-services using Spring Boot</strong></p><p>Generate the project using Spring Initialzr or the CLI and add Spring-web-starter as dependency.</p><p>We will create 2 micro-services to be deployed separately. Both the services will have 2 endpoints each, one to call each other and another for gateway calls</p><figure><img alt="Folder Structure" src="https://cdn-images-1.medium.com/max/247/1*fNKaFjSZGpdyC8ovO6p-dg.png" /><figcaption>Folder Structure</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f204215ca39f19bb8bf00dcde4e903c4/href">https://medium.com/media/f204215ca39f19bb8bf00dcde4e903c4/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef122e7894b244e75cb13ae4cf2c8cd9/href">https://medium.com/media/ef122e7894b244e75cb13ae4cf2c8cd9/href</a></iframe><p>Now, we will containerize it and deploy in our kubernetes cluster.</p><p>I used the command to containerize my services and deploy it in docker -hub</p><pre>mvn com.google.cloud.tools:jib-maven-plugin:build -Dimage=&lt;{docker-id}/{image-name}&gt;</pre><p>Once, it is deployed we can now go ahead and deploy the application in kubernetes.</p><p>First we will apply the manifest and set the profile in demo mode for istio.</p><p>Open a terminal in the istio installation path and use the below command -:</p><pre>istioctl manifest apply --set profile=demo</pre><p>Now, we will create a label namespace and instruct istio to deploy envoy proxies when application starts</p><pre>kubectl label namespace default istio-injection=enabled</pre><p>Now, lets deploy the applications using the yaml files -:</p><p>We will create a folder and name it <strong><em>kube</em></strong> and keep the yaml files in it for easy deployment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6143e848a6a9210aab0a4134d9d2243a/href">https://medium.com/media/6143e848a6a9210aab0a4134d9d2243a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2be306a794e97a255bb3a115314c35ba/href">https://medium.com/media/2be306a794e97a255bb3a115314c35ba/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5cab3d2f1fd02815f4f7e243beb83690/href">https://medium.com/media/5cab3d2f1fd02815f4f7e243beb83690/href</a></iframe><p>We created a gateway for incoming traffic coming outside of the mesh.</p><p>Now lets deploy all of them by using —</p><pre>kubectl apply -f kube</pre><p>This will deploy all the microservices and create gateway for incoming traffic.</p><p>We can check if all pods are running by kubectl get pods.</p><p>If the pods are in running state, determine the ip and the port using the commands -:</p><p>Determine the IP using -:</p><pre>(kubectl -n istio-system get service istio-ingressgateway -o jsonpath=’{jsonpath=’{.status.loadBalancer.ingress[0].hostname}’)</pre><p>Determine the http port -:</p><pre>(kubectl -n istio-system get service istio-ingressgateway -o jsonpath=’{jsonpath=’{.spec.ports}’)</pre><p>This will give all the ports. Check for http2 and use the target port.</p><p>Now, just use the ip and port to access the application like -</p><pre><a href="http://localhost/service-1">http://localhost/service-1</a> or <a href="http://localhost:service-2">http://localhost:service-2</a></pre><p>The full source code is present in <a href="https://github.com/arup91/spring-boot-with-istio">here</a> .</p><p>Hope, I was able to help you. If, any questions or suggestions please drop a comment as this is my first article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=673073dcab07" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>