/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandlerAsync"/> class. /// </summary> /// <param name="connectionInformation">The connection information.</param> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="serializer">The serializer.</param> /// <param name="optionsFactory">The options factory.</param> /// <param name="headers">The headers.</param> /// <param name="configurationSend">The configuration send.</param> /// <param name="sendJobStatus">The send job status.</param> /// <param name="jobExistsHandler">The job exists handler.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> /// <param name="databaseExists">The database exists.</param> public SendMessageCommandHandlerAsync( LiteDbConnectionManager connectionInformation, TableNameHelper tableNameHelper, ICompositeSerialization serializer, ILiteDbMessageQueueTransportOptionsFactory optionsFactory, IHeaders headers, TransportConfigurationSend configurationSend, ICommandHandler <SetJobLastKnownEventCommand> sendJobStatus, IQueryHandler <DoesJobExistQuery, QueueStatuses> jobExistsHandler, IJobSchedulerMetaData jobSchedulerMetaData, DatabaseExists databaseExists) { Guard.NotNull(() => connectionInformation, connectionInformation); Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => headers, headers); Guard.NotNull(() => configurationSend, configurationSend); Guard.NotNull(() => sendJobStatus, sendJobStatus); Guard.NotNull(() => jobExistsHandler, jobExistsHandler); Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData); Guard.NotNull(() => databaseExists, databaseExists); _connectionInformation = connectionInformation; _tableNameHelper = tableNameHelper; _serializer = serializer; _options = new Lazy <LiteDbMessageQueueTransportOptions>(optionsFactory.Create); _headers = headers; _configurationSend = configurationSend; _sendJobStatus = sendJobStatus; _jobExistsHandler = jobExistsHandler; _jobSchedulerMetaData = jobSchedulerMetaData; _databaseExists = databaseExists; }
/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="headers">The headers.</param> /// <param name="enqueueLua">The enqueue.</param> /// <param name="enqueueDelayedLua">The enqueue delayed.</param> /// <param name="enqueueExpirationLua">The enqueue expiration.</param> /// <param name="enqueueDelayedAndExpirationLua">The enqueue delayed and expiration.</param> /// <param name="unixTimeFactory">The unix time factory.</param> /// <param name="messageIdFactory">The message identifier factory.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> public SendMessageCommandHandlerAsync( ICompositeSerialization serializer, IHeaders headers, EnqueueLua enqueueLua, EnqueueDelayedLua enqueueDelayedLua, EnqueueExpirationLua enqueueExpirationLua, EnqueueDelayedAndExpirationLua enqueueDelayedAndExpirationLua, IUnixTimeFactory unixTimeFactory, IGetMessageIdFactory messageIdFactory, IJobSchedulerMetaData jobSchedulerMetaData) { Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => headers, headers); Guard.NotNull(() => enqueueLua, enqueueLua); Guard.NotNull(() => enqueueDelayedLua, enqueueDelayedLua); Guard.NotNull(() => enqueueExpirationLua, enqueueExpirationLua); Guard.NotNull(() => enqueueDelayedAndExpirationLua, enqueueDelayedAndExpirationLua); Guard.NotNull(() => unixTimeFactory, unixTimeFactory); Guard.NotNull(() => messageIdFactory, messageIdFactory); _serializer = serializer; _headers = headers; _enqueueLua = enqueueLua; _messageIdFactory = messageIdFactory; _jobSchedulerMetaData = jobSchedulerMetaData; _enqueueDelayedLua = enqueueDelayedLua; _enqueueDelayedAndExpirationLua = enqueueDelayedAndExpirationLua; _unixTimeFactory = unixTimeFactory; _enqueueExpirationLua = enqueueExpirationLua; }
/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="serializer">The serializer.</param> /// <param name="optionsFactory">The options factory.</param> /// <param name="headers">The headers.</param> /// <param name="commandCache">The command cache.</param> /// <param name="configurationSend">The configuration send.</param> /// <param name="sendJobStatus">The send job status.</param> /// <param name="jobExistsHandler">The job exists handler.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> /// <param name="getTimeFactory">The get time factory.</param> public SendMessageCommandHandler(TableNameHelper tableNameHelper, ICompositeSerialization serializer, IPostgreSqlMessageQueueTransportOptionsFactory optionsFactory, IHeaders headers, PostgreSqlCommandStringCache commandCache, TransportConfigurationSend configurationSend, ICommandHandler <SetJobLastKnownEventCommand <NpgsqlConnection, NpgsqlTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <NpgsqlConnection, NpgsqlTransaction>, QueueStatuses> jobExistsHandler, IJobSchedulerMetaData jobSchedulerMetaData, IGetTimeFactory getTimeFactory) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => headers, headers); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => configurationSend, configurationSend); Guard.NotNull(() => sendJobStatus, sendJobStatus); Guard.NotNull(() => jobExistsHandler, jobExistsHandler); Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData); Guard.NotNull(() => getTimeFactory, getTimeFactory); _tableNameHelper = tableNameHelper; _serializer = serializer; _options = new Lazy <PostgreSqlMessageQueueTransportOptions>(optionsFactory.Create); _headers = headers; _commandCache = commandCache; _configurationSend = configurationSend; _sendJobStatus = sendJobStatus; _jobExistsHandler = jobExistsHandler; _jobSchedulerMetaData = jobSchedulerMetaData; _getTime = getTimeFactory.Create(); }
/// <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="removeMessage">removes a message</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, IRemoveMessage removeMessage, IQueryHandler <GetJobIdQuery, string> getJobId, IGetTimeFactory getTimeFactory, IJobSchedulerMetaData jobSchedulerMetaData) : base(queue, getTimeFactory) { _doesJobExist = doesJobExist; _removeMessage = removeMessage; _getJobId = getJobId; _jobSchedulerMetaData = jobSchedulerMetaData; }
/// <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; }
/// <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; }
/// <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="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> public DataStorage( IJobSchedulerMetaData jobSchedulerMetaData, IConnectionInformation connectionInformation, IReceivedMessageFactory receivedMessageFactory, IMessageFactory messageFactory) { _jobSchedulerMetaData = jobSchedulerMetaData; _connectionInformation = connectionInformation; _receivedMessageFactory = receivedMessageFactory; _messageFactory = messageFactory; if (!Queues.ContainsKey(_connectionInformation)) { Queues.TryAdd(_connectionInformation, new ConcurrentQueue <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>()); } Signal = new AutoResetEvent(false); }
/// <summary> /// Initializes a new instance of the <see cref="SendMessageCommandHandler" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="serializer">The serializer.</param> /// <param name="optionsFactory">The options factory.</param> /// <param name="headers">The headers.</param> /// <param name="commandCache">The command cache.</param> /// <param name="configurationSend">The configuration send.</param> /// <param name="getTimeFactory">The get time factory.</param> /// <param name="dbFactory">The database factory.</param> /// <param name="sendJobStatus">The send job status.</param> /// <param name="jobExistsHandler">The job exists handler.</param> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> /// <param name="databaseExists">The database exists.</param> /// <param name="readerAsync">The reader asynchronous.</param> public SendMessageCommandHandlerAsync(TableNameHelper tableNameHelper, ICompositeSerialization serializer, ISqLiteMessageQueueTransportOptionsFactory optionsFactory, IHeaders headers, IDbCommandStringCache commandCache, TransportConfigurationSend configurationSend, IGetTimeFactory getTimeFactory, IDbFactory dbFactory, ICommandHandler <SetJobLastKnownEventCommand <IDbConnection, IDbTransaction> > sendJobStatus, IQueryHandler <DoesJobExistQuery <IDbConnection, IDbTransaction>, QueueStatuses> jobExistsHandler, IJobSchedulerMetaData jobSchedulerMetaData, DatabaseExists databaseExists, IReaderAsync readerAsync) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => serializer, serializer); Guard.NotNull(() => optionsFactory, optionsFactory); Guard.NotNull(() => headers, headers); Guard.NotNull(() => commandCache, commandCache); Guard.NotNull(() => configurationSend, configurationSend); Guard.NotNull(() => getTimeFactory, getTimeFactory); Guard.NotNull(() => sendJobStatus, sendJobStatus); Guard.NotNull(() => jobExistsHandler, jobExistsHandler); Guard.NotNull(() => jobSchedulerMetaData, jobSchedulerMetaData); Guard.NotNull(() => databaseExists, databaseExists); Guard.NotNull(() => readerAsync, readerAsync); _tableNameHelper = tableNameHelper; _serializer = serializer; _options = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create); _headers = headers; _commandCache = commandCache; _configurationSend = configurationSend; _getTime = getTimeFactory.Create(); _dbFactory = dbFactory; _sendJobStatus = sendJobStatus; _jobExistsHandler = jobExistsHandler; _jobSchedulerMetaData = jobSchedulerMetaData; _databaseExists = databaseExists; _readerAsync = readerAsync; }
/// <summary> /// Initializes a new instance of the <see cref="CreateJobMetaData"/> class. /// </summary> /// <param name="jobSchedulerMetaData">The job scheduler meta data.</param> public CreateJobMetaData(IJobSchedulerMetaData jobSchedulerMetaData) { _jobSchedulerMetaData = jobSchedulerMetaData; }