Beispiel #1
0
        public static IRevoConfiguration ConfigureInfrastructure(this IRevoConfiguration configuration,
                                                                 AsyncEventPipelineConfiguration asyncEventPipelineConfiguration = null,
                                                                 Action <InfrastructureConfigurationSection> advancedAction      = null)
        {
            configuration.ConfigureCore();
            configuration.UseInMemoryJobs(isActive: null); // activate only if not previously disabled

            var section = configuration.GetSection <InfrastructureConfigurationSection>();

            section.AsyncEventPipeline = asyncEventPipelineConfiguration ?? section.AsyncEventPipeline;

            advancedAction?.Invoke(section);

            configuration.ConfigureKernel(c =>
            {
                if (!c.Kernel.GetBindings(typeof(IAsyncEventPipelineConfiguration)).Any())
                {
                    c.Kernel.Bind <IAsyncEventPipelineConfiguration>().ToConstant(section.AsyncEventPipeline);
                }

                if (section.EnableSagas)
                {
                    c.LoadModule <SagasModule>();
                }
            });

            return(configuration);
        }
        public ProcessAsyncEventsJobHandlerTests()
        {
            asyncEventWorker = Substitute.For <IAsyncEventWorker>();
            jobScheduler     = Substitute.For <IInMemoryJobScheduler>();
            asyncEventPipelineConfiguration = new AsyncEventPipelineConfiguration();

            sut = new ProcessAsyncEventsJobHandler(asyncEventWorker, asyncEventPipelineConfiguration, jobScheduler);
        }