diff --git a/src/Rebus.Operations/Rebus.Operations.Abstractions/ITaskMessaging.cs b/src/Rebus.Operations/Rebus.Operations.Abstractions/ITaskMessaging.cs index 01de2a6..d355aad 100644 --- a/src/Rebus.Operations/Rebus.Operations.Abstractions/ITaskMessaging.cs +++ b/src/Rebus.Operations/Rebus.Operations.Abstractions/ITaskMessaging.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -18,4 +19,7 @@ Task CompleteTask(IOperationTaskMessage message, object responseMessage, Task ProgressMessage(IOperationTaskMessage message, object data, IDictionary? additionalHeaders = null); + + Task ProgressMessage(Guid operationId, Guid taskId, object data, + IDictionary? additionalHeaders = null); } \ No newline at end of file diff --git a/src/Rebus.Operations/Rebus.Operations.Core/RebusTaskMessaging.cs b/src/Rebus.Operations/Rebus.Operations.Core/RebusTaskMessaging.cs index c2a4f93..dc0ec70 100644 --- a/src/Rebus.Operations/Rebus.Operations.Core/RebusTaskMessaging.cs +++ b/src/Rebus.Operations/Rebus.Operations.Core/RebusTaskMessaging.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Dbosoft.Rebus.Operations.Events; -using Dbosoft.Rebus.Operations.Workflow; using Rebus.Bus; using Rebus.Transport; @@ -49,15 +48,19 @@ public Task CompleteTask(IOperationTaskMessage message, object responseMessage, } - public async Task ProgressMessage(IOperationTaskMessage message, object data, IDictionary? additionalHeaders = null) + public Task ProgressMessage(IOperationTaskMessage message, object data, IDictionary? additionalHeaders = null) + { + return ProgressMessage(message.OperationId, message.TaskId, data, additionalHeaders); + } + + public async Task ProgressMessage(Guid operationId, Guid taskId, object data, IDictionary? additionalHeaders = null) { using var scope = new RebusTransactionScope(); - await _bus.SendWorkflowEvent(_options, new OperationTaskProgressEvent { Id = Guid.NewGuid(), - OperationId = message.OperationId, - TaskId = message.TaskId, + OperationId = operationId, + TaskId = taskId, Data = data, Timestamp = DateTimeOffset.UtcNow }, additionalHeaders).ConfigureAwait(false);