/// <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="QueueWait"/> class. /// </summary> /// <param name="backoffTimes">The back off times.</param> /// <param name="tokenWorkerCanceled">The cancel token.</param> /// <exception cref="System.ArgumentException"> /// Back off helper must be initialized with at least one time span!;backoffTimes /// or /// backoffTimes /// </exception> public QueueWait(IEnumerable<TimeSpan> backoffTimes, ICancelWork tokenWorkerCanceled) { Guard.NotNull(() => tokenWorkerCanceled, tokenWorkerCanceled); var timeSpans = backoffTimes.ToArray(); Guard.NotNull(() => timeSpans, timeSpans); if(timeSpans.Length == 0) throw new ArgumentException("Back off helper must be initialized with at least one time span"); _backoffTimes = timeSpans; _tokenWorkerCanceled = tokenWorkerCanceled; }
/// <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="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; }
/// <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="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; }
/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="QueueWait"/> class. /// </summary> /// <param name="backOffTimes">The back off times.</param> /// <param name="tokenWorkerCanceled">The cancel token.</param> /// <exception cref="System.ArgumentException"> /// Back off helper must be initialized with at least one time span!;backOffTimes /// or /// backOffTimes /// </exception> public QueueWait(IEnumerable <TimeSpan> backOffTimes, ICancelWork tokenWorkerCanceled) { Guard.NotNull(() => tokenWorkerCanceled, tokenWorkerCanceled); var timeSpans = backOffTimes.ToArray(); Guard.NotNull(() => timeSpans, timeSpans); if (timeSpans.Length == 0) { throw new ArgumentException("Back off helper must be initialized with at least one time span"); } _backOffTimes = timeSpans; _tokenWorkerCanceled = tokenWorkerCanceled; }
/// <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; }
/// <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; }
/// <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(); }
/// <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; }
/// <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="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; }
/// <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(); }