Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6546669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:44:11+00:00 2026-05-25T11:44:11+00:00

I have a question how to deal with a saga where the decision making

  • 0

I have a question how to deal with a saga where the decision making
depends on an event that was published before the saga was created.

Here is an example to illustrate my issue:

Imagine I have a CustomerAR and a OrderAR. When the customerAR is
created a validation process starts, the result of that process is the
amount of an order that the customer is free to spend without special
authorization. I will not go into detail about this process because
it’s out of context. When the amount is calculated a command is sent
to the the CustomerAR with the calculated amount and the CustomerAR
publishes an event (CustomerMaxOrderAmountEvent) with that value. So
far so good.

Then a few weeks later the customer places an order. The OrderAR is
created and starts my OrderSaga. The saga waits until the order is
created completely and then has to make a decision if it needs to send
an AutorizationCommand for that order. To make that decision it has to
know if the CustomerMaxOrderAmountEvent is published and the value of
the amount. Normally the OrderSaga will also subscribe to the
CustomerMaxOrderAmountEvent, but the problem is this event will never
occur because it already did in the past.

How should I deal with this. Should I query the read model to know the
value, should I send a command to get the value, should I make a
reference to the CustomerAR, should I replay all historic events in
the saga so he knows the history already.

UPDATE

Please note that it’s about the concept not about this concrete example. The example is pure for clarification of the problem: “2 non related aggregate roots that are not part of the same bounded context.”

Thankful for help.

Melvin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:44:12+00:00Added an answer on May 25, 2026 at 11:44 am

    I would go for simpler solution – just add this information (for example in a form of HasCustomerReachedMaxOrderAmount) to the event that starts the Saga.

    The second option I’d choose is to prepare a read-model designed to be used with the Sagas and query data from there, but I’d gather all the required information even before the saga is started. This enrichment could be performed by a handler to the original event raised by AR as this is not something that is part of Aggregate/Bounded Context.

    In most cases however basing on data passed with events is sufficient due to the fact that Sagas should contain business logic only in form of process. This very often means that you might end up with more then one Saga (to follow your example OrderSaga and OrderWithMaxAmountSaga).

    All that said, considering the sample scenario you’ve provided, I think that decision whether order requires authorization or not should rather be part of your domain itself and passed while starting saga.

    I’d model this scenario like this – CustomerAR calculates max amount; customer places an order -> OrderAR is created with the information about max amount for this customer, Order verifies if it needs additional authorization -> Saga get started. The point is that information about max amount is important for both CustomerAR (where it can change) and OrderAR (where it’s immutable).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have gotten a great deal of help from KandadaBoggu on my last question
I have Question and QuestionTypes. In Question table there is a foreign key that
I have question concerning a function I created. I would like to show the
I have the unfortunate luck of having to deal with a db that contains
I have a question concerning encryption, more specifically encryption that requires no internet connection
I have a simple question that boggles me. I am trying to use the
i have a question about event based program performance. in my company we have
I have an odd question that I have always thought about, but could never
I have asked a question like this before, and the answer was great but
Assume i have a ticket/question that can have zero or many replies. I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.