Mass transit saga handling transition when multiple events of the same type have occurred #5157
elenacalugaru
started this conversation in
General
Replies: 2 comments 2 replies
-
This is too much code to read, if you have a standalone repository, share it. Also, don't use optimistic concurrency if you're expecting concurrent events to the same saga instance. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've changed to Pesimistic as opt.ConcurrencyMode = ConcurrencyMode.Pessimistic; opt.UsePostgres(); and I'm using SemaphoreSlim when I update the processed users succcess users or failed users but sometimes I get the some messages in the error queue with the reason 40001: could not serialize access due to concurrent update -- What should I do to avoid this kind of errors? Thanks a lot. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm starting to learn how to use mass transit with rabbit mq, ef core, .net 6 and saga state machines.
Currently I have this saga UsersAssignedToCourseState with the following UsersAssignedToCourseStateMachine.
The flow is the following from a microservice a message/command is send to the orchestrator microservice to assign a list of users to a course and when receiving this message I setup the saga and i publish for each user an event . Then I can receive back for each user
an event with status completed or failure. After that I can publish another event for the user with the completed orfailure status.
When all the users have been assigned with success i want to publish another event , this will be used to
notify the person how assigned the students that all the users are assigned.
The main issue is the events for the users are all coming in the same time and the all success event
raised by state machine is not fired because the processedUserIds and SuccessfullyProcessedUserIds are getting reseted between events.
What can i use to mitigate this behaviour?
Beta Was this translation helpful? Give feedback.
All reactions