2016-11-20 13:34:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using SimpleInjector;
|
|
|
|
|
using Tapeti;
|
2016-12-13 21:01:43 +00:00
|
|
|
|
using Tapeti.Saga;
|
2016-11-20 13:34:50 +00:00
|
|
|
|
using Tapeti.SimpleInjector;
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
private static void Main()
|
|
|
|
|
{
|
|
|
|
|
var container = new Container();
|
2016-12-07 09:19:16 +00:00
|
|
|
|
container.Register<MarcoEmitter>();
|
2016-12-13 21:01:43 +00:00
|
|
|
|
container.Register<Visualizer>();
|
2016-12-14 19:28:17 +00:00
|
|
|
|
container.RegisterSingleton<ISagaStore, SagaMemoryStore>();
|
2016-12-07 09:19:16 +00:00
|
|
|
|
|
2016-12-13 21:01:43 +00:00
|
|
|
|
var config = new TapetiConfig("test", new SimpleInjectorDependencyResolver(container))
|
|
|
|
|
.Use(new SagaMiddleware())
|
2016-12-07 09:19:16 +00:00
|
|
|
|
.RegisterAllControllers()
|
|
|
|
|
.Build();
|
2016-11-20 13:34:50 +00:00
|
|
|
|
|
2016-12-13 21:01:43 +00:00
|
|
|
|
using (var connection = new TapetiConnection(config))
|
2016-12-07 09:19:16 +00:00
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|