コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DoesJobExistQueryHandler{TConnection, TTransaction}" /> class.
        /// </summary>
        /// <param name="commandCache">The command cache.</param>
        /// <param name="connectionInformation">The connection information.</param>
        /// <param name="tableExists">The table exists.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="dbConnectionFactory">The database connection factory.</param>
        /// <param name="transactionFactory">The transaction factory.</param>
        /// <param name="prepareQuery">The prepare query.</param>
        /// <param name="readColumn">The read column.</param>
        public DoesJobExistQueryHandler(CommandStringCache commandCache,
                                        IConnectionInformation connectionInformation,
                                        IQueryHandler <GetTableExistsQuery, bool> tableExists,
                                        ITableNameHelper tableNameHelper,
                                        IDbConnectionFactory dbConnectionFactory,
                                        ITransactionFactory transactionFactory,
                                        IPrepareQueryHandler <DoesJobExistQuery <TConnection, TTransaction>, QueueStatuses> prepareQuery,
                                        IReadColumn readColumn)
        {
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => connectionInformation, connectionInformation);
            Guard.NotNull(() => tableExists, tableExists);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => dbConnectionFactory, dbConnectionFactory);
            Guard.NotNull(() => transactionFactory, transactionFactory);
            Guard.NotNull(() => prepareQuery, prepareQuery);
            Guard.NotNull(() => readColumn, readColumn);

            _commandCache          = commandCache;
            _connectionInformation = connectionInformation;
            _tableExists           = tableExists;
            _tableNameHelper       = tableNameHelper;
            _dbConnectionFactory   = dbConnectionFactory;
            _transactionFactory    = transactionFactory;
            _prepareQuery          = prepareQuery;
            _readColumn            = readColumn;
        }
コード例 #2
0
        /// <summary>Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class.</summary>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="connectionInformation">The connection information.</param>
        /// <param name="buildDequeueCommand">The build dequeue command.</param>
        /// <param name="messageDeQueue">The message de queue.</param>
        /// <param name="dbFactory">The transaction factory.</param>
        /// <param name="databaseExists">The database exists.</param>
        /// <param name="configuration">Queue configuration</param>
        public ReceiveMessageQueryHandler(ISqLiteMessageQueueTransportOptionsFactory optionsFactory,
                                          ITableNameHelper tableNameHelper,
                                          IConnectionInformation connectionInformation,
                                          BuildDequeueCommand buildDequeueCommand,
                                          MessageDeQueue messageDeQueue,
                                          IDbFactory dbFactory,
                                          DatabaseExists databaseExists,
                                          QueueConsumerConfiguration configuration)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => buildDequeueCommand, buildDequeueCommand);
            Guard.NotNull(() => messageDeQueue, messageDeQueue);
            Guard.NotNull(() => databaseExists, databaseExists);
            Guard.NotNull(() => dbFactory, dbFactory);
            Guard.NotNull(() => configuration, configuration);

            _options               = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper       = tableNameHelper;
            _connectionInformation = connectionInformation;
            _buildDequeueCommand   = buildDequeueCommand;
            _messageDeQueue        = messageDeQueue;
            _dbFactory             = dbFactory;
            _databaseExists        = databaseExists;
            _configuration         = configuration;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="serializer">The serializer.</param>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="commandCache">The command cache.</param>
        /// <param name="configurationSend">The configuration send.</param>
        /// <param name="sendJobStatus">The send job status.</param>
        /// <param name="jobExistsHandler">The job exists handler.</param>
        /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param>
        public SendMessageCommandHandler(ITableNameHelper tableNameHelper,
                                         ICompositeSerialization serializer,
                                         ISqlServerMessageQueueTransportOptionsFactory optionsFactory,
                                         IHeaders headers,
                                         SqlServerCommandStringCache commandCache,
                                         TransportConfigurationSend configurationSend,
                                         ICommandHandler <SetJobLastKnownEventCommand <SqlConnection, SqlTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <SqlConnection, SqlTransaction>, QueueStatuses> jobExistsHandler,
                                         IJobSchedulerMetaData jobSchedulerMetaData)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => serializer, serializer);
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => configurationSend, configurationSend);
            Guard.NotNull(() => sendJobStatus, sendJobStatus);
            Guard.NotNull(() => jobExistsHandler, jobExistsHandler);
            Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData);

            _tableNameHelper      = tableNameHelper;
            _serializer           = serializer;
            _options              = new Lazy <SqlServerMessageQueueTransportOptions>(optionsFactory.Create);
            _headers              = headers;
            _commandCache         = commandCache;
            _configurationSend    = configurationSend;
            _sendJobStatus        = sendJobStatus;
            _jobExistsHandler     = jobExistsHandler;
            _jobSchedulerMetaData = jobSchedulerMetaData;
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class.
        /// </summary>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="receivedMessageFactory">The received message factory.</param>
        /// <param name="commandCache">The command cache.</param>
        /// <param name="messageFactory">The message factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="serialization">The serialization.</param>
        /// <param name="getTimeFactory">The get time factory.</param>
        public ReceiveMessageQueryHandler(IPostgreSqlMessageQueueTransportOptionsFactory optionsFactory,
                                          ITableNameHelper tableNameHelper,
                                          IReceivedMessageFactory receivedMessageFactory,
                                          PostgreSqlCommandStringCache commandCache,
                                          IMessageFactory messageFactory,
                                          IHeaders headers,
                                          ICompositeSerialization serialization,
                                          IGetTimeFactory getTimeFactory)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => receivedMessageFactory, receivedMessageFactory);
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => messageFactory, messageFactory);
            Guard.NotNull(() => serialization, serialization);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => getTimeFactory, getTimeFactory);

            _options                = new Lazy <PostgreSqlMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper        = tableNameHelper;
            _receivedMessageFactory = receivedMessageFactory;
            _commandCache           = commandCache;
            _messageFactory         = messageFactory;
            _headers                = headers;
            _serialization          = serialization;
            _getTime                = getTimeFactory.Create();
        }
