Esempio n. 1
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .RedisRepository(r => r.ConcurrencyMode = ConcurrencyMode.Pessimistic);

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 2
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .RedisRepository();

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 3
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddSaga <SimpleSaga>()
            .InMemoryRepository();

            configurator.AddBus(provider => BusControl);
        }
Esempio n. 4
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .MartenRepository("server=localhost;port=5432;database=MartenTest;user id=postgres;password=Password12!;");

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 5
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddSaga <SimpleSaga>()
            .Endpoint(e => e.Name = "custom-endpoint-name")
            .InMemoryRepository();

            configurator.AddBus(provider => BusControl);
        }
Esempio n. 6
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
                where T : class
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .NHibernateRepository();

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 7
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                _connectionString = LocalDbConnectionStringProvider.GetLocalDbConnectionString();

                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .DapperRepository(_connectionString);

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 8
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .MongoDbRepository(r =>
                {
                    r.Connection   = "mongodb://127.0.0.1";
                    r.DatabaseName = "sagaTest";
                });

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 9
0
 protected static void ConfigureTwo <T>(IRegistrationConfigurator <IBusTwo, T> configurator)
     where T : class
 {
     configurator.AddConsumer <Consumer2>();
     configurator.AddBus(context => MassTransit.Bus.Factory.CreateUsingInMemory(cfg =>
     {
         cfg.Host(new Uri("loopback://bus-two/"));
         cfg.ConfigureEndpoints(context);
         cfg.UseHealthCheck(context);
     }));
 }
Esempio n. 10
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddSaga <SimpleSaga>()
            .Endpoint(e => e.Name = "custom-endpoint-name")
            .InMemoryRepository();

            configurator.AddSaga <SecondSimpleSaga>(typeof(SecondSimpleSagaDefinition))
            .Endpoint(e => e.Temporary = true)
            .InMemoryRepository();

            configurator.AddBus(provider => BusControl);
        }
Esempio n. 11
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .EntityFrameworkRepository(r =>
                {
                    r.ConcurrencyMode = ConcurrencyMode.Optimistic;

                    r.AddDbContext <DbContext, TestInstanceDbContext>(ApplyBuilderOptions);
                });

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 12
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .EntityFrameworkRepository(r =>
                {
                    r.ConcurrencyMode = ConcurrencyMode.Pessimistic;

                    r.DatabaseFactory(provider => () => new TestInstanceDbContext(LocalDbConnectionStringProvider.GetLocalDbConnectionString()));
                });

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 13
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.AddConsumer <ConsumerA>(typeof(ConsumerADefinition))
            .Endpoint(x => x.Name = "shared");

            configurator.AddConsumer <ConsumerB>(typeof(ConsumerBDefinition))
            .Endpoint(x => x.Name = "shared");

            configurator.AddConsumer <ConsumerC>(typeof(ConsumerCDefinition));

            configurator.AddBus(provider => BusControl);
        }
Esempio n. 14
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .DocumentDbRepository(r =>
                {
                    r.ConfigureEmulator();

                    r.DatabaseId = "sagaTest";
                });

                configurator.AddBus(provider => BusControl);
            }
        /// <summary>
        /// Add a RabbitMQ bus
        /// </summary>
        /// <param name="configurator">The registration configurator</param>
        /// <param name="configure">The configure callback method</param>
        /// <typeparam name="TContainerContext"></typeparam>
        public static void AddRabbitMqBus <TContainerContext>(this IRegistrationConfigurator <TContainerContext> configurator,
                                                              Action <TContainerContext, IRabbitMqBusFactoryConfigurator> configure)
        {
            IBusControl BusFactory(TContainerContext context)
            {
                return(RabbitMqBusFactory.Create(cfg =>
                {
                    configure(context, cfg);
                }));
            }

            configurator.AddBus(BusFactory);
        }
Esempio n. 16
0
        protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
        {
            configurator.SetKebabCaseEndpointNameFormatter();

            configurator.AddConsumersFromNamespaceContaining <SubmitOrderConsumer>();

            configurator.AddServiceClient();

            configurator.AddRequestClient <SubmitOrder>();
            configurator.AddRequestClient <AuthorizeOrder>();

            configurator.AddBus(provider => BusControl);
        }
Esempio n. 17
0
            protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
            {
                configurator.AddSagaStateMachine <TestStateMachineSaga, TestInstance>()
                .EntityFrameworkRepository(r =>
                {
                    r.AddDbContext <DbContext, TestInstanceDbContext>(ApplyBuilderOptions);

                    r.ConcurrencyMode = ConcurrencyMode.Pessimistic;
                    if (DbContextOptionsBuilder.Options.Extensions.Any(x => x is NpgsqlOptionsExtension))
                    {
                        r.LockStatementProvider = new PostgresLockStatementProvider(false);
                    }
                    else
                    {
                        r.LockStatementProvider = new SqlServerLockStatementProvider(false);
                    }
                });

                configurator.AddBus(provider => BusControl);
            }
Esempio n. 18
0
        static void AddBus(this IRegistrationConfigurator <IServiceProvider> configurator, Action <IServiceBusBusFactoryConfigurator> configure = null)
        {
            configurator.AddBus(context =>
            {
                IOptions <ServiceBusOptions> options = context.Container.GetRequiredService <IOptions <ServiceBusOptions> >();

                options.Value.MessageHandlerOptions.AutoComplete = true;

                IServiceBusBusConfiguration busConfiguration = context.Container.GetRequiredService <IServiceBusBusConfiguration>();

                var busFactoryConfigurator = new ServiceBusBusFactoryConfigurator(busConfiguration);

                busFactoryConfigurator.Host(options.Value.ConnectionString);
                busFactoryConfigurator.UseServiceBusMessageScheduler();

                configure?.Invoke(busFactoryConfigurator);

                return(busFactoryConfigurator.Build());
            });
        }
Esempio n. 19
0
 protected void ConfigureRegistration <T>(IRegistrationConfigurator <T> configurator)
     where T : class
 {
     configurator.AddConsumer <DependentConsumer>();
     configurator.AddBus(provider => BusControl);
 }