Questions tagged [saga]

A pattern that enables a service bus to deal with long-running processes, fault tolerance and scalability.

Long-running business processes exist in many systems. Whether the steps are automated, manual, or a combination, effective handling of these processes is critical.

NServiceBus employs event-driven architectural principles to bake fault-tolerance and scalability into these processes.

The Saga is a pattern that addresses these challenges uncovered by the relational database community years ago, packaged in NServiceBus for ease of use by developers.

MassTransit supports sagas, and Automatonymous is a saga implementation built on top of MassTransit.

497 questions
2
votes
0 answers

What is the point of calling basic functions in sagas?

In the Saga API it says it is possible the pass a function to a call that is not another saga/generator, nor is it a function that returns a promise. In other words, a saga call can call a basic sync javascript function : If fn is a normal function…
Oliver Watkins
  • 12,575
  • 33
  • 119
  • 225
2
votes
0 answers

saga() function not invoking on re-login

Hi I am trying to create an app with authentication and authorization. I am using redux saga for it. Now when I try to login for the first time this saga fuction is invoked: export function* saga() { yield takeLatest(actionTypes.Login,…
MAYANK KUMAR
  • 326
  • 4
  • 12
2
votes
1 answer

Dispatched Action not reaching Saga

I was trying to load an image in this basic app using Saga, i configured Saga and it seems fine but the image wasn't getting loaded. So I even created abutton to check whether saga is getting called, but it's still not working. index.js(saga) import…
2
votes
2 answers

Why are Commands necessary in choreography-based Sagas?

One key difference often highlighted between Events and Commands in EDA is as follows: Events are something which has happened Commands are requests for something which might happen What I can't understand is why implementations often use both of…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
2
votes
2 answers

Should users await for a response after the http request in a saga pattern architecture?

I am designing a microservice architecture, using a database per service pattern. Following the example of Order Service and Shipping Service, when a user makes an HTTP REST request to the Order Service, this one fires an event to notify shipping…
2
votes
2 answers

How to create unit tests for NServiceBus Saga when Saga has more than one handler

I used to have this test, which passes just fine (The saga is complete once all three messages have been handled. Test.Saga(sagaId) .When(x => { x.Handle(new TestSagaStartMessageOne …
Hugo Forte
  • 5,718
  • 5
  • 35
  • 44
2
votes
2 answers

Is it possible to define a single saga which will process many messages

My team is considering if we can use mass transit as a primary solution for sagas in RabbitMq (vs NServiceBus). I admit that our experience which solution like masstransit and nserviceBus are minimal and we have started to introduce messaging into…
Bartosz Kowalczyk
  • 1,479
  • 2
  • 18
  • 34
2
votes
1 answer

Multi-Aggregate Transaction in EventSourcing

I'm new to event sourcing, but for our current project I consider it as a very promising option, mostly because of the audit trail. One thing I'm not 100% happy with is the lack of aggregate-spanning transcations. Please consider the following…
Tho Mai
  • 835
  • 5
  • 25
2
votes
1 answer

My mock function isn't being called in Sagas test

I'm trying to test Sagas with Jest, but I can't make Sagas call the loginApi mocked function, It seems that it is calling the actual function. Can someone help me with this? That's my saga: export async function loginApi(user) { return await…
n3n3
  • 288
  • 1
  • 7
2
votes
1 answer

Multiple sagas (of same type) across different JVM using Axon

How to actually manage sagas with multiple JVM of same app running Should each JVM of this app use same database? Otherwise tracking tokens will not "be shared" across the same app? How are events split among same app running for sagas? Does one…
Yoann CAPLAIN
  • 121
  • 3
  • 11
2
votes
1 answer

How to handle commands sent from saga in axon framework

Using a saga, given an event EventA, saga starts, it sends a command (or many). How can we make sure that the command is sent successfully then actual logic in other micro-service did not throw, etc. Let's have an example of email saga: When a user…
Yoann CAPLAIN
  • 121
  • 3
  • 11
2
votes
2 answers

Validation within a asynchronous SAGA pattern - CQRS & DDD

Let's consider the flow below: API client calls [POST] /api/v1/invitation/:InvitationId/confirm Confirm the invitation within a SAGA Eventually raise an InvitationConfirmed event to indicate success We are some troubles finding a good place to…
user4478810
2
votes
0 answers

How to cancel all running sagas when navigating between page views

I'm trying to find a simple and easy way to cancel all running sagas within a "page" when the user decides to navigate to another "page" within the app... We are not using routing, but instead each "page" is its own widget within a larger host…
Joshua Barker
  • 987
  • 2
  • 11
  • 23
2
votes
1 answer

How to persist Saga instances using storage engines and avoid race condition

I tried persisting Saga Instances using RedisSagaRepository; I wanted to run Saga in load balancing setup, so I cannot use InMemorySagaRepository. However, after I switched, I noticed that some of the events published by Consumers were not getting…
Wit B
  • 53
  • 1
  • 5
2
votes
1 answer

How to run parallel sagas synchrony

I have upload file saga to server function * uploadImageSaga (action: Object): Saga { const {name, id} = action const payload = { image: action.base64 } //....upload.... yield put(uploadFileSucc(id, name,…
guneva
  • 21
  • 2