Skip to content

Commit

Permalink
Return Tasks in IOperationMessaging.DispatchTaskMessage (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
fw2568 authored Feb 27, 2023
1 parent c3add35 commit 236b5e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Dbosoft.Rebus.Operations.Workflow;

public interface IOperationMessaging
{
void DispatchTaskMessage(object command, IOperationTask task);
Task DispatchTaskMessage(object command, IOperationTask task);
Task DispatchTaskStatusEventAsync(string commandType, OperationTaskStatusEvent message);
Task DispatchTaskStatusEventAsync(OperationTaskStatusEvent message);
Task DispatchOperationStatusEventAsync(OperationStatusEvent operationStatusEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task Handle(CreateNewOperationTaskCommand message)
throw new InvalidOperationException($"unknown command type '{message.CommandType}'");

Data.Tasks.Add(message.TaskId, messageType.AssemblyQualifiedName!);
_workflow.Messaging.DispatchTaskMessage(command,task);
await _workflow.Messaging.DispatchTaskMessage(command,task);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public RebusOperationMessaging(IBus bus,
TaskDispatcher = taskDispatcher;
}

public virtual void DispatchTaskMessage(object command, IOperationTask task)
public virtual Task DispatchTaskMessage(object command, IOperationTask task)
{
var messageType = command.GetType();
var outboundMessage = Activator.CreateInstance(
typeof(OperationTaskSystemMessage<>).MakeGenericType(messageType),
command, task.OperationId, task.InitiatingTaskId, task.Id);

_bus.SendLocal(outboundMessage);
return _bus.SendLocal(outboundMessage);
}

public Task DispatchTaskStatusEventAsync(string commandType, OperationTaskStatusEvent message)
Expand Down

0 comments on commit 236b5e8

Please sign in to comment.