/// <summary> /// Configures rebus to use sql server to store everything. /// </summary> /// <param name="config">the rebus configuration</param> /// <param name="connectionStringOrName">the connectionstring or name of the connectionstring to use for sql server</param> /// <param name="queueName">the name of th rebus queue for this bus instance</param> /// <param name="queueTableName">the name of the queue table in the database</param> /// <param name="sagaDataTableName">the name of the saga data table in the database</param> /// <param name="sagaIndexTableName">the name of the saga index table in the database</param> /// <param name="subscriptionsTableName">the name of the subscriptions table in the database</param> /// <param name="timeoutTableName">the name of the timeouts table in the database</param> /// <param name="dataBusTableName">the name of the databus table in the database</param> /// <param name="enableDataBus">should rebus use a separate storage for large messages?</param> /// <param name="automaticallyCreateTables">should rebus auto-create tables?</param> /// <param name="isCenteralizedSubscriptions">is it safe to treat this as a centeralized location for subscriptions?</param> /// <returns>the rebus configuration</returns> public static RebusConfigurer UseSqlServer(this RebusConfigurer config, string connectionStringOrName, string queueName, string queueTableName = "RebusMessages", string sagaDataTableName = "RebusSaga", string sagaIndexTableName = "RebusSagaIndex", string subscriptionsTableName = "RebusSubscriptions", string timeoutTableName = "RebusTimeouts", string dataBusTableName = "RebusDataBus", bool enableDataBus = true, bool automaticallyCreateTables = true, bool isCenteralizedSubscriptions = false) { return(config .Transport(t => t.UseSqlServer(connectionStringOrName, queueTableName, queueName)) .Sagas(s => s.StoreInSqlServer(connectionStringOrName, sagaDataTableName, sagaIndexTableName, automaticallyCreateTables)) .Subscriptions(s => s.StoreInSqlServer(connectionStringOrName, subscriptionsTableName, isCenteralizedSubscriptions, automaticallyCreateTables)) .Timeouts(t => t.StoreInSqlServer(connectionStringOrName, timeoutTableName, automaticallyCreateTables)) .Options(o => { if (enableDataBus) { o.EnableDataBus() .StoreInSqlServer(connectionStringOrName, dataBusTableName, automaticallyCreateTables); } })); }
/// <summary> /// Decorates transport to save messages into an outbox instead of sending them directly /// </summary> /// <param name="configurer"></param> /// <param name="outboxStorageConfigurer"></param> /// <param name="configureOptions"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static RebusConfigurer Outbox(this RebusConfigurer configurer, Action <StandardConfigurer <IOutboxStorage> > outboxStorageConfigurer, Action <OutboxOptions> configureOptions = null) { configurer.Transport(t => { if (outboxStorageConfigurer == null) { throw new ArgumentNullException(nameof(outboxStorageConfigurer)); } outboxStorageConfigurer(t.OtherService <IOutboxStorage>()); var outboxOptions = new OutboxOptions(); configureOptions?.Invoke(outboxOptions); t.Decorate(c => { var transport = c.Get <ITransport>(); var outboxStorage = c.Get <IOutboxStorage>(); if (outboxOptions.RunMessagesProcessor) { var outboxMessagesProcessor = new OutboxMessagesProcessor( outboxOptions.MaxMessagesToRetrieve, transport, outboxStorage, c.Get <IBackoffStrategy>(), c.Get <IRebusLoggerFactory>(), c.Get <CancellationToken>()); outboxMessagesProcessor.Run(); } return(new OutboxTransportDecorator(transport, outboxStorage)); }); }); return(configurer); }
static RebusConfigurer Configure(this RebusConfigurer configurer, CloudStorageAccount storageAccount, string inputQueueAddress, string subscriptionTableName = "RebusSubscriptions", string sagaIndexTableName = "RebusSagaIndex", string sagaContainerName = "RebusSagaStorage", string dataBusContainerName = "RebusDataBusData", bool isCentralizedSubscriptions = false, bool enableDataBus = true, bool enableSagaSnapshots = true) { return(configurer .Transport(t => t.UseAzureStorageQueues(storageAccount, inputQueueAddress)) .Subscriptions(t => t.StoreInTableStorage(storageAccount, subscriptionTableName, isCentralizedSubscriptions)) .Sagas(t => t.StoreInAzureStorage(storageAccount, sagaIndexTableName, sagaContainerName)) .Options(o => { if (enableDataBus) { o.EnableDataBus().StoreInBlobStorage(storageAccount, dataBusContainerName); } if (enableSagaSnapshots) { o.EnableSagaAuditing().StoreInBlobStorage(storageAccount, sagaContainerName); } })); }
private RebusConfigurer ConfigureRebus(RebusConfigurer rebusConfigurer, BusConfig busConfig) { rebusConfigurer.Routing(x => x.TypeBased() .MapAssemblyOf <MyMessage>(busConfig.MainQueue) ); rebusConfigurer.Transport(configurer => configurer.UseInMemoryTransport(new InMemNetwork(), busConfig.MainQueue)); rebusConfigurer.Subscriptions(configurer => configurer.StoreInMemory()); rebusConfigurer.Sagas(standardConfigurer => standardConfigurer.StoreInMemory()); return(rebusConfigurer); }
private void configureSqlServerTransport(RebusConfigurer configurer) { var connectionString = _configuration.GetConnectionString("RebusSql"); configurer.Transport(t => t.UseSqlServer( transportOptions: new SqlServerTransportOptions( connectionString: connectionString, enlistInAmbientTransaction: false ), getInputQueueName(_thisBus))) .Subscriptions(x => x.StoreInSqlServer( connectionString: connectionString, tableName: "rbs.Rebus_Subscriptions", isCentralized: true)); }
private void configureRabbtMQServerTransport(RebusConfigurer configurer) { var sqlConnectionString = _configuration.GetConnectionString("RebusSql"); var rabbitConnectionString = _configuration.GetConnectionString("RebusRabbit"); configurer.Transport(t => t.UseRabbitMq(rabbitConnectionString, _thisBus.ToString())) .Sagas(x => { x.StoreInSqlServer( connectionString: sqlConnectionString, dataTableName: "rbs.Rebus_Sagas", indexTableName: "rbs.Rebus_SagasIndex"); }); }
/// <summary> /// Configures rebus to use the filesystem store for everything in one-way client mode. /// </summary> /// <param name="configurer">The rebus configuration</param> /// <param name="baseDirectory">The directory to store everything under</param> public static RebusConfigurer UseFileSystemAsOneWayClient(this RebusConfigurer configurer, string baseDirectory) { var transport = Path.Combine(baseDirectory, "transport"); var timeouts = Path.Combine(baseDirectory, "timeouts"); var subscriptions = Path.Combine(baseDirectory, "subscriptions.json"); var dataBus = Path.Combine(baseDirectory, "databus"); return(configurer .Transport(t => t.UseFileSystemAsOneWayClient(transport)) .Subscriptions(t => t.UseJsonFile(subscriptions)) .Timeouts(t => t.UseFileSystem(timeouts)) .Options(o => { o.EnableDataBus().StoreInFileSystem(dataBus); })); }
protected override void ConfigurationCreated(RebusConfigurer busConfiguration) { busConfiguration.Transport(t => t.UseMongoDb(new MongoDbTransportOptions(JarvisRebusConfiguration.ConnectionString), JarvisRebusConfiguration.InputQueue)); }
protected override void ConfigurationCreated(RebusConfigurer busConfiguration) { base.ConfigurationCreated(busConfiguration); busConfiguration.Timeouts(t => t.StoreInMongoDb(_mongoDatabase, JarvisRebusConfiguration.Prefix + "-timeouts")); busConfiguration.Transport(t => t.UseMsmq(JarvisRebusConfiguration.InputQueue)); }
protected override void ConfigurationCreated(RebusConfigurer busConfiguration) { base.ConfigurationCreated(busConfiguration); busConfiguration.Transport(t => t.UseMsmq(JarvisRebusConfiguration.InputQueue)); }