public void Configuration(IAppBuilder appBuilder)
        {
            IIocContainer iocContainer = new IocContainer();

            Bootstrap.Application()
            .ResolveReferencesWith(iocContainer)
            .UseEnvironment()
            .UseDomain().WithSimpleMessaging()
            .ConfigureRouteInspectorServer().WithRouteLimitOf(10)
            .ConfigureRouteInspectorWeb()
            .UseEventSourcing().PersistToMemory()
            .Initialise();

            var configuration = new HttpConfiguration
            {
                DependencyResolver = new SystemDotDependencyResolver(iocContainer)
            };

            configuration.MapHttpAttributeRoutes();
            configuration.Filters.Add(new ModelStateContextFilterAttribute());
            configuration.Filters.Add(new NoCacheFilterAttribute());

            configuration.MapSynchronisationRoutes();

            configuration.Routes.MapHttpRoute(
                "Default",
                "{controller}/{id}",
                new { id = RouteParameter.Optional });

            appBuilder.UseWebApi(configuration);
        }
 async Task SetupEventSourcing()
 {
     await Bootstrap.Application()
     .ResolveReferencesWith(container)
     .UseEnvironment()
     .UseDomain().WithSimpleMessaging()
     .UseEventSourcing().PersistToSqlite()
     .InitialiseAsync();
 }
Beispiel #3
0
 static async Task Setup(IocContainer container)
 {
     await Bootstrap.Application()
     .ResolveReferencesWith(container)
     .UseEnvironment()
     .UseDomain().DispatchEventsOnUiThread().WithSimpleMessaging()
     .UseEventSourcing().PersistToSqlite()
     .InitialiseAsync();
 }
        static void Main()
        {
            HostFactory.Run(configurator =>
            {
                var container = new IocContainer(t => t.NameInCSharp());

                var eventSubscriptionConfig = EventStoreSubscriptionConfiguration.FromAppConfig();

                var eventStoreUrl = EventStoreUrl.Parse(eventSubscriptionConfig.Url);

                var eventStoreUserCredentials = EventStoreUserCredentials.Parse(
                    eventSubscriptionConfig.UserCredentials.User,
                    eventSubscriptionConfig.UserCredentials.Password);

                var eventTypeResolution = EventTypeFromNameResolver.FromTypesFromAssemblyContaining <NewRiskItemMapped>();

                var eventStoreEndpoint = EventStoreEndpoint
                                         .OnUrl(eventStoreUrl)
                                         .WithCredentials(eventStoreUserCredentials)
                                         .WithEventTypeFromNameResolution(eventTypeResolution);

                var eventStoreSubscriptionEndpoint = EventStoreSubscriptionEndpoint
                                                     .ListenTo(eventStoreUrl)
                                                     .WithCredentials(eventStoreUserCredentials)
                                                     .WithEventTypeFromNameResolution(eventTypeResolution)
                                                     .WithSqlDatabaseEventIndexStorage();

                Bootstrap.Application()
                .ResolveReferencesWith(container)
                .SetupDataConnectivity().WithSqlConnection()
                .SetupMessaging()
                .ConfigureSagas().WithDatabasePersistence()
                .ConfigureEventStoreEndpoint(eventStoreEndpoint)
                .ConfigureReceivingEndpoint(eventStoreSubscriptionEndpoint)
                .ConfigureMessageRouting().WireUpRouting()
                .Initialise();

                Trace.TraceInformation(
                    "Data warehouse service has started up and the types registered into the container are {0}{1}",
                    Environment.NewLine,
                    container.Describe());

                configurator.Service <DataWarehouseController>(s =>
                {
                    s.ConstructUsing(name => container.Resolve <DataWarehouseController>());
                    s.WhenStarted(c => c.Start());
                    s.WhenStopped(c => c.Stop());
                });

                configurator.RunAsLocalSystem();
                configurator.SetDescription("Applied Systems Data Warehouse Service");
                configurator.SetDisplayName("Applied Systems Data Warehouse Service");
                configurator.SetServiceName("Applied Systems Data Warehouse Service");
            });
        }