コード例 #5
0
        public VerifyErrorCounts(string queueName)
        {
            var queueConnection = new QueueConnection(queueName, ConnectionInfo.ConnectionString);

            _connection      = new SqlConnectionInformation(queueConnection);
            _tableNameHelper = new TableNameHelper(_connection);
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandStringCache" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        protected CommandStringCache(ITableNameHelper tableNameHelper)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);

            TableNameHelper      = tableNameHelper;
            CommandCache         = new Dictionary <CommandStringTypes, string>();
            _commandCacheRunTime = new ConcurrentDictionary <string, CommandString>();
        }
コード例 #7
0
        public VerifyQueueRecordCount(string queueName, PostgreSqlMessageQueueTransportOptions options)
        {
            var queueConnection = new QueueConnection(queueName, ConnectionInfo.ConnectionString);

            _options         = options;
            _connection      = new SqlConnectionInformation(queueConnection);
            _tableNameHelper = new TableNameHelper(_connection);
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildMoveToErrorQueueSql" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="getColumns">The column query.</param>
        public BuildMoveToErrorQueueSql(ITableNameHelper tableNameHelper,
                                        IGetColumnsFromTable getColumns)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => getColumns, getColumns);

            _tableNameHelper = tableNameHelper;
            _getColumns      = getColumns;
        }
コード例 #9
0
        /// <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(ITableNameHelper tableNameHelper,
                                            IPostgreSqlMessageQueueTransportOptionsFactory options)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => options, options);

            _tableNameHelper = tableNameHelper;
            _options         = new Lazy <PostgreSqlMessageQueueTransportOptions>(options.Create);
        }
コード例 #10
0
        internal static void BuildMetaCommand(NpgsqlCommand command,
                                              ITableNameHelper tableNameHelper,
                                              IHeaders headers,
                                              IAdditionalMessageData data,
                                              IMessage message,
                                              long id,
                                              PostgreSqlMessageQueueTransportOptions options,
                                              TimeSpan?delay,
                                              TimeSpan expiration,
                                              DateTime currentDateTime)
        {
            var sbMeta = new StringBuilder();

            sbMeta.AppendLine("Insert into " + tableNameHelper.MetaDataName);
            sbMeta.Append("(QueueID, CorrelationID, QueuedDateTime ");

            //add configurable columns - queue
            options.AddBuiltInColumns(sbMeta);

            //add configurable columns - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumns(sbMeta, data);
            }

            //close the column list
            sbMeta.AppendLine(") ");

            //add standard values that are always present
            sbMeta.Append("VALUES (");
            sbMeta.Append("@QueueID, @CorrelationID, now() at time zone 'utc' ");

            //add the values for built in fields
            options.AddBuiltInColumnValues(delay, expiration, currentDateTime, sbMeta);

            //add configurable column value - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsValues(sbMeta, data);
            }

            sbMeta.Append(")"); //close the VALUES

            command.CommandText = sbMeta.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value      = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

            //add configurable column command params - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsParams(command, data);
            }
        }
