/// <summary>Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class.</summary>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="connectionInformation">The connection information.</param>
        /// <param name="buildDequeueCommand">The build dequeue command.</param>
        /// <param name="messageDeQueue">The message de queue.</param>
        /// <param name="dbFactory">The transaction factory.</param>
        /// <param name="databaseExists">The database exists.</param>
        /// <param name="configuration">Queue configuration</param>
        public ReceiveMessageQueryHandler(ISqLiteMessageQueueTransportOptionsFactory optionsFactory,
                                          ITableNameHelper tableNameHelper,
                                          IConnectionInformation connectionInformation,
                                          BuildDequeueCommand buildDequeueCommand,
                                          MessageDeQueue messageDeQueue,
                                          IDbFactory dbFactory,
                                          DatabaseExists databaseExists,
                                          QueueConsumerConfiguration configuration)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => buildDequeueCommand, buildDequeueCommand);
            Guard.NotNull(() => messageDeQueue, messageDeQueue);
            Guard.NotNull(() => databaseExists, databaseExists);
            Guard.NotNull(() => dbFactory, dbFactory);
            Guard.NotNull(() => configuration, configuration);

            _options               = new Lazy <SqLiteMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper       = tableNameHelper;
            _connectionInformation = connectionInformation;
            _buildDequeueCommand   = buildDequeueCommand;
            _messageDeQueue        = messageDeQueue;
            _dbFactory             = dbFactory;
            _databaseExists        = databaseExists;
            _configuration         = configuration;
        }
示例#2
0
        private void SetQueueOptions(QueueConsumerConfiguration obj, int orderId)
        {
            var SqlParam = new Npgsql.NpgsqlParameter("@OrderID", orderId);

            obj.AddUserParameter(SqlParam);
            obj.SetUserWhereClause("(q.OrderID = @OrderID)");
        }
