public static RebusConfigurer ConfigureEndpoint(this RebusConfigurer configurer, string inputQueueName)
 {
     return(configurer
            .Logging(l => l.ColoredConsole(LogLevel.Warn))
            .Transport(t => t.UseMsmq(inputQueueName))
            .Subscriptions(s => s.StoreInSqlServer(Config.ConnectionString, "Subscriptions", isCentralized: true))
            );
 }
Beispiel #2
0
 public static RebusConfigurer Configure(RebusConfigurer configuration) => configuration
 .Logging(conf => conf.Serilog())
 .Serialization(conf => conf.UseWire())
 .Transport(conf => conf.UseInMemoryTransport(new InMemNetwork(), "server-commands"))
 .Routing(conf => conf.TypeBased().MapAssemblyOf <WarehouseCommand>("server-commands"))
 .Options(conf =>
 {
     conf.SimpleRetryStrategy();
     conf.SetMaxParallelism(1);
     conf.EnableCompression();
 });
Beispiel #3
0
        public static RebusConfigurer ConfigureEndpoint(this RebusConfigurer configurer, EndpointRole role)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["RebusDatabase"]?.ConnectionString ?? throw new ConfigurationErrorsException("Could not find 'RebusDatabase' connection string");

            configurer
            .Logging(l => l.Serilog(Log.Logger))
            .Transport(t =>
            {
                if (role == EndpointRole.Client)
                {
                    t.UseMsmqAsOneWayClient();
                }
                else
                {
                    t.UseMsmq(Config.AppSetting("QueueName"));
                }
            })
            .Subscriptions(s =>
            {
                var subscriptionsTableName = Config.AppSetting("SubscriptionsTableName");

                s.StoreInSqlServer(connectionString, subscriptionsTableName, isCentralized: true);
            })
            .Sagas(s =>
            {
                if (role != EndpointRole.SagaHost)
                {
                    return;
                }

                var dataTableName  = Config.AppSetting("SagaDataTableName");
                var indexTableName = Config.AppSetting("SagaIndexTableName");

                // store sagas in SQL Server to make them persistent and survive restarts
                s.StoreInSqlServer(connectionString, dataTableName, indexTableName);
            })
            .Timeouts(t =>
            {
                if (role == EndpointRole.Client)
                {
                    return;
                }

                var tableName = Config.AppSetting("TimeoutsTableName");

                // store timeouts in SQL Server to make them persistent and survive restarts
                t.StoreInSqlServer(connectionString, tableName);
            });

            return(configurer);
        }
Beispiel #4
0
        private static RebusConfigurer ConfigureRebus(RebusConfigurer c, IConfigurationRoot config)
        {
            var connectionString = config.GetValue <string>("ConnectionString");

            //var sqlOptions = new SqlServerTransportOptions(connectionString);

            return(c.Logging(x => x.ColoredConsole())
                   .Routing(x => x.TypeBased().Map <StartSaga>("ServiceBus"))
                   .Options(x => x.SimpleRetryStrategy("Error"))
                   .Transport(x => x
                              .UseSqlServerAsOneWayClient(connectionString)
                              )
                   .Subscriptions(x => x.StoreInSqlServer(connectionString, "Subscriptions", isCentralized: true, automaticallyCreateTables: false)));
        }
Beispiel #5
0
        public static RebusConfigurer ConfigureEndpoint(this RebusConfigurer configurer, Role role)
        {
            configurer
            .Logging(l => l.Serilog(Log.Logger))
            .Transport(t =>
            {
                if (role == Role.Client)
                {
                    t.UseRabbitMqAsOneWayClient(Config.AppSetting("Rabbitmq"));     //"amqp://*****:*****@192.168.99.100:5672"
                }
                else
                {
                    t.UseRabbitMq(Config.AppSetting("Rabbitmq"), Config.AppSetting("QueueName"));
                }
            })
            .Subscriptions(s =>
            {
                var subscriptionsTableName = Config.AppSetting("SubscriptionsTableName");
                s.StoreInSqlServer("RebusDatabase", subscriptionsTableName, isCentralized: true);
            })
            .Sagas(s =>
            {
                if (role != Role.SagaHost)
                {
                    return;
                }

                var dataTableName  = Config.AppSetting("SagaDataTableName");
                var indexTableName = Config.AppSetting("SagaIndexTableName");

                // store sagas in SQL Server to make them persistent and survive restarts
                s.StoreInSqlServer("RebusDatabase", dataTableName, indexTableName);
            })
            .Timeouts(t =>
            {
                if (role == Role.Client)
                {
                    return;
                }

                var tableName = Config.AppSetting("TimeoutsTableName");

                // store timeouts in SQL Server to make them persistent and survive restarts
                t.StoreInSqlServer("RebusDatabase", tableName);
            });

            return(configurer);
        }
        private RebusConfigurer ConfigureRebus(RebusConfigurer c, IConfigurationRoot config)
        {
            var connectionString = config.GetValue <string>("ConnectionString");

            //var sqlOptions = new SqlServerTransportOptions(connectionString);

            return(c
                   .Logging(x => { x.Serilog(); })
                   .Options(x =>
            {
                x.SimpleRetryStrategy("Error");
                x.EnableMessageAuditing("Audit");
                x.SetNumberOfWorkers(10);
                x.SetMaxParallelism(10);
            })
                   .Transport(x => x
                              .UseSqlServer(connectionString, "ServiceBus")
                              )
                   .Subscriptions(x => x.StoreInSqlServer(connectionString, "Subscriptions", isCentralized: true, automaticallyCreateTables: false))
                   .Sagas(x => x.StoreInSqlServer(connectionString, "Sagas", "SagaIndexes")));
        }