コード例 #11
0
        /// <summary>Initializes a new instance of the <see cref="SqlServerMessageQueueSchema"/> class.</summary>
        /// <param name="tableNameHelper">The table name helper. Note this is the base module</param>
        /// <param name="options">The options.</param>
        /// <param name="schema">The schema that the queue is using</param>
        public SqlServerMessageQueueSchema(TableNameHelper tableNameHelper,
                                           ISqlServerMessageQueueTransportOptionsFactory options, ISqlSchema schema)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => options, options);

            _tableNameHelper = tableNameHelper;
            _options         = new Lazy <SqlServerMessageQueueTransportOptions>(options.Create);
            _schema          = schema;
        }
コード例 #12
0
        internal static void BuildStatusCommand(IDbCommand command,
                                                ITableNameHelper tableNameHelper,
                                                IHeaders headers,
                                                IAdditionalMessageData data,
                                                IMessage message,
                                                long id,
                                                SqLiteMessageQueueTransportOptions options,
                                                DateTime currentDateTime)
        {
            var builder = new StringBuilder();

            builder.AppendLine("Insert into " + tableNameHelper.StatusName);
            builder.Append("(QueueID, Status, CorrelationID ");

            //add configurable columns - user
            AddUserColumns(builder, data);

            //close the column list
            builder.AppendLine(") ");

            //add standard values that are always present
            builder.Append("VALUES (");
            builder.Append($"@QueueID, {Convert.ToInt32(QueueStatuses.Waiting)}, @CorrelationID");

            //add configurable column value - user
            AddUserColumnsValues(builder, data);

            builder.Append(")"); //close the VALUES

            command.CommandText = builder.ToString();

            options.AddBuiltInColumnsParams(command, data, null, TimeSpan.Zero, currentDateTime);

            if (id > 0)
            {
                var paramid = command.CreateParameter();
                paramid.ParameterName = "@QueueID";
                paramid.DbType        = DbType.Int64;
                paramid.Value         = id;
                command.Parameters.Add(paramid);
            }

            var param = command.CreateParameter();

            param.ParameterName = "@CorrelationID";
            param.DbType        = DbType.StringFixedLength;
            param.Size          = 38;
            param.Value         = data.CorrelationId.Id.Value.ToString();
            command.Parameters.Add(param);

            //add configurable column command params - user
            AddUserColumnsParams(command, data);
        }
コード例 #13
0
        public CreateDequeueStatement(ISqlServerMessageQueueTransportOptionsFactory optionsFactory,
                                      ITableNameHelper tableNameHelper,
                                      SqlServerCommandStringCache commandCache)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => commandCache, commandCache);

            _options         = new Lazy <SqlServerMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper = tableNameHelper;
            _commandCache    = commandCache;
        }
コード例 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildMoveToErrorQueueSql" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="getColumns">The column query.</param>
        /// <param name="options">The options.</param>
        public BuildMoveToErrorQueueSql(ITableNameHelper tableNameHelper,
                                        IGetColumnsFromTable getColumns,
                                        ITransportOptionsFactory options)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => getColumns, getColumns);
            Guard.NotNull(() => options, options);

            _tableNameHelper = tableNameHelper;
            _getColumns      = getColumns;
            _options         = new Lazy <ITransportOptions>(options.Create);
        }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageCommandHandler" /> class.
 /// </summary>
 /// <param name="getUtcDateQuery">The get UTC date query.</param>
 /// <param name="options">The options.</param>
 /// <param name="tableNameHelper">The table name helper.</param>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="commandCache">The command cache.</param>
 public RollbackMessageCommandHandler(IGetTimeFactory getUtcDateQuery,
                                      IPostgreSqlMessageQueueTransportOptionsFactory options,
                                      ITableNameHelper tableNameHelper,
                                      IConnectionInformation connectionInformation,
                                      PostgreSqlCommandStringCache commandCache)
 {
     _getUtcDateQuery       = getUtcDateQuery;
     _options               = new Lazy <PostgreSqlMessageQueueTransportOptions>(options.Create);
     _tableNameHelper       = tableNameHelper;
     _connectionInformation = connectionInformation;
     _commandCache          = commandCache;
     _rollbackDictionary    = new ConcurrentDictionary <string, string>();
 }
