/// <summary> /// Initializes a new instance of the <see cref="PostgreSqlMessageQueueSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="options">The options.</param> public PostgreSqlMessageQueueSchema(TableNameHelper tableNameHelper, IPostgreSqlMessageQueueTransportOptionsFactory options) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => options, options); _tableNameHelper = tableNameHelper; _options = new Lazy<PostgreSqlMessageQueueTransportOptions>(options.Create); }
/// <summary> /// Initializes a new instance of the <see cref="PostgreSqlCommandStringCache" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> public PostgreSqlCommandStringCache(TableNameHelper tableNameHelper) { Guard.NotNull(() => tableNameHelper, tableNameHelper); _tableNameHelper = tableNameHelper; _commandCache = new Dictionary<PostgreSqlCommandStringTypes, string>(); _commandCacheRunTime = new ConcurrentDictionary<string, string>(); BuildCommands(); }
public static void SetError(string queueName, string connectionString) { var connection = new SqlConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new NpgsqlConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"update {helper.StatusName} set status = 2"; command.ExecuteNonQuery(); } } }
public static void Verify(string queueName, string connectionString, long messageCount) { var connection = new SqlConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new NpgsqlConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"select count(*) from {helper.StatusName}"; using (var reader = command.ExecuteReader()) { Assert.True(reader.Read()); var records = reader.GetInt32(0); Assert.Equal(messageCount, records); } } } }
/// <summary> /// Initializes a new instance of the <see cref="PostgreSqlMessageQueueCreation" /> class. /// </summary> /// <param name="queryTableExists">The query table exists.</param> /// <param name="createSchema">The create schema.</param> /// <param name="createCommand">The create command.</param> /// <param name="connectionInfo">The connection information.</param> /// <param name="tableNameHelper">The table name helper.</param> public PostgreSqlJobTableCreation(IQueryHandler<GetTableExistsQuery, bool> queryTableExists, PostgreSqlJobSchema createSchema, ICommandHandlerWithOutput<CreateJobTablesCommand, QueueCreationResult> createCommand, IConnectionInformation connectionInfo, TableNameHelper tableNameHelper ) { Guard.NotNull(() => createSchema, createSchema); Guard.NotNull(() => queryTableExists, queryTableExists); Guard.NotNull(() => createCommand, createCommand); Guard.NotNull(() => connectionInfo, connectionInfo); Guard.NotNull(() => tableNameHelper, tableNameHelper); _createSchema = createSchema; _queryTableExists = queryTableExists; _createCommand = createCommand; _connection = connectionInfo; _tableNameHelper = tableNameHelper; }
/// <summary> /// Initializes a new instance of the <see cref="PostgreSqlJobSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> public PostgreSqlJobSchema(TableNameHelper tableNameHelper) { _tableNameHelper = tableNameHelper; }
private PostgreSqlMessageQueueSchema Create(IPostgreSqlMessageQueueTransportOptionsFactory options, TableNameHelper tableNameHelper) { return new PostgreSqlMessageQueueSchema(tableNameHelper, options); }
public VerifyQueueData(string queueName, PostgreSqlMessageQueueTransportOptions options) { _options = options; _connection = new SqlConnectionInformation(queueName, ConnectionInfo.ConnectionString); _tableNameHelper = new TableNameHelper(_connection); }
public VerifyErrorCounts(string queueName) { _connection = new SqlConnectionInformation(queueName, ConnectionInfo.ConnectionString); _tableNameHelper = new TableNameHelper(_connection); }