2016-11-20 14:34:50 +01:00
|
|
|
|
using System;
|
|
|
|
|
using SimpleInjector;
|
|
|
|
|
using Tapeti;
|
2016-12-13 22:01:43 +01:00
|
|
|
|
using Tapeti.Saga;
|
2016-11-20 14:34:50 +01:00
|
|
|
|
using Tapeti.SimpleInjector;
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
private static void Main()
|
|
|
|
|
{
|
|
|
|
|
var container = new Container();
|
2016-12-07 10:19:16 +01:00
|
|
|
|
container.Register<MarcoEmitter>();
|
2016-12-13 22:01:43 +01:00
|
|
|
|
container.Register<Visualizer>();
|
2016-12-14 20:28:17 +01:00
|
|
|
|
container.RegisterSingleton<ISagaStore, SagaMemoryStore>();
|
2016-12-07 10:19:16 +01:00
|
|
|
|
|
2016-12-13 22:01:43 +01:00
|
|
|
|
var config = new TapetiConfig("test", new SimpleInjectorDependencyResolver(container))
|
|
|
|
|
.Use(new SagaMiddleware())
|
2016-12-07 10:19:16 +01:00
|
|
|
|
.RegisterAllControllers()
|
|
|
|
|
.Build();
|
2016-11-20 14:34:50 +01:00
|
|
|
|
|
2016-12-13 22:01:43 +01:00
|
|
|
|
using (var connection = new TapetiConnection(config))
|
2016-12-07 10:19:16 +01:00
|
|
|
|
{
|
2016-11-20 14:34:50 +01:00
|
|
|
|
Console.WriteLine("Subscribing...");
|
|
|
|
|
connection.Subscribe().Wait();
|
|
|
|
|
Console.WriteLine("Done!");
|
|
|
|
|
|
2016-12-05 08:00:09 +01:00
|
|
|
|
var emitter = container.GetInstance<MarcoEmitter>();
|
|
|
|
|
emitter.Run().Wait();
|
2016-11-20 14:34:50 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|