コード例 #16
0
        internal static void BuildStatusCommand(NpgsqlCommand command,
                                                ITableNameHelper tableNameHelper,
                                                IHeaders headers,
                                                IAdditionalMessageData data,
                                                IMessage message,
                                                long id,
                                                PostgreSqlMessageQueueTransportOptions options)
        {
            var builder = new StringBuilder();

            builder.AppendLine("Insert into " + tableNameHelper.StatusName);
            builder.Append("(QueueID, Status, CorrelationID ");

            //add configurable columns - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumns(builder, data);
            }

            //close the column list
            builder.AppendLine(") ");

            //add standard values that are always present
            builder.Append("VALUES (");
            builder.Append($"@QueueID, {Convert.ToInt32(QueueStatuses.Waiting)}, @CorrelationID");

            //add configurable column value - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsValues(builder, data);
            }

            builder.Append(")"); //close the VALUES

            command.CommandText = builder.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value      = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

            //add configurable column command params - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsParams(command, data);
            }
        }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbackMessageCommandHandler" /> class.
 /// </summary>
 /// <param name="getUtcDateQuery">The get UTC date query.</param>
 /// <param name="options">The options.</param>
 /// <param name="tableNameHelper">The table name helper.</param>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="commandCache">The command cache.</param>
 /// <param name="dbFactory">The database factory.</param>
 /// <param name="databaseExists">The database exists.</param>
 public RollbackMessageCommandHandler(IGetTimeFactory getUtcDateQuery,
                                      ISqLiteMessageQueueTransportOptionsFactory options,
                                      ITableNameHelper tableNameHelper,
                                      IConnectionInformation connectionInformation,
                                      IDbCommandStringCache commandCache,
                                      IDbFactory dbFactory,
                                      DatabaseExists databaseExists)
 {
     _getUtcDateQuery       = getUtcDateQuery;
     _options               = new Lazy <SqLiteMessageQueueTransportOptions>(options.Create);
     _tableNameHelper       = tableNameHelper;
     _connectionInformation = connectionInformation;
     _commandCache          = commandCache;
     _rollbackDictionary    = new ConcurrentDictionary <string, string>();
     _dbFactory             = dbFactory;
     _databaseExists        = databaseExists;
 }
コード例 #18
0
        private static void BuildMetaCommand(IDbCommand command,
                                             ITableNameHelper tableNameHelper,
                                             IAdditionalMessageData data,
                                             SqLiteMessageQueueTransportOptions options,
                                             TimeSpan?delay,
                                             TimeSpan expiration,
                                             DateTime currentDateTime)
        {
            var sbMeta = new StringBuilder();

            sbMeta.AppendLine("Insert into " + tableNameHelper.MetaDataName);
            sbMeta.Append("(QueueID, CorrelationID, QueuedDateTime ");

            //add configurable columns - queue
            options.AddBuiltInColumns(sbMeta);

            //close the column list
            sbMeta.AppendLine(") ");

            //add standard values that are always present
            sbMeta.Append("VALUES (");
            sbMeta.Append("@QueueID, @CorrelationID, @CurrentDate ");

            //add the values for built in fields
            options.AddBuiltInColumnValues(sbMeta);

            sbMeta.Append(")"); //close the VALUES

            command.CommandText = sbMeta.ToString();

            options.AddBuiltInColumnsParams(command, data, delay, expiration, currentDateTime);

            var param = command.CreateParameter();

            param.ParameterName = "@CorrelationID";
            param.DbType        = DbType.StringFixedLength;
            param.Size          = 38;
            param.Value         = data.CorrelationId.Id.Value.ToString();
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CurrentDate";
            param.DbType        = DbType.Int64;
            param.Value         = currentDateTime.Ticks;
            command.Parameters.Add(param);
        }
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteQueueTablesCommandHandler" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="transactionFactory">The transaction factory.</param>
        /// <param name="dbConnectionFactory">The database connection factory.</param>
        /// <param name="prepareDeleteTable">The prepare delete table.</param>
        /// <param name="tableExists">The table exists.</param>
        public DeleteQueueTablesCommandHandler(
            ITableNameHelper tableNameHelper,
            ITransactionFactory transactionFactory,
            IDbConnectionFactory dbConnectionFactory,
            IPrepareCommandHandler <DeleteTableCommand> prepareDeleteTable,
            IQueryHandler <GetTableExistsTransactionQuery, bool> tableExists)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => dbConnectionFactory, dbConnectionFactory);
            Guard.NotNull(() => transactionFactory, transactionFactory);
            Guard.NotNull(() => prepareDeleteTable, prepareDeleteTable);
            Guard.NotNull(() => tableExists, tableExists);

            _tableNameHelper     = tableNameHelper;
            _transactionFactory  = transactionFactory;
            _dbConnectionFactory = dbConnectionFactory;
            _prepareDeleteTable  = prepareDeleteTable;
            _tableExists         = tableExists;
        }
