2016-11-20 13:34:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using SimpleInjector;
|
|
|
|
|
using Tapeti;
|
|
|
|
|
using Tapeti.SimpleInjector;
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
private static void Main()
|
|
|
|
|
{
|
|
|
|
|
var container = new Container();
|
|
|
|
|
|
|
|
|
|
using (var connection = new TapetiConnection
|
|
|
|
|
{
|
|
|
|
|
PublishExchange = "test",
|
|
|
|
|
SubscribeExchange = "test"
|
|
|
|
|
}
|
|
|
|
|
.WithDependencyResolver(new SimpleInjectorDependencyResolver(container))
|
|
|
|
|
.RegisterAllControllers(typeof(Program).Assembly))
|
|
|
|
|
{
|
|
|
|
|
container.Register(() => connection.GetPublisher());
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Subscribing...");
|
|
|
|
|
connection.Subscribe().Wait();
|
|
|
|
|
Console.WriteLine("Done!");
|
|
|
|
|
|
|
|
|
|
var publisher = connection.GetPublisher();
|
|
|
|
|
|
|
|
|
|
//for (var x = 0; x < 5000; x++)
|
|
|
|
|
while(true)
|
|
|
|
|
publisher.Publish(new MarcoMessage()).Wait();
|
|
|
|
|
|
2016-11-21 19:54:29 +00:00
|
|
|
|
//Console.ReadLine();
|
2016-11-20 13:34:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|