示例#3
0
        public static void Main(string[] args = null)
        {
            try
            {
                var tokenSource = new CancellationTokenSource();
                var config      = QueueConsumerConfiguration.Create();
                DisplayHeader(config);

                var processor = new QueueMessageProcessor(config);

                var task = new Task(() =>
                {
                    while (!processor.Execute())
                    {
                    }
                }, tokenSource.Token);

                Console.CancelKeyPress += (sender, eventArgs) =>
                {
                    Console.WriteLine("Aborting Program...");
                    tokenSource.Cancel();
                    task.Dispose();
                };

                task.Start();
                task.Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine("Program Exception:");
                Console.WriteLine(" - {0}\n\n{1}", e.Message, e.StackTrace);
            }
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessingRpcReceive{TReceivedMessage}" /> class.
        /// </summary>
        /// <param name="configurationReceive">The configuration receive.</param>
        /// <param name="receiveMessagesFactory">The receive messages factory.</param>
        /// <param name="messageContextFactory">The message context factory.</param>
        /// <param name="messageHandler">The message handler.</param>
        /// <param name="rpcContextFactory">The RPC context factory.</param>
        /// <param name="commitMessage">The commit message.</param>
        public MessageProcessingRpcReceive(
            QueueConsumerConfiguration configurationReceive,
            IReceiveMessagesFactory receiveMessagesFactory,
            IMessageContextFactory messageContextFactory,
            IMessageHandlerRegistration messageHandler,
            IRpcContextFactory rpcContextFactory,
            ICommitMessage commitMessage)
        {
            Guard.NotNull(() => configurationReceive, configurationReceive);
            Guard.NotNull(() => receiveMessagesFactory, receiveMessagesFactory);
            Guard.NotNull(() => messageContextFactory, messageContextFactory);
            Guard.NotNull(() => messageHandler, messageHandler);
            Guard.NotNull(() => rpcContextFactory, rpcContextFactory);
            Guard.NotNull(() => commitMessage, commitMessage);

            _configurationReceive   = configurationReceive;
            _receiveMessagesFactory = receiveMessagesFactory;
            _messageContextFactory  = messageContextFactory;
            _messageHandler         = messageHandler;
            _rpcContextFactory      = rpcContextFactory;
            _commitMessage          = commitMessage;

            void Action(IReceivedMessage <TReceivedMessage> message, IWorkerNotification worker)
            {
            }

            messageHandler.Set((Action <IReceivedMessage <TReceivedMessage>, IWorkerNotification>)Action);
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RpcQueue{TReceivedMessage, TSendMessage}" /> class.
        /// </summary>
        /// <param name="configurationRpc">The configuration RPC.</param>
        /// <param name="configurationReceive">The configuration receive.</param>
        /// <param name="clearMessages">The clear messages factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="messageProcessingRpcReceive">The message processing RPC receive.</param>
        /// <param name="messageProcessingRpcSend">The message processing RPC send.</param>
        /// <param name="queueWaitFactory">The queue wait factory.</param>
        public RpcQueue(
            QueueRpcConfiguration configurationRpc,
            QueueConsumerConfiguration configurationReceive,
            IClearExpiredMessagesRpcMonitor clearMessages,
            ILogFactory log,
            IMessageProcessingRpcReceive <TReceivedMessage> messageProcessingRpcReceive,
            IMessageProcessingRpcSend <TSendMessage> messageProcessingRpcSend,
            IQueueWaitFactory queueWaitFactory)
            : base(log)
        {
            Guard.NotNull(() => configurationRpc, configurationRpc);
            Guard.NotNull(() => configurationReceive, configurationReceive);
            Guard.NotNull(() => clearMessages, clearMessages);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => messageProcessingRpcReceive, messageProcessingRpcReceive);
            Guard.NotNull(() => messageProcessingRpcSend, messageProcessingRpcSend);
            Guard.NotNull(() => queueWaitFactory, queueWaitFactory);

            _configurationReceive        = configurationReceive;
            _configurationRpc            = configurationRpc;
            _messageProcessingRpcReceive = messageProcessingRpcReceive;
            _messageProcessingRpcSend    = messageProcessingRpcSend;
            _queueWaitFactory            = queueWaitFactory;

            _clearQueue = clearMessages;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsumerQueueAsync" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="workerFactory">The worker factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="registerMessagesAsync">The register messages asynchronous.</param>
        /// <param name="stopWorker">The stop worker.</param>
        /// <param name="queueMonitor">The queue monitor.</param>
        public ConsumerQueueAsync(
            QueueConsumerConfiguration configuration,
            IPrimaryWorkerFactory workerFactory,
            ILogger log,
            IRegisterMessagesAsync registerMessagesAsync,
            StopWorker stopWorker,
            IQueueMonitor queueMonitor)
            : base(log)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => workerFactory, workerFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => registerMessagesAsync, registerMessagesAsync);
            Guard.NotNull(() => stopWorker, stopWorker);
            Guard.NotNull(() => queueMonitor, queueMonitor);

            _configuration = configuration;
            _primaryWorker = new Lazy <IPrimaryWorker>(() =>
            {
                var worker              = workerFactory.Create();
                worker.UserException   += LogUserException;
                worker.SystemException += LogSystemException;
                return(worker);
            });

            _stopWorker            = stopWorker;
            _queueMonitor          = queueMonitor;
            _registerMessagesAsync = registerMessagesAsync;
        }
        /// <summary>Initializes a new instance of the <see cref="ReceiveMessageQueryHandler" /> class.</summary>
        /// <param name="optionsFactory">The options factory.</param>
        /// <param name="tableNameHelper">The table name helper.</param>
        /// <param name="receivedMessageFactory">The received message factory.</param>
        /// <param name="commandCache">The command cache.</param>
        /// <param name="messageFactory">The message factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="serialization">The serialization.</param>
        /// <param name="getTimeFactory">The get time factory.</param>
        /// <param name="configuration">Queue Configuration</param>
        public ReceiveMessageQueryHandler(IPostgreSqlMessageQueueTransportOptionsFactory optionsFactory,
                                          ITableNameHelper tableNameHelper,
                                          IReceivedMessageFactory receivedMessageFactory,
                                          PostgreSqlCommandStringCache commandCache,
                                          IMessageFactory messageFactory,
                                          IHeaders headers,
                                          ICompositeSerialization serialization,
                                          IGetTimeFactory getTimeFactory,
                                          QueueConsumerConfiguration configuration)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => receivedMessageFactory, receivedMessageFactory);
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => messageFactory, messageFactory);
            Guard.NotNull(() => serialization, serialization);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => getTimeFactory, getTimeFactory);
            Guard.NotNull(() => configuration, configuration);

            _options                = new Lazy <PostgreSqlMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper        = tableNameHelper;
            _receivedMessageFactory = receivedMessageFactory;
            _commandCache           = commandCache;
            _messageFactory         = messageFactory;
            _headers                = headers;
            _serialization          = serialization;
            _getTime                = getTimeFactory.Create();
            _configuration          = configuration;
        }
        /// <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;
        }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FindRecordsToResetByHeartBeatQueryPrepareHandler"/> class.
 /// </summary>
 /// <param name="commandCache">The command cache.</param>
 /// <param name="configuration">The configuration.</param>
 public FindRecordsToResetByHeartBeatQueryPrepareHandler(CommandStringCache commandCache,
                                                         QueueConsumerConfiguration configuration)
 {
     Guard.NotNull(() => commandCache, commandCache);
     Guard.NotNull(() => configuration, configuration);
     _commandCache  = commandCache;
     _configuration = configuration;
 }
