コード例 #1
0
ファイル: Bus.cs プロジェクト: lulzzz/Kontur
        public ISubscriptionTag Subscribe <T>(ISubscriber subscriber, int queueCapacity = 1)
        {
            DataflowBlockOptions queueOptions = new DataflowBlockOptions
            {
                BoundedCapacity = queueCapacity
            };

            MessageBuffer    workerQueue   = new MessageBuffer(queueOptions);
            ISubscriptionTag subscriberTag = subscriber.SubscribeTo(workerQueue);

            ISubscriptionTag dispatcherTag = this.LinkDispatcherTo <T>(workerQueue);

            subscriberTag = new CompositeSubscriptionTag(Guid.NewGuid().ToString(), subscriberTag, dispatcherTag);
            subscribers.AddOrUpdate(subscriberTag.Id, subscriberTag, (o, n) => n);

            return(subscriberTag);
        }
コード例 #2
0
ファイル: Bus.cs プロジェクト: alexzaitzev/Kontur
        public ISubscriptionTag Subscribe <T>(ISubscriber subscriber, int queueCapacity = 1)
        {
            this.logService.Info("Creating subscription to {0} with the queue capacity equals: {1}.", typeof(T), queueCapacity);
            DataflowBlockOptions queueOptions = new DataflowBlockOptions
            {
                BoundedCapacity = queueCapacity
            };

            MessageBuffer    workerQueue   = new MessageBuffer(queueOptions);
            ISubscriptionTag subscriberTag = subscriber.SubscribeTo(workerQueue);

            ISubscriptionTag dispatcherTag = this.LinkDispatcherTo <T>(workerQueue);

            subscriberTag = new CompositeSubscriptionTag(Guid.NewGuid().ToString(), subscriberTag, dispatcherTag);
            subscribers.AddOrUpdate(subscriberTag.Id, subscriberTag, (o, n) => n);

            return(subscriberTag);
        }