private StopWorker Create(IQueueCancelWork cancelWork)
        {
            var fixture = new Fixture().Customize(new AutoNSubstituteCustomization());

            fixture.Inject(cancelWork);
            return(fixture.Create <StopWorker>());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueWaitFactory" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="cancelWork">The cancel work.</param>
        public QueueWaitFactory(QueueConsumerConfiguration configuration, IQueueCancelWork cancelWork)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => cancelWork, cancelWork);

            _configuration = configuration;
            _cancelWork    = cancelWork;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueWaitFactory" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="cancelWork">The cancel work.</param>
        public QueueWaitFactory(QueueConsumerConfiguration configuration, IQueueCancelWork cancelWork)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => cancelWork, cancelWork);

            _configuration = configuration;
            _cancelWork = cancelWork;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueWorkSub"/> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="redisNames">The redis names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        public RedisQueueWorkSub(IRedisConnection connection,
                                 RedisNames redisNames,
                                 IQueueCancelWork cancelWork)
        {
            Guard.NotNull(() => connection, connection);
            Guard.NotNull(() => redisNames, redisNames);
            Guard.NotNull(() => cancelWork, cancelWork);

            _connection = connection;
            _redisNames = redisNames;
            _cancelWork = cancelWork;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="cancelToken">The cancel token.</param>
        /// <param name="dataStorage">The data storage.</param>
        public ReceiveMessage(QueueConsumerConfiguration configuration,
                              IQueueCancelWork cancelToken,
                              IDataStorage dataStorage)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => dataStorage, dataStorage);
            Guard.NotNull(() => cancelToken, cancelToken);

            _configuration = configuration;
            _cancelToken   = cancelToken;
            _dataStorage   = dataStorage;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueWorkSubFactory" /> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="redisNames">The redis names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        public RedisQueueWorkSubFactory(IRedisConnection connection,
            RedisNames redisNames,
            IQueueCancelWork cancelWork)
        {
            Guard.NotNull(() => connection, connection);
            Guard.NotNull(() => redisNames, redisNames);
            Guard.NotNull(() => cancelWork, cancelWork);

            _connection = connection;
            _redisNames = redisNames;
            _cancelWork = cancelWork;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="cancelToken">The cancel token.</param>
        public ReceiveMessage(QueueConsumerConfiguration configuration,
                              IQueryHandler <ReceiveMessageQuery <IDbConnection, IDbTransaction>, IReceivedMessageInternal> receiveMessage,
                              IQueueCancelWork cancelToken)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => cancelToken, cancelToken);

            _configuration  = configuration;
            _receiveMessage = receiveMessage;
            _cancelToken    = cancelToken;
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageQueueReceive" /> class.
        /// </summary>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="receiveMessages">The receive messages.</param>
        public MessageQueueReceive(
            IQueueCancelWork cancelWork,
            HandleMessage handleMessage,
            ReceiveMessage receiveMessages)
        {
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => receiveMessages, receiveMessages);

            _cancelWork      = cancelWork;
            _handleMessage   = handleMessage;
            _receiveMessages = receiveMessages;
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="setStatusCommandHandler">The set status command handler.</param>
        /// <param name="cancelToken">The cancel token.</param>
        public ReceiveMessage(QueueConsumerConfiguration configuration, IQueryHandler <ReceiveMessageQuery <NpgsqlConnection, NpgsqlTransaction>, IReceivedMessageInternal> receiveMessage,
                              ICommandHandler <SetStatusTableStatusCommand <long> > setStatusCommandHandler,
                              IQueueCancelWork cancelToken)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => setStatusCommandHandler, setStatusCommandHandler);
            Guard.NotNull(() => cancelToken, cancelToken);

            _configuration           = configuration;
            _receiveMessage          = receiveMessage;
            _setStatusCommandHandler = setStatusCommandHandler;
            _cancelToken             = cancelToken;
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="cancelToken">The cancel token.</param>
        /// <param name="receiveMessageAsync">The receive message asynchronous.</param>
        public ReceiveMessage(QueueConsumerConfiguration configuration,
            IQueryHandler<ReceiveMessageQuery, IReceivedMessageInternal> receiveMessage,
            IQueueCancelWork cancelToken, 
            IQueryHandler<ReceiveMessageQueryAsync, Task<IReceivedMessageInternal>> receiveMessageAsync)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => cancelToken, cancelToken);
            Guard.NotNull(() => receiveMessageAsync, receiveMessageAsync);

            _configuration = configuration;
            _receiveMessage = receiveMessage;
            _cancelToken = cancelToken;
            _receiveMessageAsync = receiveMessageAsync;
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StopWorker"/> class.
        /// </summary>
        /// <param name="cancelWorkSource">The cancel work source.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="waitForEventOrCancel">The wait for event or cancel.</param>
        public StopWorker(IQueueCancelWork cancelWorkSource,
                          IWorkerConfiguration configuration,
                          ILogFactory log,
                          IWorkerWaitForEventOrCancel waitForEventOrCancel)
        {
            Guard.NotNull(() => cancelWorkSource, cancelWorkSource);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => waitForEventOrCancel, waitForEventOrCancel);

            _cancelWorkSource = cancelWorkSource;
            _configuration    = configuration;
            _log = log.Create();
            _waitForEventOrCancel = waitForEventOrCancel;
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueReceiveMessages" /> class.
        /// </summary>
        /// <param name="workSubFactory">The work sub factory.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="cancelWork">The cancel work.</param>
        public RedisQueueReceiveMessages(IRedisQueueWorkSubFactory workSubFactory,
                                         IQueryHandler <ReceiveMessageQuery, RedisMessage> receiveMessage,
                                         ITransportHandleMessage handleMessage,
                                         IQueueCancelWork cancelWork)
        {
            Guard.NotNull(() => workSubFactory, workSubFactory);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => cancelWork, cancelWork);

            _receiveMessage = receiveMessage;
            _handleMessage  = handleMessage;
            _cancelWork     = cancelWork;
            _workSubFactory = workSubFactory;
        }
