示例#1
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            // setup mass transit to log to nlog
            LogContext.ConfigureCurrentLogContext(new NLogLoggerFactory());

            container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, true));

            container.AddMassTransit(x =>
            {
                x.UsingRabbitMq((context, cfg) =>
                {
                    cfg.Host(
                        "rabbitmq://" + _rabbitHost,
                        x =>
                    {
                        x.Username(_rabbitUser);
                        x.Password(_rabbitPassword);
                    }
                        );
                    cfg.UseSendFilter(typeof(ValidatingSendFilter <>), context);
                });
            });

            container.Register(
                Component.For <IReadOnlyCollection <IValidator> >().UsingFactoryMethod(kernel => kernel.ResolveAll <IValidator>().ToArray()).LifestyleSingleton()
                );

            // to recieve messages we have to start bus (this includes receiving responses).
            container.Resolve <IBusControl>().Start();
        }
        public Windsor_SagaStateMachine()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(ConfigureRegistration);

            _container.Register(Component.For <PublishTestStartedActivity>().LifestyleScoped());
        }
示例#3
0
 public Windsor_ScopePublish()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(x =>
     {
         x.AddBus(provider => BusControl);
     });
 }
 public WindsorCourier_ExecuteActivity()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(x =>
     {
         x.AddExecuteActivity <SetVariableActivity, SetVariableArguments>();
         x.AddBus(provider => BusControl);
     });
 }
示例#5
0
 public Windsor_ScopeSend()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(x =>
     {
         x.AddBus(provider => BusControl);
     });
     _childContainer = _container.BeginScope();
 }
        public static void Config(IWindsorContainer windsorContainer)
        {
            windsorContainer.Register(Component.For <IAccountQueryService>().ImplementedBy <AccountQueryService>());

            windsorContainer.AddMassTransit(x =>
            {
                x.AddConsumers(typeof(AccountCreatedConsumer).Assembly);
            });
        }
 public WindsorCourier_Activity()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(x =>
     {
         x.AddActivity <TestActivity, TestArguments, TestLog>();
         x.AddBus(provider => BusControl);
     });
 }
        public WindsorCourier_Activity_Endpoint()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddActivity <TestActivity, TestArguments, TestLog>()
                .Endpoints(e => e.Name = "custom-testactivity-execute", e => e.Name = "custom-testactivity-compensate");

                x.AddBus(provider => BusControl);
            });
        }
        public WindsorCourier_ExecuteActivity_Endpoint()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddExecuteActivity <SetVariableActivity, SetVariableArguments>()
                .Endpoint(e => e.Name = "custom-setvariable-execute");

                x.AddBus(provider => BusControl);
            });
        }
示例#10
0
        public Windsor_Saga()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddSaga <SimpleSaga>();
                x.AddBus(provider => BusControl);
            });

            _container.Register(Component.For(typeof(ISagaRepository <>)).ImplementedBy(typeof(InMemorySagaRepository <>)).LifestyleSingleton());
        }
示例#11
0
 public Windsor_ScopeRequestClient()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(x =>
     {
         x.AddRequestClient <SimpleMessageClass>(InputQueueAddress);
         x.AddRequestClient <PingMessage>();
         x.AddBus(provider => BusControl);
     });
     _childContainer = _container.BeginScope();
 }
