/// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class.
        /// </summary>
        /// <param name="serializer">The serializer.</param>
        /// <param name="receivedMessageFactory">The received message factory.</param>
        /// <param name="deleteMessage">The delete message.</param>
        /// <param name="redisHeaders">The redisHeaders.</param>
        /// <param name="dequeueLua">The dequeue.</param>
        /// <param name="dequeueRpcLua">The dequeue RPC.</param>
        /// <param name="unixTimeFactory">The unix time factory.</param>
        /// <param name="messageFactory">The message factory.</param>
        public ReceiveMessageQueryHandler(
            ICompositeSerialization serializer,
            IReceivedMessageFactory receivedMessageFactory,
            ICommandHandlerWithOutput <DeleteMessageCommand, bool> deleteMessage,
            RedisHeaders redisHeaders,
            DequeueLua dequeueLua,
            DequeueRpcLua dequeueRpcLua,
            IUnixTimeFactory unixTimeFactory,
            IMessageFactory messageFactory)
        {
            Guard.NotNull(() => serializer, serializer);
            Guard.NotNull(() => receivedMessageFactory, receivedMessageFactory);
            Guard.NotNull(() => deleteMessage, deleteMessage);
            Guard.NotNull(() => redisHeaders, redisHeaders);
            Guard.NotNull(() => dequeueLua, dequeueLua);
            Guard.NotNull(() => dequeueRpcLua, dequeueRpcLua);
            Guard.NotNull(() => unixTimeFactory, unixTimeFactory);

            _serializer             = serializer;
            _receivedMessageFactory = receivedMessageFactory;
            _deleteMessage          = deleteMessage;
            _redisHeaders           = redisHeaders;
            _dequeueLua             = dequeueLua;
            _dequeueRpcLua          = dequeueRpcLua;
            _unixTimeFactory        = unixTimeFactory;
            _messageFactory         = messageFactory;
        }
