1
0
mirror of synced 2024-11-24 19:53:10 +01:00
Tapeti/Test/MarcoEmitter.cs
Mark van Renswoude 6779f3a4d0 Added AppSettings ConnectionParams helper
Changed BindingFilters to MessageFilterMiddleware (in preparation for SignalR interaction package)
Start of SqlConnectionFlowRepository
2017-02-08 15:52:24 +01:00

50 lines
1.0 KiB
C#

using System.Threading;
using System.Threading.Tasks;
using Tapeti;
namespace Test
{
public class MarcoEmitter
{
private readonly IPublisher publisher;
public MarcoEmitter(IPublisher publisher)
{
this.publisher = publisher;
}
public async Task Run()
{
// await publisher.Publish(new MarcoMessage());
var concurrent = new SemaphoreSlim(20);
while (true)
{
for (var x = 0; x < 200; x++)
{
await concurrent.WaitAsync();
try
{
await publisher.Publish(new MarcoMessage());
}
finally
{
concurrent.Release();
}
}
await Task.Delay(200);
}
/*
while (true)
{
await Task.Delay(1000);
}*/
}
}
}