Esempio n. 1
0
        public void Should_create_queue_when_connection_is_established_for_the_first_time()
        {
            queueFactory.Create(model).Returns(new QueueDeclareOk("someQueue", 1, 1));

            aggregator.Notify(new ConnectionEstablished(connection));

            queueFactory.Received().Create(model);
        }
Esempio n. 2
0
        private IQueue CreateQueue(IQueueFactory queueFactory, Uri queueUri)
        {
            var result = queueFactory.Create(queueUri);

            Guard.AgainstNull(result,
                              string.Format(ESBResources.QueueFactoryCreatedNullQueue, queueFactory.GetType().FullName, queueUri));

            return(result);
        }
Esempio n. 3
0
        public QueueDispatcher(IQueueFactory <T> queueFactory)
        {
            if (queueFactory == null)
            {
                throw new ArgumentNullException(nameof(queueFactory));
            }

            _client = queueFactory.Create();
        }
Esempio n. 4
0
 private static void Run(
     IQueueFactory queueFactory,
     IStatisticsProcesser processer,
     IStatisticsWriter writer)
 {
     var q = queueFactory.Create();
     q.OnMessageAsync(msg => MessageProcessor.ProcessAsync(processer, writer, msg),
         new OnMessageOptions {AutoComplete = false});
 }
            public void With <T>() where T : ITaskQueue
            {
                var newQueue = queueFactory.Create <T>(queueToSwap.UserId);

                newQueue.InitializeFrom(queueToSwap);

                queues[queueToSwap.UserId] = newQueue;

                queueToSwap = null;
            }
Esempio n. 6
0
        public QueueObservable(ILogger <ManagedObservable <T> > logger,
                               IQueueFactory <T> queueFactory) : base(logger)
        {
            if (queueFactory == null)
            {
                throw new ArgumentNullException(nameof(queueFactory));
            }

            _queueClient = queueFactory.Create();
            _queueClient.RegisterCallback(Notify);
        }
Esempio n. 7
0
        private IQueue CreateQueue(IQueueFactory queueFactory, Uri queueUri)
        {
            var result = queueFactory.Create(queueUri);

            Guard.AgainstNull(result,
                string.Format(ESBResources.QueueFactoryCreatedNullQueue, queueFactory.GetType().FullName, queueUri));

            return result;
        }
Esempio n. 8
0
 /// <summary>
 /// Creates a pool for reusable instances
 /// </summary>
 /// <param name="capacity">The maximum number of instances to keep in the pool</param>
 protected ReusableObjectFactory Initialize(int capacity)
 {
     Queue = _queueFactory.Create <IReusable>(capacity);
     return(this);
 }