2016-12-05 07:00:09 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-01-31 11:01:08 +00:00
|
|
|
|
using RabbitMQ.Client;
|
2016-11-17 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
namespace Tapeti.Connection
|
2016-11-16 22:11:05 +00:00
|
|
|
|
{
|
2017-02-05 22:22:34 +00:00
|
|
|
|
public class TapetiPublisher : IInternalPublisher
|
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)
|
|
|
|
|
{
|
2017-01-31 11:01:08 +00:00
|
|
|
|
return workerFactory().Publish(message, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task Publish(object message, IBasicProperties properties)
|
|
|
|
|
{
|
|
|
|
|
return workerFactory().Publish(message, properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task PublishDirect(object message, string queueName, IBasicProperties properties)
|
|
|
|
|
{
|
|
|
|
|
return workerFactory().PublishDirect(message, queueName, properties);
|
2016-11-17 16:33:27 +00:00
|
|
|
|
}
|
2016-11-16 22:11:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|