2016-12-05 08:00:09 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-11-17 17:33:27 +01:00
|
|
|
|
|
|
|
|
|
namespace Tapeti.Connection
|
2016-11-16 23:11:05 +01:00
|
|
|
|
{
|
|
|
|
|
public class TapetiPublisher : IPublisher
|
|
|
|
|
{
|
2016-12-05 08:00:09 +01:00
|
|
|
|
private readonly Func<TapetiWorker> workerFactory;
|
2016-11-16 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
|
2016-12-05 08:00:09 +01:00
|
|
|
|
public TapetiPublisher(Func<TapetiWorker> workerFactory)
|
2016-11-16 23:11:05 +01:00
|
|
|
|
{
|
2016-12-05 08:00:09 +01:00
|
|
|
|
this.workerFactory = workerFactory;
|
2016-11-16 23:11:05 +01:00
|
|
|
|
}
|
2016-11-17 17:33:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task Publish(object message)
|
|
|
|
|
{
|
2016-12-05 08:00:09 +01:00
|
|
|
|
return workerFactory().Publish(message);
|
2016-11-17 17:33:27 +01:00
|
|
|
|
}
|
2016-11-16 23:11:05 +01:00
|
|
|
|
}
|
|
|
|
|
}
|