Add Defer method to CommandSender
This commit is contained in:
parent
f6c58a9b6c
commit
d593194457
|
|
@ -1,10 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using NodaTime;
|
||||
|
||||
namespace Elsa.Services
|
||||
{
|
||||
public interface ICommandSender
|
||||
{
|
||||
Task SendAsync(object message, IDictionary<string, string>? headers = default);
|
||||
Task DeferAsync(object message, Duration delay, IDictionary<string, string>? headers = default);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using NodaTime;
|
||||
|
||||
namespace Elsa.Services
|
||||
{
|
||||
|
|
@ -17,5 +18,11 @@ namespace Elsa.Services
|
|||
var bus = await _serviceBusFactory.GetServiceBusAsync(message.GetType(), default);
|
||||
await bus.Send(message, headers);
|
||||
}
|
||||
|
||||
public async Task DeferAsync(object message, Duration delay, IDictionary<string, string>? headers = default)
|
||||
{
|
||||
var bus = await _serviceBusFactory.GetServiceBusAsync(message.GetType(), default);
|
||||
await bus.Defer(delay.ToTimeSpan(), message, headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue