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()); }
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); }); }
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); }); }
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()); }
public Windsor_ScopeRequestClient() { _container = new WindsorContainer(); _container.AddMassTransit(x => { x.AddRequestClient <SimpleMessageClass>(InputQueueAddress); x.AddRequestClient <PingMessage>(); x.AddBus(provider => BusControl); }); _childContainer = _container.BeginScope(); }
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>(); }
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))); })); }); }
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); }
public Windsor_Conductor(bool instanceEndpoint) : base(instanceEndpoint) { _container = new WindsorContainer(); _container.AddMassTransit(ConfigureRegistration); }
public Windsor_RequestClient_Outbox_Courier() { _container = new WindsorContainer(); _container.AddMassTransit(ConfigureRegistration); }
public Windsor_Mediator() { _container = new WindsorContainer(); _container.AddMassTransit(ConfigureRegistration); }