示例#12
0
        public Windsor_SagaStateMachine()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddSagaStateMachine <TestStateMachineSaga, TestInstance>();
                x.AddBus(provider => BusControl);
            });

            _container.Register(Component.For <PublishTestStartedActivity>().LifestyleScoped(),
                                Component.For(typeof(ISagaRepository <>)).ImplementedBy(typeof(InMemorySagaRepository <>)).LifestyleSingleton());
        }
        public Windsor_RequestClient_Context()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddConsumer <InitialConsumer>();
                x.AddConsumer <SubsequentConsumer>();

                x.AddBus(context => BusControl);

                x.AddRequestClient <InitialRequest>(InputQueueAddress);
                x.AddRequestClient <SubsequentRequest>(SubsequentQueueAddress);
            });
        }
 private void InstallBus(IWindsorContainer container)
 {
     container.AddMassTransit(x =>
     {
         x.AddConsumers(Assembly.GetExecutingAssembly());
         x.AddBus(context => Bus.Factory.CreateUsingRabbitMq(cfg =>
         {
             cfg.Host(ConfigurationManager.AppSettings["host"]);
             cfg.ReceiveEndpoint(ConfigurationManager.AppSettings["queueName"], ep =>
             {
                 ep.ConfigureConsumers(context);
             });
         }));
     });
 }
        public DependencyInjection_Discovery()
        {
            _container = new WindsorContainer();
            _container.AddMassTransit(x =>
            {
                x.AddConsumersFromNamespaceContaining(typeof(DiscoveryTypes));
                x.AddSagaStateMachinesFromNamespaceContaining(typeof(DiscoveryTypes));
                x.AddSagasFromNamespaceContaining(typeof(DiscoveryTypes));
                x.AddActivitiesFromNamespaceContaining(typeof(DiscoveryTypes));

                x.AddBus(provider => BusControl);
                x.AddRequestClient <PingMessage>(new Uri("loopback://localhost/ping-queue"));
            });

            _container.RegisterInMemorySagaRepository <DiscoveryPingSaga>();
            _container.RegisterInMemorySagaRepository <DiscoveryPingState>();
        }
示例#16
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, true));

            var registrations = GenerateRegistrations(container);

            container.Register(registrations.ToArray());

            if (UseMassTransit)
            {
                container.AddMassTransit(x =>
                {
                    x.AddBus(context => BusFactory(context, container));
                    ConfigBus?.Invoke(x);
                });
            }
            InstallMore(container, store);
        }
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Component.For <IRepository>().ImplementedBy <PatientRepository>().LifeStyle.Transient);


            container.AddMassTransit(c =>
            {
                c.AddConsumer <PatientCreatedEventConsumer>(config =>
                {
                    config.UseMessageRetry(rc => rc.Immediate(5));
                    config.UseInMemoryOutbox();
                });

                c.AddBus((kernel) => Bus.Factory.CreateUsingRabbitMq(busConfig =>
                {
                    busConfig.Host(RabbitMqConstants.HostName);
                    busConfig.ReceiveEndpoint(RabbitMqConstants.PatientCreatedQueue, receiverConfig => receiverConfig.ConfigureConsumer(container, typeof(PatientCreatedEventConsumer)));
                }));
            });
        }
示例#18
0
        public static IWindsorContainer AddInMemoryTestHarness(this IWindsorContainer container, Action <IWindsorContainerBusConfigurator> configure = null)
        {
            container.Register(Component.For <InMemoryTestHarness>().UsingFactoryMethod(kernel =>
            {
                var testHarness = new InMemoryTestHarness();

                var busRegistrationContext          = kernel.Resolve <IBusRegistrationContext>();
                testHarness.OnConfigureInMemoryBus += configurator => configurator.ConfigureEndpoints(busRegistrationContext);

                return(testHarness);
            }).LifestyleSingleton());

            container.AddMassTransit(cfg =>
            {
                configure?.Invoke(cfg);

                cfg.AddBus(context => context.GetRequiredService <InMemoryTestHarness>().BusControl);
            });

            return(container);
        }
        public static IWindsorContainer AddMassTransitInMemoryTestHarness(this IWindsorContainer container,
                                                                          Action <IWindsorContainerBusConfigurator> configure = null)
        {
            container.Register(Component.For <InMemoryTestHarness>().UsingFactoryMethod(kernel =>
            {
                var busInstance = kernel.Resolve <IBusInstance>();

                if (busInstance is InMemoryTestHarnessBusInstance instance)
                {
                    return(instance.Harness);
                }

                throw new ConfigurationException("Test Harness configuration is invalid");
            }).LifestyleSingleton());

            container.AddMassTransit(cfg =>
            {
                configure?.Invoke(cfg);

                cfg.SetBusFactory(new InMemoryTestHarnessRegistrationBusFactory());
            });

            return(container);
        }
示例#20
0
 public Windsor_Conductor(bool instanceEndpoint)
     : base(instanceEndpoint)
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(ConfigureRegistration);
 }
 public Windsor_RequestClient_Outbox_Courier()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(ConfigureRegistration);
 }
示例#22
0
 public Windsor_Mediator()
 {
     _container = new WindsorContainer();
     _container.AddMassTransit(ConfigureRegistration);
 }