internal static void ConfigureInMemoryEventBus(Bootstrapper bootstrapper, InMemoryEventBusConfiguration?configuration, string[] excludedEventsDLLs, BootstrappingContext ctx) { InMemoryEventBus.InitHandlersCollection(excludedEventsDLLs); if (ctx.IsServiceRegistered(BootstrapperServiceType.IoC)) { bootstrapper.AddIoCRegistration(new TypeRegistration(typeof(InMemoryEventBus), typeof(IDomainEventBus), typeof(InMemoryEventBus))); if (configuration != null) { bootstrapper.AddIoCRegistration(new InstanceTypeRegistration(configuration, typeof(InMemoryEventBusConfiguration))); } } bootstrapper.AddNotifications(PerformEventChecksAccordingToBootstrapperParameters(ctx, configuration)); }
/// <summary> /// Configure the system to use InMemory Event bus for dipsatching events, with the provided configuration. /// </summary> /// <param name="bootstrapper">Bootstrapper instance.</param> /// <param name="configurationBuilderAction">Action to apply on builder.</param> /// <param name="excludedEventsDLLs">DLLs name to exclude from auto-configuration into IoC /// (IAutoRegisterType will be ineffective).</param> /// <returns>Bootstrapper Instance.</returns> public static Bootstrapper UseInMemoryEventBus(this Bootstrapper bootstrapper, Action <InMemoryEventBusConfigurationBuilder> configurationBuilderAction, params string[] excludedEventsDLLs) { if (configurationBuilderAction == null) { throw new ArgumentNullException(nameof(configurationBuilderAction)); } InMemoryEventBus.InitHandlersCollection(excludedEventsDLLs); var builder = new InMemoryEventBusConfigurationBuilder(); configurationBuilderAction(builder); return(UseInMemoryEventBus(bootstrapper, builder.Build())); }
/// <summary> /// Configure the bootstrapper to use InMemory buses for dispatching events. /// </summary> /// <param name="bootstrapper">Instance of boostrapper.</param> /// <param name="configuration">Configuration to use for in memory event bus.</param> /// <param name="excludedEventsDLLs">DLLs name to exclude from auto-configuration into IoC /// (IAutoRegisterType will be ineffective).</param> public static Bootstrapper UseInMemoryEventBus(this Bootstrapper bootstrapper, InMemoryEventBusConfiguration configuration = null, params string[] excludedEventsDLLs) { var service = InMemoryBusesBootstrappService.Instance; service.BootstrappAction += (ctx) => { InMemoryEventBus.InitHandlersCollection(excludedEventsDLLs); if (ctx.IsServiceRegistered(BootstrapperServiceType.IoC)) { bootstrapper.AddIoCRegistration(new TypeRegistration(typeof(InMemoryEventBus), typeof(IDomainEventBus), typeof(InMemoryEventBus))); if (configuration != null) { bootstrapper.AddIoCRegistration(new InstanceTypeRegistration(configuration, typeof(InMemoryEventBusConfiguration))); } } bootstrapper.AddNotifications(PerformEventChecksAccordingToBootstrapperParameters(ctx, configuration)); }; if (!bootstrapper.RegisteredServices.Any(s => s == service)) { bootstrapper.AddService(service); } return(bootstrapper); }
public void GlobalSetupA() { InMemoryEventBus.InitHandlersCollection(new string[0]); }
public InMemoryEventBus_Tests() { InMemoryEventBus.InitHandlersCollection(new string[0]); CleanRegistrationInDispatcher(); }