public async Task CountTheConnections() { var activeConnections = new ConcurrentDictionary<int, object>(); var bus = Configure.With(new BuiltinHandlerActivator()) .Transport(t => t.Register(c => { var connectionProvider = new TestConnectionProvider(SqlTestHelper.ConnectionString, activeConnections); var transport = new SqlServerTransport(connectionProvider, "RebusMessages", "bimse"); transport.EnsureTableIsCreated(); return transport; })) .Start(); using (var printTimer = new Timer(1000)) { printTimer.Elapsed += delegate { Console.WriteLine("Active connections: {0}", activeConnections.Count); }; printTimer.Start(); using (bus) { await Task.Delay(TimeSpan.FromSeconds(5)); } } }
/// <summary> /// Configures Rebus to use SQL Server as its transport. The table specified by <paramref name="tableName"/> will be used to /// store messages, and the "queue" specified by <paramref name="inputQueueName"/> will be used when querying for messages. /// The message table will automatically be created if it does not exist. /// </summary> public static void UseSqlServer(this StandardConfigurer<ITransport> configurer, string connectionStringOrConnectionStringName, string tableName, string inputQueueName) { configurer.Register(context => { var connectionProvider = new DbConnectionProvider(connectionStringOrConnectionStringName); var transport = new SqlServerTransport(connectionProvider, tableName, inputQueueName); transport.EnsureTableIsCreated(); return transport; }); }
/// <summary> /// Configures Rebus to use SQL Server as its transport. The table specified by <paramref name="tableName"/> will be used to /// store messages, and the "queue" specified by <paramref name="inputQueueName"/> will be used when querying for messages. /// The message table will automatically be created if it does not exist. /// </summary> public static void UseSqlServer(this StandardConfigurer <ITransport> configurer, string connectionStringOrConnectionStringName, string tableName, string inputQueueName) { configurer.Register(context => { var connectionProvider = new DbConnectionProvider(connectionStringOrConnectionStringName); var transport = new SqlServerTransport(connectionProvider, tableName, inputQueueName); transport.EnsureTableIsCreated(); return(transport); }); }
protected override void SetUp() { SqlTestHelper.DropTable(_tableName); _transport = new SqlServerTransport(new DbConnectionProvider(SqlTestHelper.ConnectionString), _tableName, QueueName); _transport.EnsureTableIsCreated(); Using(_transport); _transport.Initialize(); }
protected override void SetUp() { SqlTestHelper.DropTable(_tableName); var consoleLoggerFactory = new ConsoleLoggerFactory(false); var connectionProvider = new DbConnectionProvider(SqlTestHelper.ConnectionString, consoleLoggerFactory); _transport = new SqlServerTransport(connectionProvider, _tableName, QueueName, consoleLoggerFactory); _transport.EnsureTableIsCreated(); Using(_transport); _transport.Initialize(); }
static void Configure(StandardConfigurer<ITransport> configurer, string connectionString, string tableName, string inputQueueName) { configurer.Register(context => { var connectionProvider = new DbConnectionProvider(connectionString); var transport = new SqlServerTransport(connectionProvider, tableName, inputQueueName); transport.EnsureTableIsCreated(); return transport; }); configurer.OtherService<ITimeoutManager>().Register(c => new DisabledTimeoutManager()); configurer.OtherService<IPipeline>().Decorate(c => { var pipeline = c.Get<IPipeline>(); return new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof (HandleDeferredMessagesStep)); }); }
static void Configure(StandardConfigurer <ITransport> configurer, string connectionString, string tableName, string inputQueueName) { configurer.Register(context => { var rebusLoggerFactory = context.Get <IRebusLoggerFactory>(); var connectionProvider = new DbConnectionProvider(connectionString, rebusLoggerFactory); var transport = new SqlServerTransport(connectionProvider, tableName, inputQueueName, rebusLoggerFactory); transport.EnsureTableIsCreated(); return(transport); }); configurer.OtherService <ITimeoutManager>().Register(c => new DisabledTimeoutManager()); configurer.OtherService <IPipeline>().Decorate(c => { var pipeline = c.Get <IPipeline>(); return(new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof(HandleDeferredMessagesStep))); }); }