コード例 #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JobTableCreation" /> 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 JobTableCreation(IQueryHandler <GetTableExistsQuery, bool> queryTableExists,
                                IJobSchema createSchema,
                                ICommandHandlerWithOutput <CreateJobTablesCommand <ITable>, QueueCreationResult> createCommand,
                                IConnectionInformation connectionInfo,
                                ITableNameHelper 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;
        }
コード例 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class.
        /// </summary>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="serializer">The serializer.</param>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="commandCache">The command cache.</param>
        /// <param name="configurationSend">The configuration send.</param>
        /// <param name="getTimeFactory">The get time factory.</param>
        /// <param name="dbFactory">The database factory.</param>
        /// <param name="sendJobStatus">The send job status.</param>
        /// <param name="jobExistsHandler">The job exists handler.</param>
        /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param>
        /// <param name="databaseExists">The database exists.</param>
        /// <param name="readerAsync">The reader asynchronous.</param>
        public SendMessageCommandHandlerAsync(ITableNameHelper tableNameHelper,
                                              ICompositeSerialization serializer,
                                              ISqLiteMessageQueueTransportOptionsFactory optionsFactory,
                                              IHeaders headers,
                                              IDbCommandStringCache commandCache,
                                              TransportConfigurationSend configurationSend,
                                              IGetTimeFactory getTimeFactory,
                                              IDbFactory dbFactory,
                                              ICommandHandler <SetJobLastKnownEventCommand <IDbConnection, IDbTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <IDbConnection, IDbTransaction>, QueueStatuses> jobExistsHandler,
                                              IJobSchedulerMetaData jobSchedulerMetaData,
                                              DatabaseExists databaseExists,
                                              IReaderAsync readerAsync)
        {
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => serializer, serializer);
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => configurationSend, configurationSend);
            Guard.NotNull(() => getTimeFactory, getTimeFactory);
            Guard.NotNull(() => sendJobStatus, sendJobStatus);
            Guard.NotNull(() => jobExistsHandler, jobExistsHandler);
            Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData);
            Guard.NotNull(() => databaseExists, databaseExists);
            Guard.NotNull(() => readerAsync, readerAsync);

            _tableNameHelper      = tableNameHelper;
            _serializer           = serializer;
            _options              = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create);
            _headers              = headers;
            _commandCache         = commandCache;
            _configurationSend    = configurationSend;
            _getTime              = getTimeFactory.Create();
            _dbFactory            = dbFactory;
            _sendJobStatus        = sendJobStatus;
            _jobExistsHandler     = jobExistsHandler;
            _jobSchedulerMetaData = jobSchedulerMetaData;
            _databaseExists       = databaseExists;
            _readerAsync          = readerAsync;
        }
コード例 #22
0
        internal static void BuildMetaCommand(SqlCommand command,
                                              ITableNameHelper tableNameHelper,
                                              IHeaders headers,
                                              IAdditionalMessageData data,
                                              IMessage message,
                                              long id,
                                              SqlServerMessageQueueTransportOptions options,
                                              TimeSpan?delay,
                                              TimeSpan expiration)
        {
            var sbMeta = new StringBuilder();

            sbMeta.AppendLine("Insert into " + tableNameHelper.MetaDataName);
            sbMeta.Append("(QueueID, CorrelationID, QueuedDateTime ");

            //add configurable columns - queue
            options.AddBuiltInColumns(sbMeta);

            //close the column list
            sbMeta.AppendLine(") ");

            //add standard values that are always present
            sbMeta.Append("VALUES (");
            sbMeta.Append("@QueueID, @CorrelationID, GetUTCDate() ");

            //add the values for built in fields
            options.AddBuiltInColumnValues(delay, expiration, sbMeta);

            sbMeta.Append(")"); //close the VALUES

            command.CommandText = sbMeta.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", SqlDbType.BigInt, 8).Value = id;
            command.Parameters.Add("@CorrelationID", SqlDbType.UniqueIdentifier, 16).Value = data.CorrelationId.Id.Value;
        }
