From 77052cb1aef8a6df08621df148c18b719bc49574 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sat, 4 Jan 2020 21:20:13 +0800 Subject: [PATCH] Fix received storage message retry bug. #473 --- build/version.props | 2 +- .../Internal/ISubscribeInvoker.Default.cs | 10 +++++++++- src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build/version.props b/build/version.props index b5087f2..716fe13 100644 --- a/build/version.props +++ b/build/version.props @@ -2,7 +2,7 @@ 3 0 - 0 + 1 $(VersionMajor).$(VersionMinor).$(VersionPatch) diff --git a/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs b/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs index aa801bd..728ea41 100644 --- a/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs +++ b/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs @@ -9,6 +9,7 @@ using DotNetCore.CAP.Messages; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; +using Newtonsoft.Json.Linq; namespace DotNetCore.CAP.Internal { @@ -62,7 +63,14 @@ namespace DotNetCore.CAP.Internal } else { - executeParameters[i] = message.Value; + if (message.Value is JObject jValue) //reading from storage + { + executeParameters[i] = jValue.ToObject(parameterDescriptors[i].ParameterType); + } + else + { + executeParameters[i] = message.Value; + } } } diff --git a/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs b/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs index 005b010..1c1913d 100644 --- a/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs +++ b/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs @@ -55,6 +55,7 @@ namespace DotNetCore.CAP.Processor foreach (var message in messages) { + //the message.Origin.Value maybe JObject await _messageSender.SendAsync(message); await context.WaitAsync(_delay);