Handle null EventData in PublishEventAsync
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Caspian.WorkflowFramework.Contracts;
|
||||
@@ -168,6 +169,11 @@ public class WorkflowService : IWorkflowService, ILoggable
|
||||
return response;
|
||||
}
|
||||
|
||||
dynamic payload = null;
|
||||
|
||||
if (input.EventData.ValueKind != JsonValueKind.Undefined &&
|
||||
input.EventData.ValueKind != JsonValueKind.Null)
|
||||
{
|
||||
var json = input.EventData.GetRawText();
|
||||
|
||||
var settings = new JsonSerializerSettings
|
||||
@@ -176,7 +182,8 @@ public class WorkflowService : IWorkflowService, ILoggable
|
||||
};
|
||||
|
||||
// تبدیل JSON به object داینامیک
|
||||
dynamic payload = JsonConvert.DeserializeObject<ExpandoObject>(json, settings);
|
||||
payload = JsonConvert.DeserializeObject<ExpandoObject>(json, settings);
|
||||
}
|
||||
|
||||
//await _eventPublisher.PublishAsync(input.EventName, null, input.WorkflowInstanceId, null, input.EventData, asynchronous: true);
|
||||
await _eventPublisher.PublishAsync(input.EventName, null, input.WorkflowInstanceId, null, payload);
|
||||
|
||||
Reference in New Issue
Block a user