示例#10
0
 public static void SetupDefaultConsumerQueueErrorPurge(QueueConsumerConfiguration configuration, bool actuallyPurge)
 {
     configuration.Worker.TimeToWaitForWorkersToStop   = TimeSpan.FromSeconds(5);
     configuration.Worker.TimeToWaitForWorkersToCancel = TimeSpan.FromSeconds(10);
     configuration.Worker.SingleWorkerWhenNoWorkFound  = true;
     configuration.MessageError.MessageAge             = actuallyPurge ? TimeSpan.FromSeconds(0) : TimeSpan.FromDays(1);
     configuration.MessageError.Enabled     = true;
     configuration.MessageError.MonitorTime = TimeSpan.FromSeconds(5);
 }
示例#11
0
        public static void SetupDefaultErrorRetry(QueueConsumerConfiguration configuration)
        {
            var times = new List <TimeSpan> {
                TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2)
            };

            configuration.TransportConfiguration.RetryDelayBehavior.Add(typeof(IndexOutOfRangeException),
                                                                        times);
        }
示例#12
0
        private void SetQueueOptions(QueueConsumerConfiguration obj, int orderId)
        {
            var SqlParam = new SqlParameter("@OrderID", SqlDbType.Int)
            {
                Value = orderId
            };

            obj.AddUserParameter(SqlParam);
            obj.SetUserWhereClause("(OrderID = @OrderID)");
        }
        public static async Task <bool> SendNotification(QueueConsumerConfiguration configuration, string message)
        {
            RestRequest request = new RestRequest(Method.POST);

            request.AddParameter("application/json; charset=utf-8", message, ParameterType.RequestBody);

            var response = await GetRestClient(configuration).ExecuteTaskAsync(request);

            return(configuration.StatusCodeAcceptToSuccessList.Contains((int)response.StatusCode));
        }
 /// <summary>
 /// Sets the user parameters. The same collection will be used for every de-queue call.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="parameters">The parameters.</param>
 public static void SetUserParameters(this QueueConsumerConfiguration configuration, List <SQLiteParameter> parameters)
 {
     if (configuration.AdditionalSettings.ContainsKey("userdequeueparams"))
     {
         configuration.AdditionalSettings["userdequeueparams"] = parameters;
     }
     else
     {
         configuration.AdditionalSettings.Add("userdequeueparams", parameters);
     }
 }
 /// <summary>
 /// Sets the user where clause for custom de-queue 'AND' operations.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="whereClause">The where clause.</param>
 public static void SetUserWhereClause(this QueueConsumerConfiguration configuration, string whereClause)
 {
     if (configuration.AdditionalSettings.ContainsKey("userdequeueparams"))
     {
         configuration.AdditionalSettings["userdequeue"] = whereClause;
     }
     else
     {
         configuration.AdditionalSettings.Add("userdequeue", whereClause);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FindRecordsToResetByHeartBeatQueryPrepareHandler" /> class.
 /// </summary>
 /// <param name="commandCache">The command cache.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="getTimeFactory">The get time factory.</param>
 public FindRecordsToResetByHeartBeatQueryPrepareHandler(CommandStringCache commandCache,
                                                         QueueConsumerConfiguration configuration,
                                                         IGetTimeFactory getTimeFactory)
 {
     Guard.NotNull(() => commandCache, commandCache);
     Guard.NotNull(() => configuration, configuration);
     Guard.NotNull(() => getTimeFactory, getTimeFactory);
     _commandCache  = commandCache;
     _configuration = configuration;
     _getTime       = getTimeFactory.Create();
 }
示例#17
0
        /// <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;
        }
示例#18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResetHeartBeatDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="configuration">The configuration.</param>
        public ResetHeartBeatDecorator(ILogger log,
                                       IResetHeartBeat handler,
                                       QueueConsumerConfiguration configuration)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);
            Guard.NotNull(() => configuration, configuration);

            _log           = log;
            _handler       = handler;
            _configuration = configuration;
        }
        /// <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>
 /// Gets the user where/and clause for de-queue
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <returns></returns>
 /// <remarks>The factory method will always be returned if set, even if the non-factory method is also set</remarks>
 public static string GetUserClause(this QueueConsumerConfiguration configuration)
 {
     if (configuration.AdditionalSettings.ContainsKey("userdequeuefactory"))
     {
         return(((Func <string>)configuration.AdditionalSettings["userdequeuefactory"]).Invoke());
     }
     if (configuration.AdditionalSettings.ContainsKey("userdequeue"))
     {
         return((string)configuration.AdditionalSettings["userdequeue"]);
     }
     return(null);
 }
 /// <summary>
 /// Gets the user parameters for de-queue
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <returns></returns>
 /// <remarks>The factory method will always be returned if set, even if the non-factory method is also set</remarks>
 public static List <SQLiteParameter> GetUserParameters(this QueueConsumerConfiguration configuration)
 {
     if (configuration.AdditionalSettings.ContainsKey("userdequeueparamsfactory"))
     {
         return(((Func <List <SQLiteParameter> >)configuration.AdditionalSettings["userdequeueparamsfactory"]).Invoke());
     }
     if (configuration.AdditionalSettings.ContainsKey("userdequeueparams"))
     {
         return((List <SQLiteParameter>)configuration.AdditionalSettings["userdequeueparams"]);
     }
     return(null);
 }
        /// <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="headers">The headers.</param>
        public RollbackMessage(QueueConsumerConfiguration configuration,
                               ICommandHandler <RollbackMessageCommand <long> > rollbackCommand,
                               IIncreaseQueueDelay headers)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => rollbackCommand, rollbackCommand);
            Guard.NotNull(() => headers, headers);

            _configuration   = configuration;
            _rollbackCommand = rollbackCommand;
            _headers         = headers;
        }