Beispiel #5
0
        public static MessageLogger LimitRoutesTo(int limit)
        {
            var iocContainer = new IocContainer();

            Bootstrap.Application()
            .ResolveReferencesWith(iocContainer)
            .UseEnvironment()
            .UseDomain().WithSimpleMessaging()
            .ConfigureRouteInspectorServer().WithRouteLimitOf(limit)
            .UseEventSourcing().PersistToMemory()
            .Initialise();

            return(iocContainer.Resolve <MessageLogger>());
        }
        static void Main()
        {
            var config             = RiskCaptureConfiguration.FromAppConfig();
            var eventStorageConfig = EventStoreMessageStorageConfiguration.FromAppConfig();

            var eventStoreEndpoint = EventStoreEndpoint
                                     .OnUrl(EventStoreUrl.Parse(eventStorageConfig.Url))
                                     .WithCredentials(
                EventStoreUserCredentials.Parse(
                    eventStorageConfig.UserCredentials.User,
                    eventStorageConfig.UserCredentials.Password))
                                     .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <NewRiskItemMapped>());

            HostFactory.Run(configurator =>
            {
                var container = new IocContainer(t => t.NameInCSharp());

                Bootstrap.Application()
                .ResolveReferencesWith(container)
                .ConfigureRiskCapture()
                .SetupMessaging()
                .ConfigureEventStoreEndpoint(eventStoreEndpoint)
                .ConfigureMessageRouting().WireUpRouting()
                .Initialise();

                Trace.TraceInformation(
                    "Risk Capture service has started up and the types registered into the container are {0}{1}",
                    Environment.NewLine,
                    container.Describe());

                configurator.Service <RiskCaptureController>(s =>
                {
                    s.ConstructUsing(name => new RiskCaptureController(config.Url, container.Resolve <IMessageReceiver>()));
                    s.WhenStarted(c => c.Start());
                    s.WhenStopped(c => c.Stop());
                });

                configurator.RunAsLocalSystem();
                configurator.SetDescription("Applied Systems Risk Capture Service");
                configurator.SetDisplayName("Applied Systems Risk Capture Service");
                configurator.SetServiceName("Applied Systems Risk Capture Service");
            });
        }
Beispiel #7
0
        public void OnBeforeScenario()
        {
            var container = new IocContainer();

            serverContext.ServerUri = new Uri("http://TestServer");
            serverContext.SynchronisationHttpClient = new TestSynchronisationHttpClient();
            container.RegisterInstance <ISynchronisationHttpClient>(() => serverContext.SynchronisationHttpClient);
            container.RegisterInstance(() => eventHandlerContext);
            container.RegisterInstance <TestEventHandler, TestEventHandler>();

            Bootstrap.Application()
            .ResolveReferencesWith(container)
            .UseEnvironment()
            .UseDomain().DispatchEventsOnUiThread().WithSimpleMessaging()
            .UseEventSourcing().WithSynchronisation(serverContext.ServerUri).PersistToMemory()
            .Initialise();

            commitContext.EventSessionFactory            = container.Resolve <IEventSessionFactory>();
            commitSynchroniserContext.CommitSynchroniser = container.Resolve <CommitSynchroniser>();
        }
Beispiel #8
0
        public void OnBeforeScenario()
        {
            IIocContainer container = new IocContainer();

            container.RegisterInstance(() => eventHandlerContext);
            container.RegisterInstance <TestEventHandler, TestEventHandler>();

            Bootstrap.Application()
            .ResolveReferencesWith(container)
            .UseEnvironment()
            .UseDomain().DispatchEventsOnUiThread().WithSimpleMessaging()
            .UseEventSourcing().WithSynchronisation().PersistToMemory()
            .Initialise();

            eventSessionContext.SessionFactory = container.Resolve <IEventSessionFactory>();

            synchronisableCommitContext.TestServer = TestServer.Create(builder =>
            {
                var configuration = new HttpConfiguration
                {
                    DependencyResolver = new SystemDotDependencyResolver(container)
                };

                configuration.MapHttpAttributeRoutes();
                configuration.Filters.Add(new ModelStateContextFilterAttribute());
                configuration.Filters.Add(new NoCacheFilterAttribute());

                configuration.MapSynchronisationRoutes();

                configuration.Routes.MapHttpRoute(
                    "Default",
                    "{controller}/{id}",
                    new { id = RouteParameter.Optional });

                builder.UseWebApi(configuration);
            });
        }