I have a ASP.NET Core backend (with Azure Service Bus) and a Blazor Server frontend.

The purpose of the backend and the frontend is to trigger manual and automatic pushing of single data points (hereafter called the "data pushing process") to 2 different external systems (two different, unrelated APIs, that I don't control) via the backend making HTTP requests to these external systems. One HTTP request to each external system is required to push the data. The requests will carry a slightly different payload, since each system has its own contracts.

The data pushing process can be triggered by:

  1. The user clicking a button (called the "push" button in the frontend, which results in a HTTP PUT request to the backend.

  2. The backend receives data itself from an external service (via a different protocol). The received data can either by "ready for export" or not. If it is not ready for export, a user needs to fill out a text field on the frontend, and click the "push" button.

When a user clicks a button in the frontend, it sends a HTTP PUT request to the backend. I wish this to result in the backend sending it's own HTTP requests to 2 external systems, ie. pushing data to the two systems, when triggered by the user.


  • What type of coordination would be good for this scenario?

It does not seem optimal to do this with two synchronous HTTP requests in a controller method. What would be a good design (pattern) for managing the work of making the HTTP requests to the external systems?

I have considered the Saga pattern.


  • It's the backend that makes the HTTP requests to the external systems.
  • I need to keep track of if the data point is pushed to the external systems yet or not.
  • EDIT: The order of the HTTP requests does not matter.
  • EDIT: The external endpoints can return HTTP 200 and 400 codes, if upserting data succeeeds, or if the user is trying to update a data point they are not allowed to update.
  • EDIT: If the request(s) fail, I would like to show an error in the frontend.
  • Are you asking where to put the coordination of HTTP calls (i.e. in a Controller or elsewhere) or what type of coordination to use? If the latter, you might want to provide more details about the process itself, i.e. does the order of HTTP requests matter, what possible responses do you get, is compensation possible, etc. Commented Jul 28, 2023 at 8:41
  • 1
    I am asking the latter. I will update the question.
    – wetfield
    Commented Jul 28, 2023 at 9:24
  • If the second request fails, do you have to compensate by sending a counter-order to the first API? Commented Jul 28, 2023 at 10:10
  • @guillaume31 No. If the second request fails, I just need to know that it failed, and retry (with different values, in case an identical data point already exists)
    – wetfield
    Commented Jul 28, 2023 at 10:26

1 Answer 1



  • There is no compensation action to take in case one of the external HTTP calls fails (no system is changed as a result of either of these calls alone)
  • It's a simple [ call 1 OK && call 2 OK ] check,

I don't see a Saga being necessary here.

Just do the 2 calls in a sequence and don't continue if one of them fails. There are several ways to disrupt the flow of execution, whether it be via an exception, simple if's, etc. The Retry pattern could also be useful based on your description of the problem.

Whether to put it in a controller method or elsewhere depends on your architecture and layering style.

  • I think one of the challenges is making sure duplicate calls are not made to push this data, from the frontend and from another system at the same time. How does this design account for that? Commented Jul 29, 2023 at 0:23
  • I assumed from the Q that circumstances 1. and 2. were mutually exclusive. Is it the case @wetfield? We also don't know if the external API operations are idempotent or not. Commented Jul 31, 2023 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.