DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • From Prompt to Running Microservice: ServiceBricks Step-By-Step
  • Assessment of Scalability Constraints (and Solutions): Practical Advice for Overcoming Scalability Challenges
  • The Path From APIs to Containers: How Microservices Fueled the Journey
  • What Is API-First?

Trending

  • Docker Base Images Demystified: A Practical Guide
  • Beyond Code Coverage: A Risk-Driven Revolution in Software Testing With Machine Learning
  • FIPS 140-3: The Security Standard That Protects Our Federal Data
  • Optimizing Integration Workflows With Spark Structured Streaming and Cloud Services
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Microservice Integration — SAGA Pattern

Microservice Integration — SAGA Pattern

Read on to find out more about how to integrate your microservices using the SAGA pattern — including choreography-based SAGA.

By 
Dilek Karadaş Mataracı user avatar
Dilek Karadaş Mataracı
·
Dec. 11, 19 · Review
Likes (9)
Comment
Save
Tweet
Share
20.0K Views

Join the DZone community and get the full member experience.

Join For Free

 




 

pattern blocks

Learn more about the SAGA pattern!
 


Since the application of Microservice architectures is expanding day to day, it is becoming much more important to ensure successful integrations between these microservices.

There are some issues to consider while designing these integration patterns:

  1. Partial error handling: MicroServices are single responsibility units but business transactions require more than one of these units. If one unit(it is called a local transaction) fails, the system must be designed to do its rollback actions(it is called compensation transaction) accordingly.
  2. Manage the situations where we need to collect data from multiple services: Microservices only have their entity data; when we need enriched data from multiple entities, we need to have proper integration principles.
  3. Testing requirements of the system design: Some patterns are more appropriate for testing purposes while some others are not.
  4. The organization (the company) structure is a key point: The Agile/Waterfall working principles of the organization is also a key point for architectural design.

You may also like: Principles for Microservices Integration

Microservice Architecture depends on the Database per Service principle. On top of that principle, there is a SAGA pattern that can be applied to ensure the integrity of distributed transactions because the Database per Service principle results in a context that we need to synchronize these databases.

SAGA Pattern depends on consecutive local transactions. It can be applied in two ways:

Choreography Based SAGA Pattern

In this method, each local transaction publishes an event when its job is done. The other local transaction that receives this event performs the appropriate behavior. The work is finished when all the local transactions are done.

Choreography based SAGA pattern

In choreography based SAGA, the process is managed by local transactions itself. This confirms the principle of intelligent endpoints and dummy communication channels.

The benefits of this method are as follows:

  1. Easy to implement.
  2. Appropriate if the number of local transactions is small.
  3. Loosely coupled endpoints.
  4. Suitable for agile organizations.

There are some drawbacks of the method:

  1.  It gets very complicated when the number of local transactions increases.
  2. Cyclic dependency may occur between services.

Orchestration Based SAGA Pattern

In this method, there is an intelligent endpoint (a separate service that performs orchestration) that coordinates the whole process. It manages which service will perform when. If one of the local transactions fails for some reason, the Orchestrator is also responsible for a rollback of the previously performed transactions.

Orchestration based SAGA Pattern

The benefits of this method are:

  1. Easy to implement.
  2. Easy to understand and maintain.
  3. Complexity is not an issue when local transactions’ count dramatically increases.

The drawbacks are:

  1. This method creates a situation that the communication channel becomes intelligent and the endpoints become a dummy.
  2. All the business logic is implemented inside the orchestrator. So the orchestrator becomes the monolith.

Which method to consider is determined by the needs of the system and the organization.


Further Reading

Microservice Architecture and Design Patterns for Microservices

microservice Integration

Opinions expressed by DZone contributors are their own.

Related

  • From Prompt to Running Microservice: ServiceBricks Step-By-Step
  • Assessment of Scalability Constraints (and Solutions): Practical Advice for Overcoming Scalability Challenges
  • The Path From APIs to Containers: How Microservices Fueled the Journey
  • What Is API-First?

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!