using System; using SimpleInjector; using Tapeti; using Tapeti.DataAnnotations; using Tapeti.Flow; using Tapeti.SimpleInjector; using System.Threading; using Tapeti.Flow.SQL; namespace Test { internal class Program { private static void Main() { // TODO logging var container = new Container(); container.Register(); container.Register(); container.Register(); var config = new TapetiConfig(new SimpleInjectorDependencyResolver(container)) //.WithFlowSqlRepository("Server=localhost;Database=TapetiTest;Integrated Security=true") .WithFlow() .WithDataAnnotations() .RegisterAllControllers() .Build(); using (var connection = new TapetiConnection(config) { Params = new TapetiAppSettingsConnectionParams() }) { var flowStore = container.GetInstance(); var flowStore2 = container.GetInstance(); Console.WriteLine("IFlowHandler is singleton = " + (flowStore == flowStore2)); connection.Connected += (sender, e) => { Console.WriteLine("Event Connected"); }; connection.Disconnected += (sender, e) => { Console.WriteLine("Event Disconnected"); }; connection.Reconnected += (sender, e) => { Console.WriteLine("Event Reconnected"); }; Console.WriteLine("Subscribing..."); var subscriber = connection.Subscribe(false).Result; Console.WriteLine("Consuming..."); subscriber.Resume().Wait(); Console.WriteLine("Done!"); connection.GetPublisher().Publish(new FlowEndController.PingMessage()); //container.GetInstance().Start(c => c.StartFlow, true); container.GetInstance().Start(c => c.TestParallelRequest); Thread.Sleep(1000); var emitter = container.GetInstance(); emitter.Run().Wait(); } } } }