Mark van Renswoude
1a0d9b2570
Changed BindingFilters to MessageFilterMiddleware (in preparation for SignalR interaction package) Start of SqlConnectionFlowRepository
50 lines
1.0 KiB
C#
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);
|
|
}*/
|
|
}
|
|
}
|
|
}
|