예제 #1
0
        public async Task <BusSubscription <T> > Subscribe <T>(Action <BusSubscription <T> > configure, string topic = null, CancellationToken cancellationToken = default) where T : class
        {
            await Task.CompletedTask;
            var subscription = new BusSubscription <T>();

            configure.Invoke(subscription);
            lock (this.subscriptions)
            {
                this.subscriptions.Add(subscription);
            }
            return(subscription);
        }
예제 #2
0
        public async Task <BusSubscription> Subscribe(Action <BusSubscription> configure, CancellationToken cancellationToken = default)
        {
            await Task.CompletedTask;
            var subs = new BusSubscription();

            configure.Invoke(subs);
            lock (this.subscriptions)
            {
                this.subscriptions.Add(subs);
            }
            return(subs);
        }