/// <summary> /// Constructs the saga storage /// </summary> public PostgreSqlSagaStorage(PostgresConnectionHelper connectionHelper, string dataTableName, string indexTableName, IRebusLoggerFactory rebusLoggerFactory) { _connectionHelper = connectionHelper; _dataTableName = dataTableName; _indexTableName = indexTableName; _log = rebusLoggerFactory.GetCurrentClassLogger(); }
/// <summary> /// Constructs the subscription storage, storing subscriptions in the specified <paramref name="tableName"/>. /// If <paramref name="isCentralized"/> is true, subscribing/unsubscribing will be short-circuited by manipulating /// subscriptions directly, instead of requesting via messages /// </summary> public PostgreSqlSubscriptionStorage(PostgresConnectionHelper connectionHelper, string tableName, bool isCentralized, IRebusLoggerFactory rebusLoggerFactory) { _connectionHelper = connectionHelper; _tableName = tableName; IsCentralized = isCentralized; _log = rebusLoggerFactory.GetCurrentClassLogger(); }
/// <summary> /// Constructs the storage /// </summary> public PostgreSqlSagaSnapshotStorage(PostgresConnectionHelper connectionHelper, string tableName) { if (connectionHelper == null) throw new ArgumentNullException(nameof(connectionHelper)); if (tableName == null) throw new ArgumentNullException(nameof(tableName)); _connectionHelper = connectionHelper; _tableName = tableName; }
/// <summary> /// /// </summary> /// <param name="connectionHelper"></param> /// <param name="tableName"></param> /// <param name="inputQueueName"></param> /// <param name="rebusLoggerFactory"></param> /// <param name="asyncTaskFactory"></param> public PostgreSqlTransport(PostgresConnectionHelper connectionHelper, string tableName, string inputQueueName, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory) { if (connectionHelper == null) { throw new ArgumentNullException(nameof(connectionHelper)); } if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (rebusLoggerFactory == null) { throw new ArgumentNullException(nameof(rebusLoggerFactory)); } if (asyncTaskFactory == null) { throw new ArgumentNullException(nameof(asyncTaskFactory)); } _log = rebusLoggerFactory.GetLogger <PostgreSqlTransport>(); _connectionHelper = connectionHelper; _tableName = tableName; _inputQueueName = inputQueueName; _expiredMessagesCleanupTask = asyncTaskFactory.Create("ExpiredMessagesCleanup", PerformExpiredMessagesCleanupCycle, intervalSeconds: 60); ExpiredMessagesCleanupInterval = DefaultExpiredMessagesCleanupInterval; }
/// <summary> /// Constructs the timeout manager /// </summary> public PostgreSqlTimeoutManager(PostgresConnectionHelper connectionHelper, string tableName, IRebusLoggerFactory rebusLoggerFactory) { if (connectionHelper == null) throw new ArgumentNullException(nameof(connectionHelper)); if (tableName == null) throw new ArgumentNullException(nameof(tableName)); if (rebusLoggerFactory == null) throw new ArgumentNullException(nameof(rebusLoggerFactory)); _connectionHelper = connectionHelper; _tableName = tableName; _log = rebusLoggerFactory.GetCurrentClassLogger(); }
/// <summary> /// Constructs the saga storage /// </summary> public PostgreSqlSagaStorage(PostgresConnectionHelper connectionHelper, string dataTableName, string indexTableName, IRebusLoggerFactory rebusLoggerFactory) { if (connectionHelper == null) throw new ArgumentNullException(nameof(connectionHelper)); if (dataTableName == null) throw new ArgumentNullException(nameof(dataTableName)); if (indexTableName == null) throw new ArgumentNullException(nameof(indexTableName)); if (rebusLoggerFactory == null) throw new ArgumentNullException(nameof(rebusLoggerFactory)); _connectionHelper = connectionHelper; _dataTableName = dataTableName; _indexTableName = indexTableName; _log = rebusLoggerFactory.GetCurrentClassLogger(); }
/// <summary> /// Constructs the storage /// </summary> public PostgreSqlSagaSnapshotStorage(PostgresConnectionHelper connectionHelper, string tableName) { if (connectionHelper == null) { throw new ArgumentNullException(nameof(connectionHelper)); } if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } _connectionHelper = connectionHelper; _tableName = tableName; }
protected override void SetUp() { PostgreSqlTestHelper.DropTable(_tableName); var consoleLoggerFactory = new ConsoleLoggerFactory(false); var asyncTaskFactory = new TplAsyncTaskFactory(consoleLoggerFactory); var connectionHelper = new PostgresConnectionHelper(PostgreSqlTestHelper.ConnectionString); _transport = new PostgreSqlTransport(connectionHelper, _tableName, QueueName, consoleLoggerFactory, asyncTaskFactory, new DefaultRebusTime()); _transport.EnsureTableIsCreated(); Using(_transport); _transport.Initialize(); _cancellationToken = new CancellationTokenSource().Token; }
public PostgresDataAccess(IConfiguration config) { _config = config; var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); if (env == "Development") { _connectionString = _config["PostgresConnectionString"]; } else { string herokuPostgresURL = Environment.GetEnvironmentVariable(DATABASE_URL_NAME); _connectionString = PostgresConnectionHelper.ParseConnectionURL(herokuPostgresURL); } }
public NelsonHubSqlDataAccess(IConfiguration config) { _config = config; var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); if (env == "Development") { _connectionString = _config[CONNECTION_STRING_NAME]; } else { string postgresURL = Environment.GetEnvironmentVariable(DATABASE_URL_NAME); _connectionString = PostgresConnectionHelper.ParseConnectionURL(postgresURL); } }
/// <summary> /// Configures Rebus to use PostgreSQL to store subscriptions. Use <paramref name="isCentralized"/> = true to indicate whether it's OK to short-circuit /// subscribing and unsubscribing by manipulating the subscription directly from the subscriber or just let it default to false to preserve the /// default behavior. /// </summary> public static void StoreInPostgres(this StandardConfigurer <ISubscriptionStorage> configurer, string connectionString, string tableName, bool isCentralized = false, bool automaticallyCreateTables = true, Action <NpgsqlConnection> additionalConnectionSetup = null) { configurer.Register(c => { var rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var connectionHelper = new PostgresConnectionHelper(connectionString, additionalConnectionSetup); var subscriptionStorage = new PostgreSqlSubscriptionStorage( connectionHelper, tableName, isCentralized, rebusLoggerFactory); if (automaticallyCreateTables) { subscriptionStorage.EnsureTableIsCreated(); } return(subscriptionStorage); }); }
/// <summary> /// Constructs the timeout manager /// </summary> public PostgreSqlTimeoutManager(PostgresConnectionHelper connectionHelper, string tableName, IRebusLoggerFactory rebusLoggerFactory) { if (connectionHelper == null) { throw new ArgumentNullException(nameof(connectionHelper)); } if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (rebusLoggerFactory == null) { throw new ArgumentNullException(nameof(rebusLoggerFactory)); } _connectionHelper = connectionHelper; _tableName = tableName; _log = rebusLoggerFactory.GetLogger <PostgreSqlTimeoutManager>(); }
public ITransport Create(string inputQueueAddress) { var tableName = ("rebus_messages_" + TestConfig.Suffix).TrimEnd('_'); _tablesToDrop.Add(tableName); var consoleLoggerFactory = new ConsoleLoggerFactory(false); var connectionHelper = new PostgresConnectionHelper(PostgreSqlTestHelper.ConnectionString); var asyncTaskFactory = new TplAsyncTaskFactory(consoleLoggerFactory); var transport = new PostgreSqlTransport(connectionHelper, tableName, inputQueueAddress, consoleLoggerFactory, asyncTaskFactory); _disposables.Add(transport); transport.EnsureTableIsCreated(); transport.Initialize(); return(transport); }
static PostgreSqlTransport GetTransport() { var loggerFactory = new ConsoleLoggerFactory(false); var connectionProvider = new PostgresConnectionHelper(PostgreSqlTestHelper.ConnectionString); var asyncTaskFactory = new TplAsyncTaskFactory(loggerFactory); var transport = new PostgreSqlTransport( connectionProvider, TableName, QueueName, loggerFactory, asyncTaskFactory ); transport.EnsureTableIsCreated(); transport.Initialize(); return(transport); }
/// <summary> /// Constructs the subscription storage, storing subscriptions in the specified <paramref name="tableName"/>. /// If <paramref name="isCentralized"/> is true, subscribing/unsubscribing will be short-circuited by manipulating /// subscriptions directly, instead of requesting via messages /// </summary> public PostgreSqlSubscriptionStorage(PostgresConnectionHelper connectionHelper, string tableName, bool isCentralized, IRebusLoggerFactory rebusLoggerFactory) { if (connectionHelper == null) { throw new ArgumentNullException(nameof(connectionHelper)); } if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (rebusLoggerFactory == null) { throw new ArgumentNullException(nameof(rebusLoggerFactory)); } _connectionHelper = connectionHelper; _tableName = tableName; IsCentralized = isCentralized; _log = rebusLoggerFactory.GetLogger <PostgreSqlSubscriptionStorage>(); }
/// <summary> /// Constructs the saga storage /// </summary> public PostgreSqlSagaStorage(PostgresConnectionHelper connectionHelper, string dataTableName, string indexTableName, IRebusLoggerFactory rebusLoggerFactory) { if (connectionHelper == null) { throw new ArgumentNullException(nameof(connectionHelper)); } if (dataTableName == null) { throw new ArgumentNullException(nameof(dataTableName)); } if (indexTableName == null) { throw new ArgumentNullException(nameof(indexTableName)); } if (rebusLoggerFactory == null) { throw new ArgumentNullException(nameof(rebusLoggerFactory)); } _connectionHelper = connectionHelper; _dataTableName = dataTableName; _indexTableName = indexTableName; _log = rebusLoggerFactory.GetLogger <PostgreSqlSagaStorage>(); }
/// <summary> /// Configures Rebus to use PostgreSQL to store timeouts. /// </summary> public static void StoreInPostgres(this StandardConfigurer <ITimeoutManager> configurer, string connectionString, string tableName, bool automaticallyCreateTables = true, Action <NpgsqlConnection> additionalConnectionSetup = null) { var provider = new PostgresConnectionHelper(connectionString, additionalConnectionSetup); StoreInPostgres(configurer, provider, tableName, automaticallyCreateTables); }
/// <summary> /// Configures Rebus to use PostgreSQL to store sagas, using the tables specified to store data and indexed properties respectively. /// </summary> public static void StoreInPostgres(this StandardConfigurer <ISagaStorage> configurer, string connectionString, string dataTableName, string indexTableName, bool automaticallyCreateTables = true, Action <NpgsqlConnection> additionalConnectionSetup = null) { var provider = new PostgresConnectionHelper(connectionString, additionalConnectionSetup); StoreInPostgres(configurer, provider, dataTableName, indexTableName, automaticallyCreateTables); }
/// <summary> /// Constructs the storage /// </summary> public PostgreSqlSagaSnapshotStorage(PostgresConnectionHelper connectionHelper, string tableName) { _connectionHelper = connectionHelper; _tableName = tableName; }
/// <summary> /// Constructs the subscription storage, storing subscriptions in the specified <paramref name="tableName"/>. /// If <paramref name="isCentralized"/> is true, subscribing/unsubscribing will be short-circuited by manipulating /// subscriptions directly, instead of requesting via messages /// </summary> public PostgreSqlSubscriptionStorage(PostgresConnectionHelper connectionHelper, string tableName, bool isCentralized) { _connectionHelper = connectionHelper; _tableName = tableName; IsCentralized = isCentralized; }
public PostgresConnectionCounter(PostgresConnectionHelper innerPostgresConnectionHelper) { _innerPostgresConnectionHelper = innerPostgresConnectionHelper; }
/// <summary> /// Constructs the timeout manager /// </summary> public PostgreSqlTimeoutManager(PostgresConnectionHelper connectionHelper, string tableName, IRebusLoggerFactory rebusLoggerFactory) { _connectionHelper = connectionHelper; _tableName = tableName; _log = rebusLoggerFactory.GetCurrentClassLogger(); }
/// <summary> /// Constructs the saga storage /// </summary> public PostgreSqlSagaStorage(PostgresConnectionHelper connectionHelper, string dataTableName, string indexTableName) { _connectionHelper = connectionHelper; _dataTableName = dataTableName; _indexTableName = indexTableName; }
/// <summary> /// Constructs the timeout manager /// </summary> public PostgreSqlTimeoutManager(PostgresConnectionHelper connectionHelper, string tableName) { _connectionHelper = connectionHelper; _tableName = tableName; }