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))
|
|
|
|
|
{
|
2016-12-05 07:00:09 +00:00
|
|
|
|
container.Register<MarcoEmitter>();
|
|
|
|
|
|
2016-11-20 13:34:50 +00:00
|
|
|
|
Console.WriteLine("Subscribing...");
|
|
|
|
|
connection.Subscribe().Wait();
|
|
|
|
|
Console.WriteLine("Done!");
|
|
|
|
|
|
2016-12-05 07:00:09 +00:00
|
|
|
|
var emitter = container.GetInstance<MarcoEmitter>();
|
|
|
|
|
emitter.Run().Wait();
|
2016-11-20 13:34:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|