Esempio n. 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StopWorker"/> class.
        /// </summary>
        /// <param name="cancelWorkSource">The cancel work source.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="waitForEventOrCancel">The wait for event or cancel.</param>
        public StopWorker(IQueueCancelWork cancelWorkSource,
            IWorkerConfiguration configuration,
            ILogFactory log,
            IWorkerWaitForEventOrCancel waitForEventOrCancel)
        {
            Guard.NotNull(() => cancelWorkSource, cancelWorkSource);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => waitForEventOrCancel, waitForEventOrCancel);

            _cancelWorkSource = cancelWorkSource;
            _configuration = configuration;
            _log = log.Create();
            _waitForEventOrCancel = waitForEventOrCancel;
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessage" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="setStatusCommandHandler">The set status command handler.</param>
        /// <param name="cancelToken">The cancel token.</param>
        /// <param name="receiveMessageAsync">The receive message asynchronous.</param>
        public ReceiveMessage(QueueConsumerConfiguration configuration, RelationalDatabase.IQueryHandler <ReceiveMessageQuery <SqlConnection, SqlTransaction>, IReceivedMessageInternal> receiveMessage,
                              ICommandHandler <SetStatusTableStatusCommand> setStatusCommandHandler,
                              IQueueCancelWork cancelToken, RelationalDatabase.IQueryHandler <ReceiveMessageQueryAsync <SqlConnection, SqlTransaction>, Task <IReceivedMessageInternal> > receiveMessageAsync)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => setStatusCommandHandler, setStatusCommandHandler);
            Guard.NotNull(() => cancelToken, cancelToken);
            Guard.NotNull(() => receiveMessageAsync, receiveMessageAsync);

            _configuration           = configuration;
            _receiveMessage          = receiveMessage;
            _setStatusCommandHandler = setStatusCommandHandler;
            _cancelToken             = cancelToken;
            _receiveMessageAsync     = receiveMessageAsync;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueWorkSubRpc"/> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="redisNames">The redis names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="messageId">The message identifier.</param>
        public RedisQueueWorkSubRpc(IRedisConnection connection,
                                    RedisNames redisNames,
                                    IQueueCancelWork cancelWork,
                                    IMessageId messageId)
        {
            Guard.NotNull(() => connection, connection);
            Guard.NotNull(() => redisNames, redisNames);
            Guard.NotNull(() => cancelWork, cancelWork);

            _connection = connection;
            _redisNames = redisNames;
            _cancelWork = cancelWork;
            _messageId  = messageId;

            _waitHandle = new ManualResetEventSlim(false);
            _waitHandle.Set();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueWorkSubRpc"/> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="redisNames">The redis names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="messageId">The message identifier.</param>
        public RedisQueueWorkSubRpc(IRedisConnection connection,
            RedisNames redisNames,
            IQueueCancelWork cancelWork,
            IMessageId messageId)
        {
            Guard.NotNull(() => connection, connection);
            Guard.NotNull(() => redisNames, redisNames);
            Guard.NotNull(() => cancelWork, cancelWork);

            _connection = connection;
            _redisNames = redisNames;
            _cancelWork = cancelWork;
            _messageId = messageId;

            _waitHandle = new ManualResetEventSlim(false);
            _waitHandle.Set();
        }
Esempio n. 17
0
        /// <summary>Initializes a new instance of the <see cref="DataStorage" /> class.</summary>
        /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param>
        /// <param name="connectionInformation">The connection information.</param>
        /// <param name="receivedMessageFactory">The received message factory.</param>
        /// <param name="messageFactory">The message factory.</param>
        /// <param name="cancelToken">cancel token for stopping</param>
        public DataStorage(
            IJobSchedulerMetaData jobSchedulerMetaData,
            IConnectionInformation connectionInformation,
            IReceivedMessageFactory receivedMessageFactory,
            IMessageFactory messageFactory,
            IQueueCancelWork cancelToken)
        {
            _jobSchedulerMetaData   = jobSchedulerMetaData;
            _connectionInformation  = connectionInformation;
            _receivedMessageFactory = receivedMessageFactory;
            _messageFactory         = messageFactory;
            _cancelToken            = cancelToken;

            if (!Queues.ContainsKey(_connectionInformation))
            {
                Queues.TryAdd(_connectionInformation, new BlockingCollection <Guid>());
            }

            if (!QueueData.ContainsKey(_connectionInformation))
            {
                QueueData.TryAdd(_connectionInformation, new ConcurrentDictionary <Guid, QueueItem>());
            }

            if (!ErrorCounts.ContainsKey(_connectionInformation))
            {
                ErrorCounts.TryAdd(_connectionInformation, new IncrementWrapper());
            }

            if (!DequeueCounts.ContainsKey(_connectionInformation))
            {
                DequeueCounts.TryAdd(_connectionInformation, new IncrementWrapper());
            }

            if (!Jobs.ContainsKey(_connectionInformation))
            {
                Jobs.TryAdd(_connectionInformation, new ConcurrentDictionary <string, Guid>());
            }

            if (!QueueWorking.ContainsKey(_connectionInformation))
            {
                QueueWorking.TryAdd(_connectionInformation, new ConcurrentDictionary <Guid, QueueItem>());
            }

            _complete = false;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkerNotification" /> class.
        /// </summary>
        /// <param name="headerNames">The header names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="metrics">The metrics factory.</param>
        public WorkerNotification(IHeaders headerNames,
            IQueueCancelWork cancelWork,
            TransportConfigurationReceive configuration,
            ILogFactory log,
            IMetrics metrics)
        {
            Guard.NotNull(() => headerNames, headerNames);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => metrics, metrics);

            HeaderNames = headerNames;
            WorkerStopping = cancelWork;
            TransportSupportsRollback = configuration.MessageRollbackSupported;
            Log = log.Create();
            Metrics = metrics;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkerNotification" /> class.
        /// </summary>
        /// <param name="headerNames">The header names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="metrics">The metrics factory.</param>
        public WorkerNotification(IHeaders headerNames,
                                  IQueueCancelWork cancelWork,
                                  TransportConfigurationReceive configuration,
                                  ILogFactory log,
                                  IMetrics metrics)
        {
            Guard.NotNull(() => headerNames, headerNames);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => metrics, metrics);

            HeaderNames               = headerNames;
            WorkerStopping            = cancelWork;
            TransportSupportsRollback = configuration.MessageRollbackSupported;
            Log     = log.Create();
            Metrics = metrics;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueReceiveMessages" /> class.
        /// </summary>
        /// <param name="workSubFactory">The work sub factory.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="receiveMessageAsync">The receive message asynchronous.</param>
        public RedisQueueReceiveMessages(IRedisQueueWorkSubFactory workSubFactory,
            IQueryHandler<ReceiveMessageQuery, RedisMessage> receiveMessage, 
            HandleMessage handleMessage, 
            IHeaders headers,
            IQueueCancelWork cancelWork, IQueryHandler<ReceiveMessageQueryAsync, Task<RedisMessage>> receiveMessageAsync)
        {
            Guard.NotNull(() => workSubFactory, workSubFactory);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => receiveMessageAsync, receiveMessageAsync);

            _receiveMessage = receiveMessage;
            _handleMessage = handleMessage;
            _headers = headers;
            _cancelWork = cancelWork;
            _receiveMessageAsync = receiveMessageAsync;
            _workSubFactory = workSubFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisQueueReceiveMessages" /> class.
        /// </summary>
        /// <param name="workSubFactory">The work sub factory.</param>
        /// <param name="receiveMessage">The receive message.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="receiveMessageAsync">The receive message asynchronous.</param>
        public RedisQueueReceiveMessages(IRedisQueueWorkSubFactory workSubFactory,
                                         IQueryHandler <ReceiveMessageQuery, RedisMessage> receiveMessage,
                                         ITransportHandleMessage handleMessage,
                                         IHeaders headers,
                                         IQueueCancelWork cancelWork, IQueryHandler <ReceiveMessageQueryAsync, Task <RedisMessage> > receiveMessageAsync)
        {
            Guard.NotNull(() => workSubFactory, workSubFactory);
            Guard.NotNull(() => receiveMessage, receiveMessage);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => receiveMessageAsync, receiveMessageAsync);

            _receiveMessage      = receiveMessage;
            _handleMessage       = handleMessage;
            _headers             = headers;
            _cancelWork          = cancelWork;
            _receiveMessageAsync = receiveMessageAsync;
            _workSubFactory      = workSubFactory;
        }
Esempio n. 22
0
        /// <summary>Initializes a new instance of the <see cref="WorkerNotification"/> class.</summary>
        /// <param name="headerNames">The header names.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="tracer">The tracer.</param>
        public WorkerNotification(IHeaders headerNames,
                                  IQueueCancelWork cancelWork,
                                  TransportConfigurationReceive configuration,
                                  ILogger log,
                                  IMetrics metrics,
                                  ActivitySource tracer)
        {
            Guard.NotNull(() => headerNames, headerNames);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => metrics, metrics);
            Guard.NotNull(() => tracer, tracer);

            HeaderNames               = headerNames;
            WorkerStopping            = cancelWork;
            TransportSupportsRollback = configuration.MessageRollbackSupported;
            Log     = log;
            Metrics = metrics;
            Tracer  = tracer;
        }
        /// <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();
        }
        /// <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,
            IConnectionFactory connectionFactory,
            IQueueCancelWork cancelWork,
            HandleMessage handleMessage,
            ReceiveMessage receiveMessages,
            SqlHeaders 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(); 

        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqLiteMessageQueueReceive" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="cancelWork">The cancel work.</param>
        /// <param name="handleMessage">The handle message.</param>
        /// <param name="receiveMessages">The receive messages.</param>
        /// <param name="log">The log.</param>
        /// <param name="getFileNameFromConnection">The get file name from connection.</param>
        /// <param name="databaseExists">The database exists.</param>
        public SqLiteMessageQueueReceive(QueueConsumerConfiguration configuration,
                                         IQueueCancelWork cancelWork,
                                         ITransportHandleMessage handleMessage,
                                         ReceiveMessage receiveMessages,
                                         ILogger log,
                                         IGetFileNameFromConnectionString getFileNameFromConnection,
                                         DatabaseExists databaseExists)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => cancelWork, cancelWork);
            Guard.NotNull(() => handleMessage, handleMessage);
            Guard.NotNull(() => receiveMessages, receiveMessages);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => getFileNameFromConnection, getFileNameFromConnection);
            Guard.NotNull(() => databaseExists, databaseExists);

            _log                       = log;
            _configuration             = configuration;
            _cancelWork                = cancelWork;
            _handleMessage             = handleMessage;
            _receiveMessages           = receiveMessages;
            _getFileNameFromConnection = getFileNameFromConnection;
            _databaseExists            = databaseExists;
        }
Esempio n. 26
0
 private StopWorker Create(IQueueCancelWork cancelWork)
 {
     var fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
     fixture.Inject(cancelWork);
     return fixture.Create<StopWorker>();
 }