2016-12-05 07:00:09 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-12-14 19:28:17 +00:00
|
|
|
|
using RabbitMQ.Client;
|
2016-11-17 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
namespace Tapeti.Connection
|
2016-11-16 22:11:05 +00:00
|
|
|
|
{
|
2016-12-14 19:28:17 +00:00
|
|
|
|
public class TapetiPublisher : IAdvancedPublisher
|
2016-11-16 22:11:05 +00:00
|
|
|
|
{
|
2016-12-05 07:00:09 +00:00
|
|
|
|
private readonly Func<TapetiWorker> workerFactory;
|
2016-11-16 22:11:05 +00:00
|
|
|
|
|
|
|
|
|
|
2016-12-05 07:00:09 +00:00
|
|
|
|
public TapetiPublisher(Func<TapetiWorker> workerFactory)
|
2016-11-16 22:11:05 +00:00
|
|
|
|
{
|
2016-12-05 07:00:09 +00:00
|
|
|
|
this.workerFactory = workerFactory;
|
2016-11-16 22:11:05 +00:00
|
|
|
|
}
|
2016-11-17 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task Publish(object message)
|
|
|
|
|
{
|
2016-12-14 19:28:17 +00:00
|
|
|
|
return workerFactory().Publish(message, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task Publish(object message, IBasicProperties properties)
|
|
|
|
|
{
|
|
|
|
|
return workerFactory().Publish(message, properties);
|
2016-11-17 16:33:27 +00:00
|
|
|
|
}
|
2016-11-16 22:11:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|