示例#23
0
        /// <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;
        }
        public static async Task <bool> SendNotification(QueueConsumerConfiguration configuration, string message)
        {
            RestRequest request = new RestRequest(Method.POST);

            request.AddParameter("application/json; charset=utf-8", message, ParameterType.RequestBody);

            ;           var response = await GetRestClient(configuration).ExecuteTaskAsync(request);

            return(response.StatusCode == HttpStatusCode.OK ||
                   response.StatusCode == HttpStatusCode.Created ||
                   response.StatusCode == HttpStatusCode.Accepted ||
                   response.StatusCode == HttpStatusCode.NoContent);
        }
示例#25
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();
        }
示例#26
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;
        }
 /// <summary>
 /// Adds the user parameter. This same parameter will be used for every de-queue call
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="parameter">The parameter.</param>
 public static void AddUserParameter(this QueueConsumerConfiguration configuration, SQLiteParameter parameter)
 {
     if (configuration.AdditionalSettings.ContainsKey("userdequeueparams"))
     {
         ((List <SQLiteParameter>)configuration.AdditionalSettings["userdequeueparams"]).Add(parameter);
     }
     else
     {
         var data = new List <SQLiteParameter> {
             parameter
         };
         configuration.AdditionalSettings.Add("userdequeueparams", data);
     }
 }
示例#28
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="DequeueRpcLua"/> class.
 /// </summary>
 /// <param name="connection">The connection.</param>
 /// <param name="redisNames">The redis names.</param>
 /// <param name="configuration">The configuration.</param>
 public DequeueRpcLua(IRedisConnection connection, RedisNames redisNames, QueueConsumerConfiguration configuration)
     : base(connection, redisNames)
 {
     _configuration = configuration;
     Script         = @"local count = redis.call('LREM', @pendingkey, 1, @uuid) 
             if (count==0) then 
                 return nil;
             end                   
             local expireScore = redis.call('zscore', @expirekey, @uuid)
             redis.call('zadd', @workingkey, @timestamp, @uuid) 
             local message = redis.call('hget', @valueskey, @uuid) 
             redis.call('hset', @StatusKey, @uuid, '1') 
             local headers = redis.call('hget', @headerskey, @uuid)
             return {@uuid, message, headers, expireScore}";
 }
        public CreateDequeueStatement(ISqlServerMessageQueueTransportOptionsFactory optionsFactory,
                                      ITableNameHelper tableNameHelper,
                                      SqlServerCommandStringCache commandCache,
                                      QueueConsumerConfiguration configuration)
        {
            Guard.NotNull(() => optionsFactory, optionsFactory);
            Guard.NotNull(() => tableNameHelper, tableNameHelper);
            Guard.NotNull(() => commandCache, commandCache);
            Guard.NotNull(() => configuration, configuration);

            _options         = new Lazy <SqlServerMessageQueueTransportOptions>(optionsFactory.Create);
            _tableNameHelper = tableNameHelper;
            _commandCache    = commandCache;
            _configuration   = configuration;
        }
示例#30
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;
        }