Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
fw2568 committed Feb 27, 2023
2 parents ec14a05 + 79901b2 commit 9abaa8f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dbosoft Rebus Extensions

This repository will contain following extensions to [Rebus](https://github.com/rebus-org/rebus):
This repository contains following extensions to [Rebus](https://github.com/rebus-org/rebus):

- Dbosoft.Rebus.Configuration
A extension for configuring rebus via dependency injection.
Expand All @@ -9,4 +9,3 @@ This repository will contain following extensions to [Rebus](https://github.com/
A extension that uses rebus sagas to manage long running operations.


Development is in progress and no public release is currently available.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Microsoft.Extensions.Configuration;
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Rebus.Config;
using Rebus.Persistence.FileSystem;
using Rebus.Persistence.InMem;
using Rebus.Timeouts;

Expand All @@ -13,7 +15,7 @@ public DefaultTimeoutsStoreSelector(IConfiguration configuration, ILogger log) :
{
}

public override string[] AcceptedConfigTypes => new []{"inmemory" };
public override string[] AcceptedConfigTypes => new []{"inmemory", "filesystem" };
public override string ConfigurationName => "store";

protected override void ConfigureByType(string busType, StandardConfigurer<ITimeoutManager> configurer)
Expand All @@ -23,6 +25,14 @@ protected override void ConfigureByType(string busType, StandardConfigurer<ITime
case "inmemory":
configurer.StoreInMemory();
break;
case "filesystem":
var path = Configuration[$"{ConfigurationName}:path"];

if(path == null)
throw new InvalidOperationException($"Missing configuration entry for {ConfigurationName}::path.");

configurer.UseFileSystem(path);
break;
}
}

Expand Down
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 9abaa8f

Please sign in to comment.