Exemplo n.º 1
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.Sentinel");
            _container.RegisterDataAccess("Shuttle.Recall.SqlServer");

            _container.Register(Component.For <IDatabaseContextCache>().ImplementedBy <ThreadStaticDatabaseContextCache>());
            _container.Register(Component.For <IEventStore>().ImplementedBy <EventStore>());
            _container.Register(Component.For <IKeyStore>().ImplementedBy <KeyStore>());
            _container.Register(Component.For <ISerializer>().ImplementedBy <DefaultSerializer>());
            _container.Register(Component.For <IEventStoreQueryFactory>().ImplementedBy <EventStoreQueryFactory>());
            _container.Register(Component.For <IKeyStoreQueryFactory>().ImplementedBy <KeyStoreQueryFactory>());
            _container.Register(Component.For <IProjectionService>().ImplementedBy <ProjectionService>());
            _container.Register(Component.For <IProjectionConfiguration>().Instance(ProjectionSection.Configuration()));
            _container.RegisterConfiguration(SentinelSection.Configuration());

            _container.Register(Component.For <object>().ImplementedBy <UserProjectionHandler>().Named("UserProjectionHandler"));

            _processor = EventProcessor.Create(c => { c.ProjectionService(_container.Resolve <IProjectionService>()); });

            _processor.AddEventProjection(new EventProjection("User").AddEventHandler(_container.Resolve <object>("UserProjectionHandler")));

            _processor.Start();
        }
Exemplo n.º 2
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.ProcessManagement");

            _container.Register(Component.For <IEventStore>().ImplementedBy <EventStore>());
            _container.Register(Component.For <IKeyStore>().ImplementedBy <KeyStore>());
            _container.Register(Component.For <ISerializer>().ImplementedBy <DefaultSerializer>());
            _container.Register(Component.For <IEventStoreQueryFactory>().ImplementedBy <EventStoreQueryFactory>());
            _container.Register(Component.For <IKeyStoreQueryFactory>().ImplementedBy <KeyStoreQueryFactory>());

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe <OrderCreatedEvent>();
            subscriptionManager.Subscribe <InvoiceCreatedEvent>();
            subscriptionManager.Subscribe <EMailSentEvent>();

            var processConfiguration = ProcessSection.Configuration();

            ((DefaultProcessActivator)processConfiguration.ProcessActivator).RegisterMappings();

            _bus = ServiceBus.Create(
                c =>
            {
                c.MessageHandlerFactory(new CastleMessageHandlerFactory(_container));
                c.SubscriptionManager(subscriptionManager);
                c.AddModule(new ProcessModule(_container.Resolve <IDatabaseContextFactory>(), _container.Resolve <IEventStore>(), _container.Resolve <IKeyStore>(), processConfiguration));
            }).Start();
        }
Exemplo n.º 3
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.ProcessManagement");

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe <OrderProcessRegisteredEvent>();
            subscriptionManager.Subscribe <OrderProcessCancelledEvent>();
            subscriptionManager.Subscribe <OrderProcessAcceptedEvent>();
            subscriptionManager.Subscribe <OrderProcessCompletedEvent>();
            subscriptionManager.Subscribe <OrderProcessArchivedEvent>();
            subscriptionManager.Subscribe <OrderCreatedEvent>();
            subscriptionManager.Subscribe <CancelOrderProcessRejectedEvent>();
            subscriptionManager.Subscribe <ArchiveOrderProcessRejectedEvent>();
            subscriptionManager.Subscribe <InvoiceCreatedEvent>();
            subscriptionManager.Subscribe <EMailSentEvent>();

            _bus = ServiceBus.Create(
                c =>
            {
                c
                .MessageHandlerFactory(new CastleMessageHandlerFactory(_container))
                .SubscriptionManager(subscriptionManager);
            }).Start();
        }
        private void ConfigureWindsorContainer()
        {
            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.ProcessManagement");

            var shuttleApiControllerType = typeof(ShuttleApiController);

            _container.Register(
                Classes
                .FromThisAssembly()
                .Pick()
                .If((type => type.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)
                     &&
                     shuttleApiControllerType.IsAssignableFrom(type)))
                .LifestyleTransient()
                .WithServiceFirstInterface()
                .Configure(c => c.Named(c.Implementation.UnderlyingSystemType.Name)));

            _container.Register(
                Classes
                .FromAssemblyNamed("Shuttle.ProcessManagement.Services")
                .Pick()
                .If(type => type.Name.EndsWith("Service"))
                .LifestyleSingleton()
                .WithServiceFirstInterface());
        }
Exemplo n.º 5
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.ProcessManagement");

            _container.Register(Component.For <IEventStore>().ImplementedBy <EventStore>());
            _container.Register(Component.For <Recall.Core.ISerializer>().ImplementedBy <Recall.Core.DefaultSerializer>());
            _container.Register(Component.For <IEventStoreQueryFactory>().ImplementedBy <EventStoreQueryFactory>());

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe <OrderCreatedEvent>();
            subscriptionManager.Subscribe <InvoiceCreatedEvent>();
            subscriptionManager.Subscribe <EMailSentEvent>();

            _bus = ServiceBus.Create(
                c =>
            {
                c
                .MessageHandlerFactory(new CastleMessageHandlerFactory(_container).RegisterHandlers())
                .SubscriptionManager(subscriptionManager);
            }).Start();
        }
Exemplo n.º 6
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess("Shuttle.Invoicing");

            _bus = ServiceBus.Create(
                c => c
                .MessageHandlerFactory(new CastleMessageHandlerFactory(_container))
                .SubscriptionManager(SubscriptionManager.Default())
                ).Start();
        }
Exemplo n.º 7
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host))));

            _container = new WindsorContainer();

            _container.RegisterDataAccessCore();
            _container.RegisterDataAccess(Assembly.GetExecutingAssembly());

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe <OrderCreatedEvent>();
            subscriptionManager.Subscribe <InvoiceCreatedEvent>();
            subscriptionManager.Subscribe <EMailSentEvent>();

            _bus = ServiceBus.Create(
                c =>
            {
                c
                .MessageHandlerFactory(new CastleMessageHandlerFactory(_container).RegisterHandlers())
                .SubscriptionManager(subscriptionManager);
            }).Start();
        }