Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 3
0
        public QueueDispatcher(IQueueFactory <T> queueFactory)
        {
            if (queueFactory == null)
            {
                throw new ArgumentNullException(nameof(queueFactory));
            }

            _client = queueFactory.Create();
        }
Exemplo 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});
 }
Exemplo n.º 5
0
            public void With <T>() where T : ITaskQueue
            {
                var newQueue = queueFactory.Create <T>(queueToSwap.UserId);

                newQueue.InitializeFrom(queueToSwap);

                queues[queueToSwap.UserId] = newQueue;

                queueToSwap = null;
            }
Exemplo 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);
        }
Exemplo 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;
        }
Exemplo 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);
 }