<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Guneet Nagia</title>
    <description>The latest articles on DEV Community by Guneet Nagia (@guneet_08).</description>
    <link>https://dev.to/guneet_08</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2894390%2F4ec3217f-3399-4e08-a76a-13c67177b626.png</url>
      <title>DEV Community: Guneet Nagia</title>
      <link>https://dev.to/guneet_08</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/guneet_08"/>
    <language>en</language>
    <item>
      <title>Connecting Independent Services Without Tight Coupling: 3 Message Infrastructure Patterns</title>
      <dc:creator>Guneet Nagia</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:51:08 +0000</pubDate>
      <link>https://dev.to/guneet_08/patterns-messaging-publisher-subscriber-dynamic-routing-2oig</link>
      <guid>https://dev.to/guneet_08/patterns-messaging-publisher-subscriber-dynamic-routing-2oig</guid>
      <description>&lt;p&gt;How messaging, publisher-subscriber, and dynamic routing let independently built services cooperate reliably, without knowing each other's location, identity, or interface.&lt;/p&gt;

&lt;p&gt;Why a Message Infrastructure Layer?&lt;/p&gt;

&lt;p&gt;When services call each other directly, each caller must know the callee's address, interface, and availability. Multiply that by dozens of services and you get a web of dependencies where every change is risky. A message infrastructure layer moves that knowledge out of the services and into shared infrastructure, so services can evolve, scale, and be reused independently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Pattern 1: Messaging pattern&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt;&lt;br&gt;
Some distributed systems are composed of services that were developed independently. To form a coherent system, however, these services must interact reliably, without incurring overly tight dependencies on one another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
Integrating independently developed services, each having its own business logic and values, into a coherent application requires reliable connection between services. However, since services are developed independently, they are generally unaware of each other's specific functional interfaces. Furthermore, each service may participate in multiple integration contexts, so using them in specific context should not preclude their use in other contexts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br&gt;
connecting these services via message bus allow them to transfer data messages asynchronously. Encode the message (request data and data types) so that senders and receivers can communicate reliably without having to know all the data type information statically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fglagb8xk403kehwc5o5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fglagb8xk403kehwc5o5o.png" alt=" " width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benefit&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service can interact without having to deal with networking and service location concerns.&lt;/li&gt;
&lt;li&gt;Asynchronous messages allows services to handle multiple requests simultaneously without blocking.&lt;/li&gt;
&lt;li&gt;Allow service to participate in multiple application integration and usage contexts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Liability&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lack of statically typed interfaces makes it hard to validate system behaviour prior to runtime.&lt;/li&gt;
&lt;li&gt;Service requests are encapsulated within self-describing messages that require extra time and space for message processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Pattern 2:Publisher-Subscriber pattern&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
Components in some distributed application are loosely coupled and operate largely independently. If such application needs to propogate information to some or all theirs components, a notification mechanism is needed to inform the components about the state changes or event that affect or coordinate their own computation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
The notification system should not couple applications too tightly or they will loose their independence. Components want to know only that  other component is in specific state, not which specific component is involved. Components that disseminate events often do not care which component want to receive the information. Components should not depend on how other components can be reached or on their specific location in the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br&gt;
Define a change propagation infrastructure that allow publisher in a distributed application to disseminate events that may be interest to others. Notify subscriber events in those events whenever such events  is published.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgy4vg8z6u7m1fzj2luza.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgy4vg8z6u7m1fzj2luza.png" alt=" " width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benefit&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Publisher can asynchronously transmit events to subscribers without blocking.&lt;/li&gt;
&lt;li&gt;Asynchronous communication decouples Publisher from Subscribers, allowing them to be active and available at different times.&lt;/li&gt;
&lt;li&gt;Publisher and Subscriber are unaware of each other's location and identity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Liability&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Publisher can cause unnecessary overhead if subscribers are interested in only a specific type of events.&lt;/li&gt;
&lt;li&gt;Filtering events to decrease event publishing and notification overhead can result in other costs (eg: decrease in throughput, unnecessary notifications, breakdown of anonymous communication model). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Pattern 3: Dynamic Routing pattern&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
It is often complex to build complex business processes by wiring together a set of relatively simple services in a dynamic way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
Routing messages through a distributed system based on filtering rules is inefficient because messages are sent to every destination's filter and router for inspection and rules resolution, whether or not messages could be processed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br&gt;
Define a message router that includes both filtering rules and knowledge about the processing destination paths so that messages are delivered only to processing endpoints that can act on them. Unlike filters, message router do not modify the message content and are concerned only with message destination.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdix6z89gzmmdt5ymaytu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdix6z89gzmmdt5ymaytu.png" alt=" " width="799" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benefit&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Services do not need to deal with networking concerns or know each other's location since all requests are handled through message router.&lt;/li&gt;
&lt;li&gt;Communication can be optimised as services dynamically became available or unavailable.&lt;/li&gt;
&lt;li&gt;Efficient or predicate routing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Liability&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance overhead.&lt;/li&gt;
&lt;li&gt;Single point of failure.&lt;/li&gt;
&lt;li&gt;Potentially complex, unintuitive behaviour when rules conflict.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>architecture</category>
      <category>microservices</category>
      <category>distributedsystems</category>
      <category>designpatterns</category>
    </item>
    <item>
      <title>Real-Time Data Streaming with Spring WebFlux and SSE</title>
      <dc:creator>Guneet Nagia</dc:creator>
      <pubDate>Sat, 22 Feb 2025 12:50:56 +0000</pubDate>
      <link>https://dev.to/guneet_08/real-time-data-streaming-with-spring-webflux-and-sse-1obk</link>
      <guid>https://dev.to/guneet_08/real-time-data-streaming-with-spring-webflux-and-sse-1obk</guid>
      <description>&lt;p&gt;I recently built a real-time data streaming solution using Spring WebFlux and Server-Sent Events (SSE) to push short bursts of data to customers via an API. Here’s why it worked and how it stacks up.&lt;/p&gt;

&lt;p&gt;I needed a lightweight, secure way to deliver short-duration updates. SSE won over alternatives:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vs. Kafka/Pulsar&lt;/strong&gt;: Too heavy for my needs—SSE is simpler, no broker required.&lt;br&gt;
&lt;strong&gt;Vs. Long Polling&lt;/strong&gt;: Less efficient—SSE uses one connection, not constant requests.&lt;br&gt;
&lt;strong&gt;Vs. WebSockets&lt;/strong&gt;: Overkill for one-way data—SSE is simpler and secure by design.&lt;/p&gt;

&lt;p&gt;SSE shines because it’s:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lightweight&lt;/strong&gt;: Runs on HTTP, low overhead.&lt;br&gt;
&lt;strong&gt;Great for Short Bursts&lt;/strong&gt;: Perfect for event-driven updates.&lt;br&gt;
&lt;strong&gt;Simple&lt;/strong&gt;: Easy to set up and use.&lt;br&gt;
&lt;strong&gt;Secure&lt;/strong&gt;: One-way flow plus custom logic (e.g., auth, filtering).&lt;br&gt;
&lt;strong&gt;Scalable&lt;/strong&gt;: Handles concurrency well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spring WebFlux Boost
&lt;/h2&gt;

&lt;p&gt;Spring WebFlux made it real-time and scalable:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reactive&lt;/strong&gt;: Non-blocking, ideal for streaming.&lt;br&gt;
&lt;strong&gt;Scalable&lt;/strong&gt;: Manages tons of connections effortlessly.&lt;br&gt;
&lt;strong&gt;Flexible&lt;/strong&gt;: Easy to add auth and filtering.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;Customers hit an API, get authenticated, and receive filtered, real-time data over SSE. It’s fast, secure, and scales with WebFlux’s reactive power.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use It
&lt;/h2&gt;

&lt;p&gt;SSE is best for one-way, short-burst updates. Need two-way? Try WebSockets. Big data pipelines? Kafka or Pulsar. For my case, SSE nailed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;Spring WebFlux + SSE = a clean, efficient streaming solution. Try it if you need simple, real-time data delivery.&lt;/p&gt;

&lt;p&gt;Thoughts? Share below!&lt;/p&gt;

</description>
      <category>webflux</category>
      <category>sse</category>
      <category>realtime</category>
    </item>
    <item>
      <title>Seamless Database Migration in a Microservices Architecture: Cloud-Native, Event-Driven Strategies</title>
      <dc:creator>Guneet Nagia</dc:creator>
      <pubDate>Sat, 22 Feb 2025 12:23:36 +0000</pubDate>
      <link>https://dev.to/guneet_08/seamless-database-migration-in-a-microservices-architecture-cloud-native-event-driven-strategies-2gm0</link>
      <guid>https://dev.to/guneet_08/seamless-database-migration-in-a-microservices-architecture-cloud-native-event-driven-strategies-2gm0</guid>
      <description>&lt;p&gt;Downtime during a database migration can tank a production app—trust me, I’ve been there. As a solution design, I tackled this head-on, designing a cloud-native, event-driven solution using Kafka, AWS, and microservices. Stick around to see how I replaced DynamoDB with MongoDB without breaking a sweat.&lt;/p&gt;

&lt;p&gt;Here’s how I tackled this at scale: a phased, zero-downtime migration using AWS, Kafka, and event-driven microservices. Check out this diagram for the flow:&lt;/p&gt;

&lt;p&gt;The approach introduces an abstraction layer between services and databases, leveraging Kafka for event-driven reliability. Here’s how it works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9leatad4psd3z9qipcx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9leatad4psd3z9qipcx4.png" alt="Image description" width="741" height="1046"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1: Current State
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Data Flow&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Writer Service writes data to Amazon DynamoDB.&lt;/li&gt;
&lt;li&gt;Reader Services fetch data from DynamoDB.&lt;/li&gt;
&lt;li&gt;Archival Service moves older data to an Amazon S3 Bucket for storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Retention Policy&lt;/strong&gt;: Data in DynamoDB is retained for 15 days before archival.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2: Transition (Dual Write &amp;amp; Validation)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Data Replication&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduce a Kafka Sink Connector to sync data from Writer Service to MongoDB.&lt;/li&gt;
&lt;li&gt;Continue writing to DynamoDB while also storing data in MongoDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;New Archival Process&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new S3 bucket is created to store data from MongoDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;New Service Introduction&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A New Service API is introduced to provide the same responses as the existing database.&lt;/li&gt;
&lt;li&gt;A toggle flag is implemented in the API to switch between DynamoDB and MongoDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Validation Steps&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate responses from New Service against existing Reader Services.&lt;/li&gt;
&lt;li&gt;Ensure consistency in both S3 archival processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Phase 3: Full Migration &amp;amp; Decommissioning
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Switching Data Source&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change the toggle flag to make Reader Services fetch data from MongoDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Enhancements &amp;amp; Optimization&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fully transition reading services to the New Service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Decommissioning Old Infrastructure&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decommission DynamoDB and remove dependency on the old archival process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Validation &amp;amp; Completion&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate that all data is successfully migrated and all services function as expected.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloud</category>
      <category>microservices</category>
      <category>eventdriven</category>
      <category>kafka</category>
    </item>
  </channel>
</rss>