Beispiel #7
0
        public static RebusConfigurer ConfigureEndpoint(this RebusConfigurer configurer, EndpointRole role)
        {
            configurer
            .Logging(l => l.Serilog(Log.Logger))
            .Transport(t =>
            {
                if (role == EndpointRole.Client)
                {
                    t.UseSqlServerAsOneWayClient(Config.ConnectionString("RebusDatabase"));
                }
                else
                {
                    t.UseSqlServer(Config.ConnectionString("RebusDatabase"), Config.AppSetting("QueueName"));
                }
            })
            .Subscriptions(s =>
            {
                var subscriptionsTableName = Config.AppSetting("SubscriptionsTableName");

                s.StoreInSqlServer(Config.ConnectionString("RebusDatabase"), subscriptionsTableName, isCentralized: true);
            })
            .Sagas(s =>
            {
                if (role != EndpointRole.SagaHost)
                {
                    return;
                }

                var dataTableName  = Config.AppSetting("SagaDataTableName");
                var indexTableName = Config.AppSetting("SagaIndexTableName");

                // store sagas in SQL Server to make them persistent and survive restarts
                s.StoreInSqlServer(Config.ConnectionString("RebusDatabase"), dataTableName, indexTableName);
            });


            return(configurer);
        }
        public static RebusConfigurer ConfigureEndpoint(this RebusConfigurer configurer, EndpointRole role)
        {
            var dbConnectionString         = Environment.GetEnvironmentVariable("REBUSSPIKE_DB");
            var servicebusConnectionString = Environment.GetEnvironmentVariable("REBUSSPIKE_ASB");

            configurer
            .Logging(l => l.Serilog(Log.Logger))
            //.Transport(t =>
            //{
            //    if (role == EndpointRole.Client)
            //    {
            //        t.UseMsmqAsOneWayClient();
            //    }
            //    else
            //    {
            //        t.UseMsmq(Config.AppSetting("QueueName"));
            //    }
            //})
            .Transport(t =>
            {
                if (role == EndpointRole.Client)
                {
                    t.UseAzureServiceBusAsOneWayClient(servicebusConnectionString);
                }
                else
                {
                    t.UseAzureServiceBus(servicebusConnectionString, "Rebus_" + Enum.GetName(typeof(EndpointRole), role))
                    .EnablePartitioning();
                }
            })
            //.Subscriptions(s =>
            //{
            //    var subscriptionsTableName = "Rebus_Subscriptions";

            //    s.StoreInSqlServer(RebusDbConnectionString, subscriptionsTableName, isCentralized: true);
            //})
            .Sagas(s =>
            {
                if (role != EndpointRole.SagaHost)
                {
                    return;
                }

                //var dataTableName = ;
                //var indexTableName = ;

                // store sagas in SQL Server to make them persistent and survive restarts
                s.StoreInSqlServer(dbConnectionString, "Rebus_SagaData", "Rebus_SagaIndex");
                s.EnforceExclusiveAccess();
            })

            //.Timeouts(t =>
            //{
            //    if (role == EndpointRole.Client) return;

            //    var tableName = "Rebus_Timeouts";

            //    // store timeouts in SQL Server to make them persistent and survive restarts
            //    t.StoreInSqlServer(RebusDbConnectionString, tableName);
            //})
            ;

            return(configurer);
        }