/// <summary>
        /// Initializes a new instance of the <see cref="MoveRecordToErrorQueueCommandHandler{TConnection, TTransaction, TCommand}" /> class.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="deleteMetaCommandHandler">The delete meta command handler.</param>
        /// <param name="setStatusCommandHandler">The set status command handler.</param>
        /// <param name="dbConnectionFactory">The database connection factory.</param>
        /// <param name="transactionFactory">The transaction factory.</param>
        /// <param name="prepareCommand">The prepare command.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="setCommandHandler">The set command handler.</param>
        public MoveRecordToErrorQueueCommandHandler(
            ITransportOptionsFactory options,
            ICommandHandler <DeleteMetaDataCommand> deleteMetaCommandHandler,
            ICommandHandler <SetStatusTableStatusTransactionCommand> setStatusCommandHandler,
            IDbConnectionFactory dbConnectionFactory,
            ITransactionFactory transactionFactory,
            IPrepareCommandHandler <MoveRecordToErrorQueueCommand <long> > prepareCommand,
            IConnectionHeader <TConnection, TTransaction, TCommand> headers,
            ICommandHandler <SetStatusTableStatusCommand <long> > setCommandHandler)
        {
            Guard.NotNull(() => options, options);
            Guard.NotNull(() => transactionFactory, transactionFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => prepareCommand, prepareCommand);
            Guard.NotNull(() => dbConnectionFactory, dbConnectionFactory);
            Guard.NotNull(() => deleteMetaCommandHandler, deleteMetaCommandHandler);
            Guard.NotNull(() => setStatusCommandHandler, setStatusCommandHandler);
            Guard.NotNull(() => setCommandHandler, setCommandHandler);

            _options = new Lazy <ITransportOptions>(options.Create);
            _deleteMetaCommandHandler = deleteMetaCommandHandler;
            _setStatusCommandHandler  = setStatusCommandHandler;
            _dbConnectionFactory      = dbConnectionFactory;
            _transactionFactory       = transactionFactory;
            _prepareCommand           = prepareCommand;
            _headers = headers;
            _setStatusNoTransactionCommandHandler = setCommandHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteTransactionalMessageCommandHandler{TConnection, TTransaction, TCommand}"/> class.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="prepareCommand">The prepare command.</param>
        public DeleteTransactionalMessageCommandHandler(ITransportOptionsFactory options,
                                                        IConnectionHeader <TConnection, TTransaction, TCommand> headers,
                                                        IPrepareCommandHandler <DeleteMessageCommand> prepareCommand)
        {
            Guard.NotNull(() => options, options);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => prepareCommand, prepareCommand);

            _options        = new Lazy <ITransportOptions>(options.Create);
            _headers        = headers;
            _prepareCommand = prepareCommand;
        }
Ejemplo n.º 3
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>
        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;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbackMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="rollbackCommand">The rollback command.</param>
        /// <param name="setStatusCommandHandler">The set status command handler.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="increaseQueueDelay">The increase queue delay.</param>
        public RollbackMessage(QueueConsumerConfiguration configuration,
                               ICommandHandler <RollbackMessageCommand> rollbackCommand,
                               ICommandHandler <SetStatusTableStatusCommand> setStatusCommandHandler,
                               IConnectionHeader <NpgsqlConnection, NpgsqlTransaction, NpgsqlCommand> headers,
                               IIncreaseQueueDelay increaseQueueDelay)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => rollbackCommand, rollbackCommand);
            Guard.NotNull(() => setStatusCommandHandler, setStatusCommandHandler);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => increaseQueueDelay, increaseQueueDelay);

            _configuration           = configuration;
            _rollbackCommand         = rollbackCommand;
            _setStatusCommandHandler = setStatusCommandHandler;
            _headers            = headers;
            _increaseQueueDelay = increaseQueueDelay;
        }
Ejemplo n.º 5
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="SqlServerMessageQueueReceive" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="connectionFactory">The connection factory.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="receiveMessages">The receive messages.</param>
        /// <param name="sqlHeaders">The SQL headers.</param>
        public SqlServerMessageQueueReceive(QueueConsumerConfiguration configuration,
                                            IConnectionHolderFactory <SqlConnection, SqlTransaction, SqlCommand> connectionFactory,
                                            IQueueCancelWork cancelWork,
                                            ITransportHandleMessage handleMessage,
                                            ReceiveMessage receiveMessages,
                                            IConnectionHeader <SqlConnection, SqlTransaction, SqlCommand> sqlHeaders)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => connectionFactory, connectionFactory);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => receiveMessages, receiveMessages);
            Guard.NotNull(() => sqlHeaders, sqlHeaders);

            _configuration     = configuration;
            _connectionFactory = connectionFactory;
            _cancelWork        = cancelWork;
            _handleMessage     = handleMessage;
            _receiveMessages   = receiveMessages;
            _sqlHeaders        = sqlHeaders;
            _disposeConnection = c => c.Dispose();
        }