Example #2
0
        /// <summary>Initializes a new instance of the <see cref="LiteDbMessageQueueCreation"/> class.</summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="queryTableExists">The query table exists.</param>
        /// <param name="options">The options.</param>
        /// <param name="createSchema">The create schema.</param>
        /// <param name="createCommand">The create command.</param>
        /// <param name="deleteCommand">The delete command.</param>
        /// <param name="creationScope">The creation scope.</param>
        /// <param name="connectionManager">DB Connection manager</param>
        public LiteDbMessageQueueCreation(IConnectionInformation connectionInfo, IQueryHandler <GetTableExistsQuery, bool> queryTableExists,
                                          ILiteDbMessageQueueTransportOptionsFactory options,
                                          LiteDbMessageQueueSchema createSchema,
                                          ICommandHandlerWithOutput <CreateQueueTablesAndSaveConfigurationCommand <ITable>, QueueCreationResult> createCommand,
                                          ICommandHandlerWithOutput <DeleteQueueTablesCommand, QueueRemoveResult> deleteCommand,
                                          ICreationScope creationScope,
                                          LiteDbConnectionManager connectionManager
                                          )
        {
            Guard.NotNull(() => options, options);
            Guard.NotNull(() => createSchema, createSchema);
            Guard.NotNull(() => queryTableExists, queryTableExists);
            Guard.NotNull(() => createCommand, createCommand);
            Guard.NotNull(() => deleteCommand, deleteCommand);
            Guard.NotNull(() => creationScope, creationScope);
            Guard.NotNull(() => connectionManager, connectionManager);

            _options           = new Lazy <LiteDbMessageQueueTransportOptions>(options.Create);
            _createSchema      = createSchema;
            _queryTableExists  = queryTableExists;
            _createCommand     = createCommand;
            _deleteCommand     = deleteCommand;
            ConnectionInfo     = connectionInfo;
            Scope              = creationScope;
            _connectionManager = connectionManager;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SendMessageCommandHandlerDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public SendMessageCommandHandlerDecorator(ICommandHandlerWithOutput <SendMessageCommand, long> handler, ActivitySource tracer,
                                           IHeaders headers, IConnectionInformation connectionInformation)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
     _connectionInformation = connectionInformation;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueSendHeartBeat"/> class.
        /// </summary>
        /// <param name="sendHeartBeat">The send heart beat.</param>
        /// <param name="unixTimeFactory">The unix time factory.</param>
        public RedisQueueSendHeartBeat(ICommandHandlerWithOutput<SendHeartBeatCommand, long> sendHeartBeat, 
            IUnixTimeFactory unixTimeFactory)
        {
            Guard.NotNull(() => sendHeartBeat, sendHeartBeat);
            Guard.NotNull(() => unixTimeFactory, unixTimeFactory);

            _sendHeartBeat = sendHeartBeat;
            _unixTimeFactory = unixTimeFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RetryCommandHandlerOutputDecorator{TCommand,TOutput}" /> class.
        /// </summary>
        /// <param name="decorated">The decorated.</param>
        /// <param name="policies">The policies.</param>
        public RetryCommandHandlerOutputDecorator(ICommandHandlerWithOutput <TCommand, TOutput> decorated,
                                                  IPolicies policies)
        {
            Guard.NotNull(() => decorated, decorated);
            Guard.NotNull(() => policies, policies);

            _decorated = decorated;
            _policies  = policies;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueSendHeartBeat"/> class.
        /// </summary>
        /// <param name="sendHeartBeat">The send heart beat.</param>
        /// <param name="unixTimeFactory">The unix time factory.</param>
        public RedisQueueSendHeartBeat(ICommandHandlerWithOutput <SendHeartBeatCommand <string>, long> sendHeartBeat,
                                       IUnixTimeFactory unixTimeFactory)
        {
            Guard.NotNull(() => sendHeartBeat, sendHeartBeat);
            Guard.NotNull(() => unixTimeFactory, unixTimeFactory);

            _sendHeartBeat   = sendHeartBeat;
            _unixTimeFactory = unixTimeFactory;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqliteSendToJobQueue" /> class.
 /// </summary>
 /// <param name="queue">The queue.</param>
 /// <param name="doesJobExist">Query for determining if a job already exists</param>
 /// <param name="deleteMessageCommand">The delete message command.</param>
 /// <param name="getJobId">The get job identifier.</param>
 /// <param name="createJobMetaData">The create job meta data.</param>
 /// <param name="getTimeFactory">The get time factory.</param>
 public SqliteSendToJobQueue(IProducerMethodQueue queue, IQueryHandler<DoesJobExistQuery, QueueStatuses> doesJobExist,
     ICommandHandlerWithOutput<DeleteMessageCommand, long> deleteMessageCommand,
     IQueryHandler<GetJobIdQuery, long> getJobId, CreateJobMetaData createJobMetaData,
     IGetTimeFactory getTimeFactory): base(queue, getTimeFactory)
 {
     _doesJobExist = doesJobExist;
     _deleteMessageCommand = deleteMessageCommand;
     _getJobId = getJobId;
     _createJobMetaData = createJobMetaData;
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqliteSendToJobQueue" /> class.
 /// </summary>
 /// <param name="queue">The queue.</param>
 /// <param name="doesJobExist">Query for determining if a job already exists</param>
 /// <param name="deleteMessageCommand">The delete message command.</param>
 /// <param name="getJobId">The get job identifier.</param>
 /// <param name="createJobMetaData">The create job meta data.</param>
 /// <param name="getTimeFactory">The get time factory.</param>
 public SqliteSendToJobQueue(IProducerMethodQueue queue, IQueryHandler <DoesJobExistQuery <IDbConnection, IDbTransaction>, QueueStatuses> doesJobExist,
                             ICommandHandlerWithOutput <DeleteMessageCommand, long> deleteMessageCommand,
                             IQueryHandler <GetJobIdQuery, long> getJobId, CreateJobMetaData createJobMetaData,
                             IGetTimeFactory getTimeFactory) : base(queue, getTimeFactory)
 {
     _doesJobExist         = doesJobExist;
     _deleteMessageCommand = deleteMessageCommand;
     _getJobId             = getJobId;
     _createJobMetaData    = createJobMetaData;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteMessageCommandDecorator" /> class.
 /// </summary>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="decorated">The decorated.</param>
 /// <param name="databaseExists">The database exists.</param>
 public ResetHeartBeatCommandDecorator(IConnectionInformation connectionInformation,
                                       ICommandHandlerWithOutput <ResetHeartBeatCommand <long>, long> decorated,
                                       DatabaseExists databaseExists)
 {
     Guard.NotNull(() => decorated, decorated);
     Guard.NotNull(() => connectionInformation, connectionInformation);
     Guard.NotNull(() => databaseExists, databaseExists);
     _connectionInformation = connectionInformation;
     _decorated             = decorated;
     _databaseExists        = databaseExists;
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteMessageCommandDecorator" /> class.
 /// </summary>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="decorated">The decorated.</param>
 /// <param name="databaseExists">The database exists.</param>
 public DeleteMessageCommandDecorator(IConnectionInformation connectionInformation,
                                      ICommandHandlerWithOutput <DeleteMessageCommand, long> decorated,
                                      DatabaseExists databaseExists)
 {
     Guard.NotNull(() => decorated, decorated);
     Guard.NotNull(() => connectionInformation, connectionInformation);
     Guard.NotNull(() => databaseExists, databaseExists);
     _connectionInformation = connectionInformation;
     _decorated             = decorated;
     _databaseExists        = databaseExists;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteQueueTablesDecorator" /> class.
 /// </summary>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="decorated">The decorated.</param>
 /// <param name="databaseExists">The database exists.</param>
 public DeleteQueueTablesDecorator(IConnectionInformation connectionInformation,
                                   ICommandHandlerWithOutput <DeleteQueueTablesCommand, QueueRemoveResult> decorated,
                                   DatabaseExists databaseExists)
 {
     Guard.NotNull(() => decorated, decorated);
     Guard.NotNull(() => connectionInformation, connectionInformation);
     Guard.NotNull(() => databaseExists, databaseExists);
     _connectionInformation = connectionInformation;
     _decorated             = decorated;
     _databaseExists        = databaseExists;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqLiteMessageQueueSend" /> class.
 /// </summary>
 /// <param name="sentMessageFactory">The sent message factory.</param>
 /// <param name="sendMessage">The send message.</param>
 /// <param name="sendMessageAsync">The send message asynchronous.</param>
 public SqLiteMessageQueueSend(ISentMessageFactory sentMessageFactory,
     ICommandHandlerWithOutput<SendMessageCommand, long> sendMessage, 
     ICommandHandlerWithOutputAsync<SendMessageCommand, long> sendMessageAsync)
 {
     Guard.NotNull(() => sentMessageFactory, sentMessageFactory);
     Guard.NotNull(() => sendMessage, sendMessage);
     Guard.NotNull(() => sendMessageAsync, sendMessageAsync);
     _sentMessageFactory = sentMessageFactory;
     _sendMessage = sendMessage;
     _sendMessageAsync = sendMessageAsync;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisSendJobToQueue" /> class.
 /// </summary>
 /// <param name="queue">The queue.</param>
 /// <param name="doesJobExist">Query for determining if a job already exists</param>
 /// <param name="deleteMessageCommand">The delete message command.</param>
 /// <param name="getJobId">The get job identifier.</param>
 /// <param name="getTimeFactory">The get time factory.</param>
 /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param>
 public RedisSendJobToQueue(IProducerMethodQueue queue, IQueryHandler<DoesJobExistQuery, QueueStatuses> doesJobExist,
     ICommandHandlerWithOutput<DeleteMessageCommand, bool> deleteMessageCommand,
     IQueryHandler<GetJobIdQuery, string> getJobId, 
     IGetTimeFactory getTimeFactory, 
     IJobSchedulerMetaData jobSchedulerMetaData): base(queue, getTimeFactory)
 {
     _doesJobExist = doesJobExist;
     _deleteMessageCommand = deleteMessageCommand;
     _getJobId = getJobId;
     _jobSchedulerMetaData = jobSchedulerMetaData;
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisSendJobToQueue" /> class.
 /// </summary>
 /// <param name="queue">The queue.</param>
 /// <param name="doesJobExist">Query for determining if a job already exists</param>
 /// <param name="deleteMessageCommand">The delete message command.</param>
 /// <param name="getJobId">The get job identifier.</param>
 /// <param name="getTimeFactory">The get time factory.</param>
 /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param>
 public RedisSendJobToQueue(IProducerMethodQueue queue, IQueryHandler <DoesJobExistQuery, QueueStatuses> doesJobExist,
                            ICommandHandlerWithOutput <DeleteMessageCommand, bool> deleteMessageCommand,
                            IQueryHandler <GetJobIdQuery, string> getJobId,
                            IGetTimeFactory getTimeFactory,
                            IJobSchedulerMetaData jobSchedulerMetaData) : base(queue, getTimeFactory)
 {
     _doesJobExist         = doesJobExist;
     _deleteMessageCommand = deleteMessageCommand;
     _getJobId             = getJobId;
     _jobSchedulerMetaData = jobSchedulerMetaData;
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendMessages" /> class.
 /// </summary>
 /// <param name="sentMessageFactory">The sent message factory.</param>
 /// <param name="sendMessage">The send message.</param>
 /// <param name="sendMessageAsync">The send message asynchronous.</param>
 public SendMessages(ISentMessageFactory sentMessageFactory,
                     ICommandHandlerWithOutput <SendMessageCommand, long> sendMessage,
                     ICommandHandlerWithOutputAsync <SendMessageCommand, long> sendMessageAsync)
 {
     Guard.NotNull(() => sentMessageFactory, sentMessageFactory);
     Guard.NotNull(() => sendMessage, sendMessage);
     Guard.NotNull(() => sendMessageAsync, sendMessageAsync);
     _sentMessageFactory = sentMessageFactory;
     _sendMessage        = sendMessage;
     _sendMessageAsync   = sendMessageAsync;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PostgreSqlMessageQueueClearExpiredMessages" /> class.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="findExpiredMessagesQueryHandler">The find expired messages query handler.</param>
        /// <param name="deleteMessageCommandHandler">The delete message command handler.</param>
        public PostgreSqlMessageQueueClearExpiredMessages(IConnectionInformation connectionInfo,
            IQueryHandler<FindExpiredMessagesToDeleteQuery, IEnumerable<long>> findExpiredMessagesQueryHandler, 
            ICommandHandlerWithOutput<DeleteMessageCommand, long> deleteMessageCommandHandler)
        {
            Guard.NotNull(() => connectionInfo, connectionInfo);
            Guard.NotNull(() => findExpiredMessagesQueryHandler, findExpiredMessagesQueryHandler);
            Guard.NotNull(() => deleteMessageCommandHandler, deleteMessageCommandHandler);

            _connectionInfo = connectionInfo;
            _findExpiredMessagesQueryHandler = findExpiredMessagesQueryHandler;
            _deleteMessageCommandHandler = deleteMessageCommandHandler;
        }
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClearExpiredMessages" /> class.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="findExpiredMessagesQueryHandler">The find expired messages query handler.</param>
        /// <param name="deleteMessageCommandHandler">The delete message command handler.</param>
        public ClearExpiredMessages(IConnectionInformation connectionInfo,
                                    IQueryHandler <FindExpiredMessagesToDeleteQuery, IEnumerable <long> > findExpiredMessagesQueryHandler,
                                    ICommandHandlerWithOutput <DeleteMessageCommand, long> deleteMessageCommandHandler)
        {
            Guard.NotNull(() => connectionInfo, connectionInfo);
            Guard.NotNull(() => findExpiredMessagesQueryHandler, findExpiredMessagesQueryHandler);
            Guard.NotNull(() => deleteMessageCommandHandler, deleteMessageCommandHandler);

            _connectionInfo = connectionInfo;
            _findExpiredMessagesQueryHandler = findExpiredMessagesQueryHandler;
            _deleteMessageCommandHandler     = deleteMessageCommandHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ResetHeartBeat"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="commandHandler">The command handler.</param>
        /// <param name="queryHandler">The query handler.</param>
        public ResetHeartBeat(QueueConsumerConfiguration configuration,
                              ICommandHandlerWithOutput <ResetHeartBeatCommand, long> commandHandler,
                              IQueryHandler <FindMessagesToResetByHeartBeatQuery, IEnumerable <MessageToReset> > queryHandler)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => commandHandler, commandHandler);
            Guard.NotNull(() => queryHandler, queryHandler);

            _configuration  = configuration;
            _commandHandler = commandHandler;
            _queryHandler   = queryHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerMessageQueueResetHeartBeat"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="commandHandler">The command handler.</param>
        /// <param name="queryHandler">The query handler.</param>
        public SqlServerMessageQueueResetHeartBeat(QueueConsumerConfiguration configuration, 
            ICommandHandlerWithOutput<ResetHeartBeatCommand, long> commandHandler, 
            IQueryHandler<FindMessagesToResetByHeartBeatQuery, IEnumerable<MessageToReset>> queryHandler)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => commandHandler, commandHandler);
            Guard.NotNull(() => queryHandler, queryHandler);

            _configuration = configuration;
            _commandHandler = commandHandler;
            _queryHandler = queryHandler;
        }
Example #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResetHeartBeat{T}"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="commandHandler">The command handler.</param>
        /// <param name="queryHandler">The query handler.</param>
        /// <param name="getTime">The get time.</param>
        public ResetHeartBeat(QueueConsumerConfiguration configuration,
                              ICommandHandlerWithOutput <ResetHeartBeatCommand <T>, long> commandHandler,
                              IQueryHandler <FindMessagesToResetByHeartBeatQuery <T>, IEnumerable <MessageToReset <T> > > queryHandler,
                              IGetTimeFactory getTime)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => commandHandler, commandHandler);
            Guard.NotNull(() => queryHandler, queryHandler);

            _configuration  = configuration;
            _commandHandler = commandHandler;
            _queryHandler   = queryHandler;
            _getTime        = getTime.Create();
        }
Example #21
0
        public CreateQueueTablesAndSaveConfigurationDecorator(IConnectionInformation connectionInformation,
                                                              ICommandHandlerWithOutput <CreateQueueTablesAndSaveConfigurationCommand <ITable>, QueueCreationResult> decorated,
                                                              IGetFileNameFromConnectionString getFileNameFromConnection,
                                                              DatabaseExists databaseExists)
        {
            Guard.NotNull(() => connectionInformation, connectionInformation);
            Guard.NotNull(() => decorated, decorated);
            Guard.NotNull(() => getFileNameFromConnection, getFileNameFromConnection);
            Guard.NotNull(() => databaseExists, databaseExists);

            _connectionInformation     = connectionInformation;
            _decorated                 = decorated;
            _getFileNameFromConnection = getFileNameFromConnection;
            _databaseExists            = databaseExists;
        }
Example #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueSend" /> class.
        /// </summary>
        /// <param name="sentMessageFactory">The sent message factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="sendMessage">The send message.</param>
        /// <param name="sendMessageBatch">The send message batch.</param>
        /// <param name="sendMessageAsync">The send message asynchronous.</param>
        /// <param name="sendMessageBatchAsync">The send message batch asynchronous.</param>
        public RedisQueueSend(ISentMessageFactory sentMessageFactory,
            RedisHeaders headers, ICommandHandlerWithOutput<SendMessageCommand, string> sendMessage, ICommandHandlerWithOutput<SendMessageCommandBatch, QueueOutputMessages> sendMessageBatch, ICommandHandlerWithOutput<SendMessageCommand, Task<string>> sendMessageAsync, ICommandHandlerWithOutput<SendMessageCommandBatch, Task<QueueOutputMessages>> sendMessageBatchAsync)
        {
            Guard.NotNull(() => sentMessageFactory, sentMessageFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => sendMessage, sendMessage);
            Guard.NotNull(() => sendMessageBatch, sendMessageBatch);
            Guard.NotNull(() => sendMessageBatchAsync, sendMessageBatchAsync);
            Guard.NotNull(() => sentMessageFactory, sentMessageFactory);

            _headers = headers;
            _sendMessage = sendMessage;
            _sendMessageBatch = sendMessageBatch;
            _sendMessageAsync = sendMessageAsync;
            _sendMessageBatchAsync = sendMessageBatchAsync;
            _sentMessageFactory = sentMessageFactory;
        }
Example #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueSend" /> class.
        /// </summary>
        /// <param name="sentMessageFactory">The sent message factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="sendMessage">The send message.</param>
        /// <param name="sendMessageBatch">The send message batch.</param>
        /// <param name="sendMessageAsync">The send message asynchronous.</param>
        /// <param name="sendMessageBatchAsync">The send message batch asynchronous.</param>
        public RedisQueueSend(ISentMessageFactory sentMessageFactory,
                              RedisHeaders headers, ICommandHandlerWithOutput <SendMessageCommand, string> sendMessage, ICommandHandlerWithOutput <SendMessageCommandBatch, QueueOutputMessages> sendMessageBatch, ICommandHandlerWithOutput <SendMessageCommand, Task <string> > sendMessageAsync, ICommandHandlerWithOutput <SendMessageCommandBatch, Task <QueueOutputMessages> > sendMessageBatchAsync)
        {
            Guard.NotNull(() => sentMessageFactory, sentMessageFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => sendMessage, sendMessage);
            Guard.NotNull(() => sendMessageBatch, sendMessageBatch);
            Guard.NotNull(() => sendMessageBatchAsync, sendMessageBatchAsync);
            Guard.NotNull(() => sentMessageFactory, sentMessageFactory);

            _headers               = headers;
            _sendMessage           = sendMessage;
            _sendMessageBatch      = sendMessageBatch;
            _sendMessageAsync      = sendMessageAsync;
            _sendMessageBatchAsync = sendMessageBatchAsync;
            _sentMessageFactory    = sentMessageFactory;
        }
Example #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommitMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="deleteStatusCommandHandler">The delete status command handler.</param>
        /// <param name="deleteMessageCommand">The delete message command.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="deleteTransactionalMessageCommand">The delete transactional message command.</param>
        public CommitMessage(QueueConsumerConfiguration configuration, 
            ICommandHandler<DeleteStatusTableStatusCommand> deleteStatusCommandHandler,
            ICommandHandlerWithOutput<DeleteMessageCommand, long> deleteMessageCommand,
            SqlHeaders headers, 
            ICommandHandlerWithOutput<DeleteTransactionalMessageCommand, long> deleteTransactionalMessageCommand)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => deleteStatusCommandHandler, deleteStatusCommandHandler);
            Guard.NotNull(() => deleteMessageCommand, deleteMessageCommand);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => deleteTransactionalMessageCommand, deleteTransactionalMessageCommand);

            _configuration = configuration;
            _deleteStatusCommandHandler = deleteStatusCommandHandler;
            _deleteMessageCommand = deleteMessageCommand;
            _headers = headers;
            _deleteTransactionalMessageCommand = deleteTransactionalMessageCommand;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoveMessage"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="deleteStatusCommandHandler">The delete status command handler.</param>
        /// <param name="deleteMessageCommand">The delete message command.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="deleteTransactionalMessageCommand">The delete transactional message command.</param>
        public RemoveMessage(QueueConsumerConfiguration configuration,
                             ICommandHandler <DeleteStatusTableStatusCommand <long> > deleteStatusCommandHandler,
                             ICommandHandlerWithOutput <DeleteMessageCommand <long>, long> deleteMessageCommand,
                             IConnectionHeader <NpgsqlConnection, NpgsqlTransaction, NpgsqlCommand> headers,
                             ICommandHandlerWithOutput <DeleteTransactionalMessageCommand, long> deleteTransactionalMessageCommand)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => deleteStatusCommandHandler, deleteStatusCommandHandler);
            Guard.NotNull(() => deleteMessageCommand, deleteMessageCommand);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => deleteTransactionalMessageCommand, deleteTransactionalMessageCommand);

            _configuration = configuration;
            _deleteStatusCommandHandler = deleteStatusCommandHandler;
            _deleteMessageCommand       = deleteMessageCommand;
            _headers = headers;
            _deleteTransactionalMessageCommand = deleteTransactionalMessageCommand;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqliteJobTableCreation" /> 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 SqliteJobTableCreation(IQueryHandler<GetTableExistsQuery, bool> queryTableExists,
            SqliteJobSchema 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;
        }
Example #27
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 LiteDbJobTableCreation(IQueryHandler <GetTableExistsQuery, bool> queryTableExists,
                                      IJobSchema createSchema,
                                      ICommandHandlerWithOutput <CreateJobTablesCommand <ITable>, QueueCreationResult> createCommand,
                                      LiteDbConnectionManager 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;
        }
Example #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="deleteStatusCommandHandler">The delete status command handler.</param>
        /// <param name="deleteMessageCommand">The delete message command.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="deleteTransactionalMessageCommand">The delete transactional message command.</param>
        /// <param name="log">The log.</param>
        public RemoveMessage(QueueConsumerConfiguration configuration,
                             ICommandHandler <DeleteStatusTableStatusCommand> deleteStatusCommandHandler,
                             ICommandHandlerWithOutput <DeleteMessageCommand, long> deleteMessageCommand,
                             IConnectionHeader <SqlConnection, SqlTransaction, SqlCommand> headers,
                             ICommandHandlerWithOutput <DeleteTransactionalMessageCommand, long> deleteTransactionalMessageCommand,
                             ILogFactory log)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => deleteStatusCommandHandler, deleteStatusCommandHandler);
            Guard.NotNull(() => deleteMessageCommand, deleteMessageCommand);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => deleteTransactionalMessageCommand, deleteTransactionalMessageCommand);
            Guard.NotNull(() => log, log);

            _configuration = configuration;
            _deleteStatusCommandHandler = deleteStatusCommandHandler;
            _deleteMessageCommand       = deleteMessageCommand;
            _headers = headers;
            _deleteTransactionalMessageCommand = deleteTransactionalMessageCommand;
            _log = log.Create();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PostgreSqlMessageQueueCreation" /> class.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="queryTableExists">The query table exists.</param>
        /// <param name="options">The options.</param>
        /// <param name="createSchema">The create schema.</param>
        /// <param name="createCommand">The create command.</param>
        /// <param name="deleteCommand">The delete command.</param>
        /// <param name="creationScope">The creation scope.</param>
        public PostgreSqlMessageQueueCreation(IConnectionInformation connectionInfo, RelationalDatabase.IQueryHandler <GetTableExistsQuery, bool> queryTableExists,
                                              IPostgreSqlMessageQueueTransportOptionsFactory options,
                                              PostgreSqlMessageQueueSchema createSchema,
                                              ICommandHandlerWithOutput <CreateQueueTablesAndSaveConfigurationCommand <ITable>, QueueCreationResult> createCommand,
                                              ICommandHandlerWithOutput <DeleteQueueTablesCommand, QueueRemoveResult> deleteCommand,
                                              ICreationScope creationScope
                                              )
        {
            Guard.NotNull(() => options, options);
            Guard.NotNull(() => createSchema, createSchema);
            Guard.NotNull(() => queryTableExists, queryTableExists);
            Guard.NotNull(() => createCommand, createCommand);
            Guard.NotNull(() => deleteCommand, deleteCommand);
            Guard.NotNull(() => creationScope, creationScope);

            _options          = new Lazy <PostgreSqlMessageQueueTransportOptions>(options.Create);
            _createSchema     = createSchema;
            _queryTableExists = queryTableExists;
            _createCommand    = createCommand;
            _deleteCommand    = deleteCommand;
            ConnectionInfo    = connectionInfo;
            Scope             = creationScope;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerMessageQueueCreation" /> class.
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="queryTableExists">The query table exists.</param>
        /// <param name="options">The options.</param>
        /// <param name="createSchema">The create schema.</param>
        /// <param name="createCommand">The create command.</param>
        /// <param name="deleteCommand">The delete command.</param>
        /// <param name="creationScope">The creation scope.</param>
        public SqlServerMessageQueueCreation(IConnectionInformation connectionInfo,
            IQueryHandler<GetTableExistsQuery, bool> queryTableExists,
            ISqlServerMessageQueueTransportOptionsFactory options, 
            SqlServerMessageQueueSchema createSchema,
            ICommandHandlerWithOutput<CreateQueueTablesAndSaveConfigurationCommand, QueueCreationResult> createCommand,
            ICommandHandlerWithOutput<DeleteQueueTablesCommand, QueueRemoveResult> deleteCommand,
            ICreationScope creationScope
            )
        {
            Guard.NotNull(() => options, options);
            Guard.NotNull(() => createSchema, createSchema);
            Guard.NotNull(() => queryTableExists, queryTableExists);
            Guard.NotNull(() => createCommand, createCommand);
            Guard.NotNull(() => deleteCommand, deleteCommand);
            Guard.NotNull(() => creationScope, creationScope);

            _options = new Lazy<SqlServerMessageQueueTransportOptions>(options.Create);
            _createSchema = createSchema;
            _queryTableExists = queryTableExists;
            _createCommand = createCommand;
            _deleteCommand = deleteCommand;
            ConnectionInfo = connectionInfo;
            Scope = creationScope;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServerMessageQueueSendHeartBeat" /> class.
 /// </summary>
 /// <param name="commandHandler">The command handler.</param>
 public SqlServerMessageQueueSendHeartBeat(ICommandHandlerWithOutput<SendHeartBeatCommand, DateTime?> commandHandler)
 {
     Guard.NotNull(() => commandHandler, commandHandler);
     _commandHandler = commandHandler;
 }
Example #32
0
 /// <summary>Initializes a new instance of the <see cref="RemoveMessage"/> class.</summary>
 /// <param name="deleteMessage">The delete message.</param>
 public RemoveMessage(ICommandHandlerWithOutput <DeleteMessageCommand <string>, bool> deleteMessage)
 {
     _deleteMessage = deleteMessage;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisQueueResetHeartBeat"/> class.
 /// </summary>
 /// <param name="commandReset">The command reset.</param>
 public RedisQueueResetHeartBeat(ICommandHandlerWithOutput<ResetHeartBeatCommand, long> commandReset)
 {
     Guard.NotNull(() => commandReset, commandReset);
     _commandReset = commandReset;
 }
Example #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClearExpiredMessages" /> class.
 /// </summary>
 /// <param name="deleteMessageCommandHandler">The delete message command handler.</param>
 public RemoveMessage(ICommandHandlerWithOutput <DeleteMessageCommand, long> deleteMessageCommandHandler)
 {
     Guard.NotNull(() => deleteMessageCommandHandler, deleteMessageCommandHandler);
     _deleteMessageCommandHandler = deleteMessageCommandHandler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DelayedProcessingAction"/> class.
 /// </summary>
 /// <param name="moveRecords">The move records.</param>
 public DelayedProcessingAction(ICommandHandlerWithOutput<MoveDelayedRecordsCommand, long> moveRecords)
 {
     Guard.NotNull(() => moveRecords, moveRecords);
     _moveRecords = moveRecords;
 }
Example #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessage" /> class.
 /// </summary>
 /// <param name="command">The command.</param>
 public CommitMessage(ICommandHandlerWithOutput <CommitMessageCommand, bool> command)
 {
     Guard.NotNull(() => command, command);
     _command = command;
 }
Example #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendHeartBeat" /> class.
 /// </summary>
 /// <param name="commandHandler">The command handler.</param>
 public SendHeartBeat(ICommandHandlerWithOutput <SendHeartBeatCommand, DateTime?> commandHandler)
 {
     Guard.NotNull(() => commandHandler, commandHandler);
     _commandHandler = commandHandler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisQueueClearExpiredMessages"/> class.
 /// </summary>
 /// <param name="commandReset">The command reset.</param>
 public RedisQueueClearExpiredMessages(ICommandHandlerWithOutput<ClearExpiredMessagesCommand, long> commandReset)
 {
     _commandReset = commandReset;
 }
Example #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisQueueClearExpiredMessages"/> class.
 /// </summary>
 /// <param name="commandReset">The command reset.</param>
 public RedisQueueClearExpiredMessages(ICommandHandlerWithOutput <ClearExpiredMessagesCommand, long> commandReset)
 {
     _commandReset = commandReset;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateJobTablesCommandDecorator"/> class.
 /// </summary>
 /// <param name="decorated">The decorated.</param>
 public CreateJobTablesCommandDecorator(ICommandHandlerWithOutput <CreateJobTablesCommand <ITable>, QueueCreationResult> decorated)
 {
     Guard.NotNull(() => decorated, decorated);
     _decorated = decorated;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisQueueClearErrorMessages"/> class.
 /// </summary>
 /// <param name="getErrorMessages">The get error messages.</param>
 /// <param name="deleteMessage">The delete message.</param>
 public RedisQueueClearErrorMessages(IQueryHandler <GetErrorRecordsToDeleteQuery, List <string> > getErrorMessages,
                                     ICommandHandlerWithOutput <DeleteMessageCommand <string>, bool> deleteMessage)
 {
     _getErrorMessages = getErrorMessages;
     _deleteMessage    = deleteMessage;
 }
Example #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessage" /> class.
 /// </summary>
 /// <param name="deleteMessageCommand">The delete message command.</param>
 public CommitMessage(
     ICommandHandlerWithOutput<DeleteMessageCommand, long> deleteMessageCommand)
 {
     Guard.NotNull(() => deleteMessageCommand, deleteMessageCommand);
     _deleteMessageCommand = deleteMessageCommand;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisQueueResetHeartBeat"/> class.
 /// </summary>
 /// <param name="commandReset">The command reset.</param>
 public RedisQueueResetHeartBeat(ICommandHandlerWithOutput <ResetHeartBeatCommand <string>, List <ResetHeartBeatOutput> > commandReset)
 {
     Guard.NotNull(() => commandReset, commandReset);
     _commandReset = commandReset;
 }
Example #44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateQueueTablesAndSaveConfigurationDecorator"/> class.
 /// </summary>
 /// <param name="decorated">The decorated.</param>
 public CreateQueueTablesAndSaveConfigurationDecorator(ICommandHandlerWithOutput <CreateQueueTablesAndSaveConfigurationCommand <ITable>, QueueCreationResult> decorated)
 {
     Guard.NotNull(() => decorated, decorated);
     _decorated = decorated;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DelayedProcessingAction"/> class.
 /// </summary>
 /// <param name="moveRecords">The move records.</param>
 public DelayedProcessingAction(ICommandHandlerWithOutput <MoveDelayedRecordsCommand, long> moveRecords)
 {
     Guard.NotNull(() => moveRecords, moveRecords);
     _moveRecords = moveRecords;
 }
Example #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitMessage" /> class.
 /// </summary>
 /// <param name="command">The command.</param>
 public CommitMessage(ICommandHandlerWithOutput<CommitMessageCommand, bool> command)
 {
     Guard.NotNull(() => command, command);
     _command = command;
 }