Exemplo n.º 1
0
 public RabbitMQAdapterReceiver(RabbitMQStreamProviderConfiguration configuration, string providerName, SerializationManager serializationManager, QueueId queueId, RabbitMQMessageQueueDataManager queue, IRabbitMQDataAdapter dataAdapter, Logger logger)
 {
     _configuration        = configuration;
     _providerName         = providerName;
     _serializationManager = serializationManager;
     _queue       = queue;
     _dataAdapter = dataAdapter;
     Id           = queueId;
     _logger      = logger;
     _pending     = new List <PendingDelivery>();
 }
Exemplo n.º 2
0
 public async Task Shutdown(TimeSpan timeout)
 {
     try
     {
         if (_outstandingTask != null) // await the last storage operation, so after we shutdown and stop this receiver we don't get async operation completions from pending storage operations.
         {
             await _outstandingTask;
         }
         if (_queue != null)
         {
             await _queue.CloseQueueAsync();
         }
     }
     finally
     {
         _queue = null;  // remember that we shut down so we never try to read from the queue again.
     }
 }
Exemplo n.º 3
0
        public static RabbitMQMessageQueueDataManager CreateQueueDataManager(string providerName, RabbitMQStreamProviderConfiguration configuration, string connectionName,
                                                                             Logger logger)
        {
            var queue = new RabbitMQMessageQueueDataManager(configuration, connectionName, logger);
            List <RabbitMQMessageQueueDataManager> queues;

            if (QueueDataManagers.TryGetValue(providerName, out queues))
            {
                queues.Add(queue);
            }
            else
            {
                queues = new List <RabbitMQMessageQueueDataManager> {
                    queue
                };
                QueueDataManagers.TryAdd(providerName, queues);
            }
            return(queue);
        }