Enterprise Integration Patterns
Conversation Patterns
Conversation Patterns
Ensuring ConsistencyConversation Patterns » Ensuring Consistency

In distributed environments, operations commonly span across multiple, independent components. Consistent execution of the interactions is desired, i.e. all operations should succeed, or, if something goes wrong, no operation should be completed and every component should revert into its original state. In a non-distributed or tightly controlled environment, transaction mechanisms usually ensure this type of consistency, guaranteeing the classic ACID properties: operations are atomic, consistent, isolated, and durable. Databases and TP Monitors are classic examples of components that guarantee ACID properties. In distributed, loosely coupled systems, however, such ACID transactions are typically not available or not practical.

In the absence of traditional "ACID" transactions, Pat Helland proposed in 2007 to rephrase the acronym to: Associative, Commutative, Idempotent, and Distributed ([Helland]). While the original ACID properties are about correctness and precision, the new ones are about flexibility and robustness. Being associative means that a chain of operations can be performed in any grouping, the classical example being (A + B) + C = A + (B + C) for the associative operator ‘+’. Likewise, commutative operations can swap the operands without affecting the result: A + B = B + A. Finally, a function is idempotent if its repeated application does not change the result, i.e. f(x) = f(f(x)). In combination the "new ACID" means that operations can be performed out of order or duplicated without affecting the results.

When the communication infrastructure does not provide traditional "ACID" guarantees, components have to engage in conversations to achieve consistency. For example, they may expect acknowledgments to their messages, resend requests, or perform tentative operations to be confirmed later. When engaging in a conversation to ensure consistency, participants have to balance the following considerations:

This section divides into two categories of patterns:

Consistency Strategies

Mitigation Strategies