Permalink
Switch branches/tags
Nothing to show
Find file Copy path
1aa860f Sep 4, 2018
2 contributors

Users who have contributed to this file

@spetz @GooRiOn
25 lines (21 sloc) 814 Bytes
using System.Threading.Tasks;
using DShop.Common.Messages;
using RawRabbit;
using RawRabbit.Enrichers.MessageContext;
namespace DShop.Common.RabbitMq
{
internal class BusPublisher : IBusPublisher
{
private readonly IBusClient _busClient;
public BusPublisher(IBusClient busClient)
{
_busClient = busClient;
}
public async Task SendAsync<TCommand>(TCommand command, ICorrelationContext context)
where TCommand : ICommand
=> await _busClient.PublishAsync(command, ctx => ctx.UseMessageContext(context));
public async Task PublishAsync<TEvent>(TEvent @event, ICorrelationContext context)
where TEvent : IEvent
=> await _busClient.PublishAsync(@event, ctx => ctx.UseMessageContext(context));
}
}