<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data-Consistency on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/data-consistency/</link><description>Recent content in Data-Consistency on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/data-consistency/index.xml" rel="self" type="application/rss+xml"/><item><title>Saga Pattern: Choreography versus Orchestration</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;saga&lt;/strong&gt; is a sequence of &lt;strong&gt;local transactions&lt;/strong&gt;, one per service. Each step commits in its own database and triggers the next. If a step fails, the saga runs &lt;strong&gt;compensating transactions&lt;/strong&gt; that semantically undo the steps already completed. Sagas give microservices business-level consistency without a distributed transaction.&lt;/p&gt;</description></item><item><title>Transactional Outbox and Idempotent Inbox</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;transactional outbox&lt;/strong&gt; pattern publishes events reliably from a service that owns a database. Instead of writing to the database &lt;strong&gt;and&lt;/strong&gt; sending to a broker (two systems that cannot share a transaction), the service writes the business change &lt;strong&gt;and an outbox row&lt;/strong&gt; in &lt;strong&gt;one local transaction&lt;/strong&gt;. A separate relay later reads the outbox and publishes to the broker. The matching &lt;strong&gt;inbox&lt;/strong&gt; pattern lets consumers process each message once, even when it is delivered several times.&lt;/p&gt;</description></item><item><title>CQRS and Event Sourcing</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/cqrs-and-event-sourcing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/cqrs-and-event-sourcing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;CQRS (Command Query Responsibility Segregation)&lt;/strong&gt; uses &lt;strong&gt;different models for writing and reading&lt;/strong&gt;. Commands change state through a write model that enforces business rules; queries read from one or more read models shaped for the screens and APIs that use them.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Event sourcing&lt;/strong&gt; stores an entity&amp;rsquo;s state as the &lt;strong&gt;sequence of events&lt;/strong&gt; that happened to it (&lt;code&gt;OrderPlaced&lt;/code&gt;, &lt;code&gt;ItemAdded&lt;/code&gt;, &lt;code&gt;OrderShipped&lt;/code&gt;) instead of its current values. Current state is derived by replaying the events.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;They are independent patterns that combine naturally: event sourcing produces a stream of events, and CQRS projections consume it to build read models.&lt;/p&gt;</description></item></channel></rss>