/// <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="commandCache">The command cache.</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="readerAsync">The reader asynchronous.</param> public ReceiveMessageQueryHandlerAsync(ISqLiteMessageQueueTransportOptionsFactory optionsFactory, TableNameHelper tableNameHelper, IDbCommandStringCache commandCache, IConnectionInformation connectionInformation, BuildDequeueCommand buildDequeueCommand, MessageDeQueue messageDeQueue, IDbFactory dbFactory, DatabaseExists databaseExists, IReaderAsync readerAsync) { Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => buildDequeueCommand, buildDequeueCommand); Guard.NotNull(() => messageDeQueue, messageDeQueue); Guard.NotNull(() => databaseExists, databaseExists); Guard.NotNull(() => readerAsync, readerAsync); _options = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create); _tableNameHelper = tableNameHelper; _commandCache = commandCache; _connectionInformation = connectionInformation; _buildDequeueCommand = buildDequeueCommand; _messageDeQueue = messageDeQueue; _dbFactory = dbFactory; _databaseExists = databaseExists; _readerAsync = readerAsync; }
internal static IDbCommand GetMainCommand(SendMessageCommand commandSend, IDbConnection connection, IDbCommandStringCache commandCache, IHeaders headers, ICompositeSerialization serializer) { var command = connection.CreateCommand(); command.CommandText = commandCache.GetCommand(CommandStringTypes.InsertMessageBody); var serialization = serializer.Serializer.MessageToBytes(new MessageBody { Body = commandSend.MessageToSend.Body }, commandSend.MessageToSend.Headers); var param = command.CreateParameter(); param.ParameterName = "@Body"; param.DbType = DbType.Binary; param.Value = serialization.Output; command.Parameters.Add(param); commandSend.MessageToSend.SetHeader(headers.StandardHeaders.MessageInterceptorGraph, serialization.Graph); param = command.CreateParameter(); param.ParameterName = "@Headers"; param.DbType = DbType.Binary; param.Value = serializer.InternalSerializer.ConvertToBytes(commandSend.MessageToSend.Headers); command.Parameters.Add(param); return(command); }
/// <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; }
/// <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(TableNameHelper 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; }
/// <summary> /// Initializes a new instance of the <see cref="SetJobLastKnownEventCommandHandler" /> class. /// </summary> /// <param name="commandCache">The command cache.</param> public SetJobLastKnownEventCommandHandler(IDbCommandStringCache commandCache) { Guard.NotNull(() => commandCache, commandCache); _commandCache = commandCache; }