masastack / MASA.Framework

.NET next-generation microservice development framework, which provides cloud native best practices based on Dapr.
https://docs.masastack.com/framework/getting-started/overview
MIT License
713 stars 113 forks source link

Improve EventBus experience #625

Open zhenlei520 opened 1 year ago

zhenlei520 commented 1 year ago

Description

Currently using ISagaEventHandler, if not specified separately, the value of FailureLevels of the HandleAsync method is FailureLevels.Throw, which causes the CancelHandler corresponding to the current Handler to not be executed when an exception occurs in the Handler, but we are more accustomed to thinking that Handler After an exception occurs, the corresponding CancelHandler should be executed

.NET version

.NET 6.0

MASA Framework version

1.0.0-rc.2

zhenlei520 commented 1 year ago

When using ISagaEventHandler, we are unlikely to use the function of Handler orchestration. At this time, only one Handler and one CancelHandler are needed. When the Handler is abnormal, the corresponding CancelHandler will be executed. This is a habit, but if you do not use orchestration, CancelHandler needs to be considered It will not cause data errors due to compensation (the framework itself does not know which step of the Handler execution is wrong), and choosing to use event orchestration is a better choice