snatch-dev / Chronicle

Implementation of saga pattern for .NET Core
MIT License
397 stars 70 forks source link

Add support for .net core 2.2 #35

Closed sriksmachi closed 4 years ago

sriksmachi commented 5 years ago

We are using this library for some time and we want to continue using - is there a plan to upgrade to .net core 2.2?

nick-cromwell commented 5 years ago

You can use the 2.0.2 version (https://www.nuget.org/packages/Chronicle_/2.0.2) which targets .Net Standard 2.0 and is compatible with .Net Core 2.2.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

sriksmachi commented 4 years ago

@nick-cromwell Thanks Nick that helped. I read from your documentation -

Additionally, an unhandled exception thrown from a HandleAsync() method will cause Reject() to be called and begin the compensation.

But this does not happen in this version (or maybe in the newer version as well) I had to catch the exception in the HandleAsync method and explicitly call reject. This looks not so clean at the moment - is this how it is supposed to work? This is how my code looks now. I was expecting not to handle any exceptions and let your awesome package take care of calling compensation.


 /// <summary>
        /// Handles the asynchronous.
        /// </summary>
        /// <param name="task">The task.</param>
        /// <param name="sagaContext">The saga context.</param>
        public async Task HandleAsync(CompleteTask task, ISagaContext sagaContext)
        {
             try
            {
                // service call here. 
                this.CompleteSaga();
                await Task.CompletedTask;
            }
            catch (System.Exception ex)
            {
                // log exception here
                await RejectAsync();              
            }
        }
GooRiOn commented 4 years ago

@vishwanathsrikanth I created separated issue for this one #38