Skip to content

Commit

Permalink
added ProgressMessage overload with Guids
Browse files Browse the repository at this point in the history
  • Loading branch information
fw2568 committed Jul 26, 2023
1 parent f2917bf commit 03bde2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand All @@ -18,4 +19,7 @@ Task CompleteTask(IOperationTaskMessage message, object responseMessage,

Task ProgressMessage(IOperationTaskMessage message, object data,
IDictionary<string, string>? additionalHeaders = null);

Task ProgressMessage(Guid operationId, Guid taskId, object data,
IDictionary<string, string>? additionalHeaders = null);
}
13 changes: 8 additions & 5 deletions src/Rebus.Operations/Rebus.Operations.Core/RebusTaskMessaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -49,15 +48,19 @@ public Task CompleteTask(IOperationTaskMessage message, object responseMessage,
}


public async Task ProgressMessage(IOperationTaskMessage message, object data, IDictionary<string,string>? additionalHeaders = null)
public Task ProgressMessage(IOperationTaskMessage message, object data, IDictionary<string,string>? additionalHeaders = null)
{
return ProgressMessage(message.OperationId, message.TaskId, data, additionalHeaders);
}

public async Task ProgressMessage(Guid operationId, Guid taskId, object data, IDictionary<string,string>? 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);
Expand Down

0 comments on commit 03bde2c

Please sign in to comment.