<?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 Sriram Kumar Mannava on Medium]]></title>
        <description><![CDATA[Stories by Sriram Kumar Mannava on Medium]]></description>
        <link>https://medium.com/@isriramkumarm?source=rss-b8c75a3d8a50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VPxT1P3ThJLh6WULnYX_-g.jpeg</url>
            <title>Stories by Sriram Kumar Mannava on Medium</title>
            <link>https://medium.com/@isriramkumarm?source=rss-b8c75a3d8a50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:03:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isriramkumarm/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[Running a Native SQL Query after a JPA Save doesn’t work as you expect!]]></title>
            <link>https://isriramkumarm.medium.com/running-a-native-sql-query-after-a-jpa-save-doesnt-work-as-you-expect-f5d63c5248fd?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5d63c5248fd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 04:03:01 GMT</pubDate>
            <atom:updated>2025-07-08T04:29:20.571Z</atom:updated>
            <content:encoded><![CDATA[<p>So the other day, I was working on a functionality that included a mix of Native SQL and JPA. The logic needed to save data and then fetch for further processing.</p><p>I used JPA to save the entities and then followed it up with a SQL query to pull the records for the next steps.</p><p>I tested it with a few use cases that saved one or two records and it worked fine, or so I thought.</p><p>I happily shipped it only to realize later that it didn&#39;t work.</p><p>I spent quite a lot of time trying to understand why it worked at first and didn&#39;t work afterwards, and realized that I overlooked one of the most basic stuff of an ORM - an ORM save doesn&#39;t mean a DB commit!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DMzf5V0_Qreb-T89eHTKow.png" /><figcaption>The above image gives you a simple context of the problem.</figcaption></figure><h3>What went wrong?</h3><p>When you make changes to an entity and then run repository.save(), the ORM doesn&#39;t immediately commit the changes to the database.</p><p>Instead it commits all the changes that have happened inside a Transactional context (@@Transactional) and flushes everything at once when the control moves out of the scope.</p><p>So when you run a Native SQL query that executes on the actual database (not on the ORM context), the changes don&#39;t show up (as was the case with me)</p><h3>How do you solve it then?</h3><p>There a couple of approaches you can follow -</p><h3>Execute flush()</h3><p>Execute a flush() method after the entity changes are saved and before a native SQL is executed. This method forces the ORM to commit all the changes to the database for the subsequent SQL to fetch those updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*du98CQnJygYXiVN_jjSapw.png" /></figure><p>This method is a part of the JpaRepository class, so you can directly call it.</p><h3>Switch to JPQL instead of SQL</h3><p>If possible, use JPQL to construct your query instead of relying on the native SQL to fetch the records. This can ensure that the updates present in the ORM context are present in the query.</p><p>So next time when you&#39;re looking to mix SQL with ORM, keep this mind!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5d63c5248fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is DDD and how does it help?]]></title>
            <link>https://isriramkumarm.medium.com/what-is-ddd-and-how-does-it-help-38d9c98dd18f?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/38d9c98dd18f</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Wed, 02 Jul 2025 03:57:14 GMT</pubDate>
            <atom:updated>2025-07-02T03:57:14.555Z</atom:updated>
            <content:encoded><![CDATA[<p>We developers often hear two acronyms - DDD and [???]</p><h3>What is DDD?</h3><p>DDD stands for Domain Driven Design.</p><p>It is an architectural pattern that helps view a business requirement as a complex real-world problem and breaks it into smaller pieces and solve them into most efficient way.</p><p>It helps bring together Business stakeholders and technologists together for developing a solution that is effective and efficient.</p><h3>What is a Domain?</h3><p>DDD is all about Domains - a Domain is an area of the business interest - Library, Hotels, Transportation etc.</p><p>Then based on the requirement, these domains are divided further into smaller and smaller independent sub domain models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1MGD1zFKnGg4VQONgdrhjg.png" /></figure><p>For example, a Library Management System solution can be made into these domains and be further developed into their own solutions -</p><p>🛑 Core Domain (Heart of the Business Logic)</p><p>Circulation<br>Catalog Management<br>Membership Management</p><p>🟢 Supporting Subdomain</p><p>Reservation System<br>Notification System</p><p>⚪ Generic Subdomain</p><p>Identity and Access<br>Payment Processing</p><p>----</p><p>The smallest possible domain models progress into independent microservices with focused business logic.</p><p>Further, these domains will contain components such as Entities, Aggregates, Value Objects and so on.</p><p>----</p><p>That&#39;s a brief intro to Domain Driven Design.</p><p>Btw, what is the other acronym I was talking about??? 🤔</p><p>Write down in the comments! 👇</p><p>** Image generated from ChatGPT</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38d9c98dd18f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Batching Inserts in Java for Performance]]></title>
            <link>https://isriramkumarm.medium.com/batching-inserts-in-java-for-performance-6c7b795988ef?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c7b795988ef</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 05:30:06 GMT</pubDate>
            <atom:updated>2025-01-30T05:30:06.647Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3XAEDpBPuTfROgWC" /><figcaption>Photo by Jonathan Farber on Unsplash</figcaption></figure><p>When <a href="https://referbruv.com/blog/working-with-stored-procedures-in-aspnet-core-ef-core/">inserting a single entity into a database</a>, executing a simple INSERT statement is sufficient.</p><p>However, when inserting a large list of records, using a loop with executeUpdate is not an efficient approach.</p><p>Each time an INSERT statement is executed, the method commits the transaction. When performed inside a loop, this can significantly impact performance.</p><p>A better alternative is batch insertion.</p><p>In this approach, the list is split into smaller chunks, and each chunk is inserted in a single batch. This reduces the number of database calls and improves overall performance.</p><p>In Java, you can use the batchUpdate method of JdbcTemplate to achieve this.</p><p>There are two main approaches:</p><ol><li>Manually chunking the list into sublists and passing each chunk to batchUpdate inside a loop.</li><li>Using an overloaded batchUpdate method, which takes the entire list, a batch size, and a ParameterizedPreparedStatementSetter.</li></ol><h3>Manual Chunking with BatchPreparedStatementSetter</h3><p>Here we manually chunk the list into sublists and then pass each chunk to the batchUpdate method within a loop.</p><p>The batchUpdate method inserts them, each chunk at once.</p><p>This method takes a parameter of BatchPreparedStatementSetter where the values are set to the insert statement.</p><pre>import org.springframework.jdbc.core.BatchPreparedStatementSetter;<br>import org.springframework.jdbc.core.JdbcTemplate;<br>import org.springframework.stereotype.Repository;<br><br>import java.sql.PreparedStatement;<br>import java.sql.SQLException;<br>import java.util.List;<br><br>@Repository<br>public class StudentRepository {<br><br>    private final JdbcTemplate jdbcTemplate;<br><br>    public StudentRepository(JdbcTemplate jdbcTemplate) {<br>        this.jdbcTemplate = jdbcTemplate;<br>    }<br><br>    public void bulkInsertStudents(List&lt;Student&gt; students) {<br>        String sql = &quot;INSERT INTO students (id, name, age, email) VALUES (?, ?, ?, ?)&quot;;<br><br>        int batchSize = 500;<br>        for (int i = 0; i &lt; students.size(); i += batchSize) {<br>            List&lt;Student&gt; batchList = students.subList(i, Math.min(i + batchSize, students.size()));<br><br>            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {<br>                @Override<br>                public void setValues(PreparedStatement ps, int index) throws SQLException {<br>                    Student student = batchList.get(index);<br>                    ps.setLong(1, student.getId());<br>                    ps.setString(2, student.getName());<br>                    ps.setInt(3, student.getAge());<br>                    ps.setString(4, student.getEmail());<br>                }<br><br>                @Override<br>                public int getBatchSize() {<br>                    return batchList.size();<br>                }<br>            });<br>        }<br>    }<br>}<br></pre><h3>Using ParameterizedPreparedStatementSetter</h3><p>Alternatively, you can use the overloaded batchUpdate method, which accepts the full list, a fixed batch size, and a ParameterizedPreparedStatementSetter.</p><pre>import org.springframework.jdbc.core.JdbcTemplate;<br>import org.springframework.jdbc.core.ParameterizedPreparedStatementSetter;<br>import org.springframework.stereotype.Repository;<br><br>import java.sql.PreparedStatement;<br>import java.sql.SQLException;<br>import java.util.List;<br><br>@Repository<br>public class StudentRepository {<br><br>    private final JdbcTemplate jdbcTemplate;<br><br>    public StudentRepository(JdbcTemplate jdbcTemplate) {<br>        this.jdbcTemplate = jdbcTemplate;<br>    }<br><br>    public void bulkInsertStudents(List&lt;Student&gt; students) {<br>        String sql = &quot;INSERT INTO students (id, name, age, email) VALUES (?, ?, ?, ?)&quot;;<br><br>        int batchSize = 500;<br>        jdbcTemplate.batchUpdate(sql, students, batchSize, (ps, student) -&gt; {<br>            ps.setLong(1, student.getId());<br>            ps.setString(2, student.getName());<br>            ps.setInt(3, student.getAge());<br>            ps.setString(4, student.getEmail());<br>        });<br>    }<br>}<br></pre><h3>Choosing the Right Batch Size</h3><p>One key design decision is selecting an appropriate batch size for inserts.</p><p>Since multiple records are inserted in a single batch, this impacts both memory usage and database constraints on the maximum number of statements allowed in one execution.</p><p>An ideal batch size typically ranges between 500 and 1000, depending on the list size. The total time taken for insertion varies based on this setting.</p><h4>I send one interesting post about topics in software engineering and development every week. Subscribe to my newsletter and stay notified — <a href="https://referbruv.substack.com/">https://referbruv.substack.com/</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c7b795988ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Injecting Services in a Long running async Task in ASP.NET Core]]></title>
            <link>https://isriramkumarm.medium.com/injecting-services-in-a-long-running-async-task-in-asp-net-core-7e2fbfee0537?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e2fbfee0537</guid>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 05:48:24 GMT</pubDate>
            <atom:updated>2025-01-28T05:48:24.833Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes you may want to write an endpoint that does a long running process (A fire and forget call that internally runs a long running Stored Procedure for e.g) on an endpoint hit.</p><pre>// Example: Assuming stored procedure is named &quot;MyStoredProcedure&quot;<br>await dbContext.Database.ExecuteSqlRawAsync(&quot;EXEC MyStoredProcedure&quot;);<br></pre><p>A simple approach to this is to place that database call inside a Task.Run() which runs the call in a separate thread and then let the endpoint return a generic success response.</p><pre>[HttpGet(&quot;run-procedure&quot;)]<br>public IActionResult RunProcedure()<br>    {<br>        Task.Run(async () =&gt;<br>        {<br>            await _myService.RunStoredProcedureAsync();<br>        });<br>}<br></pre><p>But things get messed up when you try to use <a href="https://referbruv.com/blog/understanding-dependency-injection-and-usage-in-aspnet-core/">injected dependencies</a> (a database context for e.g.) inside this Task execution.</p><p>You&#39;ll end up getting this exception -</p><blockquote>Cannot access a disposed object. Object name: &#39;YourDbContext&#39;.</blockquote><p>Why? Because all the dependencies injected via Controller are tied to the Request scope by default, so when you call a database context that is injected via Controller inside your task and then return the response, the Request is disposed and so is the scope.</p><p>So what&#39;s the alternative? Use an IServiceScopeFactory to create a custom scope inside the task and then inject the context from there.</p><pre>using System.Threading.Tasks;<br>using Microsoft.EntityFrameworkCore;<br>using Microsoft.Extensions.DependencyInjection;<br><br>public interface IMyService<br>{<br>    Task RunStoredProcedureAsync();<br>}<br><br>public class MyService : IMyService<br>{<br>    private readonly IServiceScopeFactory _serviceScopeFactory;<br><br>    public MyService(IServiceScopeFactory serviceScopeFactory)<br>    {<br>        _serviceScopeFactory = serviceScopeFactory;<br>    }<br><br>    public async Task RunStoredProcedureAsync()<br>    {<br>        using var scope = _serviceScopeFactory.CreateScope();<br>        var dbContext = scope.ServiceProvider.GetRequiredService&lt;MyDbContext&gt;();<br><br>        // Example: Assuming stored procedure is named &quot;MyStoredProcedure&quot;<br>        await dbContext.Database.ExecuteSqlRawAsync(&quot;EXEC MyStoredProcedure&quot;);<br>    }<br>}<br></pre><p>In this approach, the scope exists until the task is complete and so you won&#39;t encounter this exception again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dD-3BGobHOTUXX36f39RqQ.png" /><figcaption>Long Running Task with DI - Complete Example</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e2fbfee0537" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Kerberos Authentication and How does it work?]]></title>
            <link>https://isriramkumarm.medium.com/what-is-kerberos-authentication-and-how-does-it-work-f67a7f31e8b2?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/f67a7f31e8b2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 06:36:52 GMT</pubDate>
            <atom:updated>2024-10-30T06:36:52.554Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DkJTqaXkNYDCpVit" /><figcaption>Photo by Sebastian Knoll on Unsplash</figcaption></figure><p>Kerberos authentication is one of the most popular authentication mechanisms</p><p>It is widely used in enterprise environments for authenticating user access to secured services.</p><h3>How does Kerberos work?</h3><p>Kerberos uses a Key Distribution Centre (KDC) for functioning, which contains two parts - an Authentication Server (AS) and a Ticket Granting Server (TGS)</p><p>Kerberos authentication works in a 3-step process.</p><p>1. Client requests the KDC for an Authentication Ticket by entering its username and password (kinit command). KDC contains the database of usernames and passwords<br>2. KDC authenticates the credentials and returns a Ticket Granting Ticket (TGT) to the client. This contains a session key and is cached on the client machine.<br>3. When the client wants to access a secured service, it sends its TGT to the Token Server (TGS) and requests a Service Ticket (ST) that authorizes access to that service.</p><p>TGS provides the client with a Service Ticket, which the client can then pass to the secured service for access.</p><p>The Tickets issued in Kerberos are short-lived, hence will expire after a while.</p><h3>Advantages of Kerberos Authentication</h3><p>• Enhanced Security by using encrypted credentials and tickets<br>• Authenticates only once to get a TGT followed by multiple requests for STs as a part of Single Sign On.<br>• Scalable to use in large networks and complex enterprise environments.<br>• Can work with different systems such as Windows AD, allowing for cross platform authentication.</p><p>That&#39;s a brief overview about Kerberos and how it works.</p><p>Do you use Kerberos for your authentication mechanisms?</p><p>Let me know. Please do share if you find it informative.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f67a7f31e8b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of a HTTP Request in a RESTful Architecture]]></title>
            <link>https://isriramkumarm.medium.com/basics-of-a-http-request-in-a-restful-architecture-154587c4543c?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/154587c4543c</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 06:05:21 GMT</pubDate>
            <atom:updated>2024-07-04T06:05:21.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n7kr1AcGyb8WPhul" /><figcaption>Photo by Andrew Dunstan on Unsplash</figcaption></figure><p>If you are a full stack developer, or a front-end developer who develops client server interactions, it is highly important that you should know how a REST API works and what all components are there with it.</p><p>In simple words, a RESTful API is a server API that is built using REST architecture. REST stands for Representative State Tranfer, it is an architecture on which such APIs can be built and exposed for consumption.</p><p>Generally we expose such APIs over HTTP/S, where the requests are transmitted over the network via TCP/IP.</p><p>A client builds a HTTP Request and sends to the RESTful API, which returns a HTTP Response.</p><p>A simple HTTP Request contains the following parts -</p><p>A HTTP Verb, that describes what type of operation it is - GET, POST etc</p><p>URL of the API endpoint where you want to send the request.</p><p>HTTP Request Headers which describe the metadata information about the request. For example, a contentType application/json indicates that the request body contains JSON data</p><p>Finally the actual Request Body that has the content to be transmitted, or an empty body when there is nothing to send.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*bYi-azRRu1mkA-xDtvl5PQ.png" /></figure><p>On the server side, the endpoint that is listening for such requests, receives this request, understands what is to be done based on the Verb and the Headers and processes it followed by response.</p><p>That&#39;s a simple introduction to the anatomy of a HTTP Request and the RESTful architecture.</p><p>Share it with your friends if you find it useful, it helps me reaching more people.</p><p>--------------------</p><p>Hello there 👋, I&#39;m <a href="https://www.linkedin.com/in/isriramkumarm">Sriram Kumar Mannava</a></p><p>I&#39;m a full-stack developer, and I can help you jumpstart into software engineering by sharing various useful concepts in a simple way, based on my experience 😁🔥</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=154587c4543c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Pagination and Why Do You Need It?]]></title>
            <link>https://isriramkumarm.medium.com/what-is-pagination-and-why-do-you-need-it-30b0600584c8?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/30b0600584c8</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 06:42:56 GMT</pubDate>
            <atom:updated>2024-06-20T06:42:56.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ksSC2mjWC856ZrXc" /><figcaption>Photo by Roman Trifonov on Unsplash</figcaption></figure><p>Imagine you&#39;re building a dashboard that displays a series of records or a long list of entries fetched from the database for users to interact with.</p><p>It&#39;s a poor user experience and a performance overhead to display all the records upfront on the user&#39;s screen at once — it&#39;s slow and difficult for users to comprehend.</p><p>An alternative approach is to show a portion of the total information that the user needs to see and then allow them to navigate through the records as needed. This concept is similar to how content is organized into different pages in a book, rather than printing everything on a single, long scroll of paper!</p><p>This approach is called Pagination, and it&#39;s a common performance optimization technique applied to APIs that return large datasets from backend systems.</p><p>Instead of pulling the entire dataset from the backend and then applying pagination on the frontend system, it&#39;s better to handle pagination at the API level and let the frontend pass parameters to fetch specific pages.</p><p>This is known as <a href="https://referbruv.com/blog/implementing-pagination-in-aspnet-core-web-api-and-entity-framework-core/">server-side pagination</a>.</p><h3>So, How do you implement it?</h3><p>Even with server-side pagination, there are various approaches depending on how you interact with the database.</p><p>For instance, you can use <a href="https://referbruv.com/blog/implementing-pagination-in-aspnet-core-web-api-and-entity-framework-core/">LINQ extension methods</a> on database entities to query and retrieve a particular page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PR8UNCv5GnbLRZjc6U7bPg.png" /></figure><p>Here, you&#39;ll use the Skip() and Take() methods together to skip to a specific page of records and fetch a specified number of records.</p><p>By the way, a &#39;page&#39; refers to a chunk of records based on the total record count present in the database divided into a fixed size.</p><p>Alternatively, you can also use an SQL approach where you pass paging parameters and let the pagination occur via SQL query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmGlQDa1FClDCxzculcZFA.png" /></figure><p>The above SQL Server query exactly replicates the approach that LINQ uses.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30b0600584c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka Topics, Partitions, and Offsets]]></title>
            <link>https://isriramkumarm.medium.com/kafka-topics-partitions-and-offsets-c5b563e604f9?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5b563e604f9</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Fri, 31 May 2024 05:23:44 GMT</pubDate>
            <atom:updated>2024-05-31T05:23:44.869Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EmntR9ur13yPv3UI" /><figcaption>Photo by Daria Nepriakhina 🇺🇦 on Unsplash</figcaption></figure><p>Topics and Partitions are core to how data is written to and maintained in a Kafka cluster.</p><p>A Producer is any service that writes to a Kafka topic, and a Consumer is any service that reads from the topic.</p><h3>What Exactly are Kafka Topics and Partitions?</h3><p>A Topic is a dedicated space where applications can write to and read messages from. Think of it like an individual folder in a file system where you can store and retrieve data from.</p><p>But since Kafka is highly distributed and available, a single topic can have multiple partitions, where individual messages can be placed.</p><p>Let&#39;s say you have a Kafka cluster running with 3 partitions, and there&#39;s a topic called myTopic where data is being written to - you have these messages spread across all the 3 partitions from which other services subscribed to this topic can read.</p><p>You can specify to which partition your message should be written, or let Kafka decide it.</p><h3>Why Do Partitions Matter?</h3><p>They provide parallel read operations from the consumer side, which helps in reading data faster and can scale with the number of consumer instances reading.</p><h3>What is an Offset?</h3><p>An offset is a sequence number given to a message written inside a partition. This can tell us to what extent messages have been written to the topic partition, and how many have been read so far (on the consumer side).</p><p>That&#39;s a brief explanation about Topics, Partitions, and Offsets you need to know to get started with Kafka!</p><p>Found this helpful? Please like and share.</p><p>I&#39;m going to write a few more briefs around Kafka so that more people can benefit from it. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5b563e604f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Kafka, and why might you need to know about it?]]></title>
            <link>https://isriramkumarm.medium.com/what-is-kafka-and-why-might-you-need-to-know-about-it-5c6bebedc813?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c6bebedc813</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Thu, 30 May 2024 05:31:55 GMT</pubDate>
            <atom:updated>2024-05-30T05:31:55.209Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rG6cUlFlqpEL8s8F" /><figcaption>Photo by Kristina Tripkovic on Unsplash</figcaption></figure><p>Decoupling service interactions and asynchronous communication is core to building a microservices architecture.</p><p>In simple terms - if you have a UserService that signs up a user and then calls an EmailService that sends out a welcome email to the new user, then the UserService should not wait for the EmailService to complete its operation.</p><p>Instead, this operation sequence is split into two different workflows, and each service works on its own without waiting for the other to complete.</p><p>This approach is also called Event-Driven Architecture, where services communicate with each other via events and notifications.</p><p>But there should be a way for the EmailService to know that there is a job waiting for it to do, right?</p><p>Message Queues help create that common space, to which different services can write their requests, and others can pick them up from that space.</p><p>But Kafka isn&#39;t just such a component - in fact, it doesn&#39;t even work like one.</p><p>Official documentation explains Kafka as a distributed, partitioned, replicated commit log service.</p><p>Kafka runs as a clustered service with many nodes, each containing different partitions.</p><p>It also employs mechanisms to provide a highly reliable and scalable communication system for large-scale architectures.</p><p>Now, UserService can write a job request to a particular space within Kafka, called a Topic, and the EmailService receives the request and can work on it independently.</p><p>That&#39;s a high-level introduction to Kafka for absolute beginners.</p><p>I hope you found it informative. Please do like and share so that it can reach more people.</p><p>I&#39;m going to write a few more briefs around Kafka so that more people can benefit from it.</p><p>Hello there, I&#39;m Sriram Kumar Mannava.</p><p>I&#39;m a full-stack developer, and I can help you jumpstart into software engineering by sharing various useful concepts in a simple way, based on my experience.</p><p>If you&#39;re interested, please do follow me and stay notified.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c6bebedc813" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Numeric Types and Lossy Conversions in Java]]></title>
            <link>https://isriramkumarm.medium.com/managing-numeric-types-and-lossy-conversions-in-java-ab518733e07e?source=rss-b8c75a3d8a50------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab518733e07e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Sriram Kumar Mannava]]></dc:creator>
            <pubDate>Wed, 03 Apr 2024 05:40:42 GMT</pubDate>
            <atom:updated>2024-04-03T05:52:26.239Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q1PoFsY8beXrkjS3" /><figcaption>Photo by Santiago Lacarta on Unsplash</figcaption></figure><p>Java manages numeric literals in an interesting way. There are 4 datatypes to store whole numbers - byte, short, int and long.</p><p>when you compare the sizes, each can accommodate numbers ranging from 2⁷ (byte) to 2⁶⁴ (long)</p><p>However, by default Java tries to fit the number literal into the target type, although technically the value may not be that time.</p><p>For example, the below statement works without any issue -</p><pre>long myVar = 235;<br></pre><p>Although this is syntactically correct, it&#39;s technically wrong, because we&#39;re trying to put an integer into a long type.</p><p>The size of an int type is 2³², while that of a long is 2⁶⁴. Since the value falls within the range of the long type, it works.</p><p>On the contrary, if we try to fit a larger value into a smaller type, it&#39;d throw an error.</p><p>For example, the below statement doesn&#39;t work.</p><pre>byte myByte = 200;<br></pre><p>This statement results in an error - incompatible types: possible lossy conversion from int to byte</p><p>This is called a lossy conversion. To circumvent this situation, we can use type casting to fit a larger size type to a smaller size type.</p><pre>int myVar = 128;<br>byte myByte = (byte)myByte;<br></pre><p>The output for myByte will be -127, because the value has actually overflown the max bounds of the byte type (-127, 127).</p><p>If a value goes beyond the limit bounds of a type, Java flips it to the other side of the bounds.</p><p>This is called wraparound vulnerability that is a known thing in Java terms.</p><h3>Summary</h3><p>Type conversions are an interesting but tricky part in any programming language. Java provides 4 primitive types to just store numbers, and each of these types have their own sizes and limits.</p><p>But since all of these are whole number literals, Java tries to smartly fit into the target type whatever we assign to it. By default it treats all the numbers as integers and fits into variables of even larger or smaller types.</p><p>But when you try to fit a larger value into a smaller value, you&#39;re doing a lossy conversion and Java throws an error for it.</p><p>downward type casting works, but you will still loose data and overflow condition will occur.</p><p><strong><em>Get delicious Indian delights and groceries delivered home quickly! Use promo code WELCOME24 and Enjoy a fantastic 10% discount on all Quicklly transactions. Checkout </em></strong><a href="https://www.quicklly.com/"><strong><em>quicklly.com</em></strong></a><strong><em> for more!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab518733e07e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>