1
0
mirror of synced 2024-11-16 14:53:50 +00:00
Tapeti/Connection/TapetiSubscriber.cs

26 lines
595 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
2016-11-17 16:33:27 +00:00
using System.Threading.Tasks;
2016-12-11 14:08:58 +00:00
using Tapeti.Config;
namespace Tapeti.Connection
{
public class TapetiSubscriber : ISubscriber
{
private readonly Func<TapetiWorker> workerFactory;
public TapetiSubscriber(Func<TapetiWorker> workerFactory)
{
this.workerFactory = workerFactory;
}
2016-12-11 14:08:58 +00:00
public async Task BindQueues(IEnumerable<IQueue> queues)
{
2016-12-11 14:08:58 +00:00
await Task.WhenAll(queues.Select(queue => workerFactory().Subscribe(queue)).ToList());
}
}
}