示例#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);
        }
示例#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);
        }
示例#3
0
        public QueueDispatcher(IQueueFactory <T> queueFactory)
        {
            if (queueFactory == null)
            {
                throw new ArgumentNullException(nameof(queueFactory));
            }

            _client = queueFactory.Create();
        }
示例#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;
            }
示例#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);
        }
        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;
        }
示例#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);
 }