コード例 #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetQueueOptionsQueryHandler{TTransportOptions}" /> class.
        /// </summary>
        /// <param name="serializer">The serializer.</param>
        /// <param name="tableExists">The table exists.</param>
        /// <param name="connectionInformation">The connection information.</param>
        /// <param name="prepareQuery">The prepare query.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="dbConnectionFactory">The database connection factory.</param>
        /// <param name="readColumn">The read column.</param>
        public GetQueueOptionsQueryHandler(IInternalSerializer serializer,
                                           IQueryHandler <GetTableExistsQuery, bool> tableExists,
                                           IConnectionInformation connectionInformation,
                                           IPrepareQueryHandler <GetQueueOptionsQuery <TTransportOptions>, TTransportOptions> prepareQuery,
                                           ITableNameHelper tableNameHelper,
                                           IDbConnectionFactory dbConnectionFactory,
                                           IReadColumn readColumn)
        {
            Guard.NotNull(() => serializer, serializer);
            Guard.NotNull(() => tableExists, tableExists);
            Guard.NotNull(() => prepareQuery, prepareQuery);
            Guard.NotNull(() => connectionInformation, connectionInformation);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => dbConnectionFactory, dbConnectionFactory);
            Guard.NotNull(() => readColumn, readColumn);

            _serializer            = serializer;
            _tableExists           = tableExists;
            _connectionInformation = connectionInformation;
            _prepareQuery          = prepareQuery;
            _tableNameHelper       = tableNameHelper;
            _dbConnectionFactory   = dbConnectionFactory;
            _readColumn            = readColumn;
        }
コード例 #24
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="PostgreSqlCommandStringCache" /> class.
 /// </summary>
 /// <param name="tableNameHelper">The table name helper.</param>
 public PostgreSqlCommandStringCache(ITableNameHelper tableNameHelper) : base(tableNameHelper)
 {
 }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqliteJobSchema"/> class.
 /// </summary>
 /// <param name="tableNameHelper">The table name helper.</param>
 public SqliteJobSchema(ITableNameHelper tableNameHelper)
 {
     _tableNameHelper = tableNameHelper;
 }
コード例 #26
0
 /// <summary>Initializes a new instance of the <see cref="SqlServerCommandStringCache"/> class.</summary>
 /// <param name="tableNameHelper">The table name helper.</param>
 /// <param name="schema">The schema that the queue is using</param>
 public SqlServerCommandStringCache(ITableNameHelper tableNameHelper, ISqlSchema schema) : base(tableNameHelper)
 {
     _schema = schema;
 }
コード例 #27
0
        internal static IDbCommand CreateMetaDataRecord(TimeSpan?delay, TimeSpan expiration, IDbConnection connection,
                                                        IMessage message, IAdditionalMessageData data, ITableNameHelper tableNameHelper,
                                                        IHeaders headers, SqLiteMessageQueueTransportOptions options, IGetTime getTime)
        {
            var command = connection.CreateCommand();

            BuildMetaCommand(command, tableNameHelper, data, options, delay, expiration, getTime.GetCurrentUtcDate());
            return(command);
        }
コード例 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IDbCommandStringCache" /> class.
 /// </summary>
 /// <param name="tableNameHelper">The table name helper.</param>
 public IDbCommandStringCache(ITableNameHelper tableNameHelper) : base(tableNameHelper)
 {
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostgreSqlJobSchema"/> class.
 /// </summary>
 /// <param name="tableNameHelper">The table name helper.</param>
 public PostgreSqlJobSchema(ITableNameHelper tableNameHelper)
 {
     _tableNameHelper = tableNameHelper;
 }
コード例 #30
0
 /// <summary>Initializes a new instance of the <see cref="SqlServerJobSchema"/> class.</summary>
 /// <param name="tableNameHelper">The table name helper. Note this is the base module</param>
 /// <param name="schema">The schema that the queue is using</param>
 public SqlServerJobSchema(TableNameHelper tableNameHelper, ISqlSchema schema)
 {
     _tableNameHelper = tableNameHelper;
     _schema          = schema;
 }