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); }
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); }