Пример #1
0
        protected virtual ReplicatorChannelProcessor CreateChannelProcessor(Symbol publisherId)
        {
            var channelProcessor = new ReplicatorChannelProcessor(this, publisherId);

            channelProcessor.Run().ContinueWith(_ => {
                // Since ChannelProcessor is AsyncProcessorBase desc.,
                // its disposal will shut down RunAsync as well,
                // so "subscribing" to RunAsync completion is the
                // same as subscribing to its disposal.
                ChannelProcessors.TryRemove(publisherId, channelProcessor);
            });
            return(channelProcessor);
        }
Пример #2
0
        protected virtual ReplicatorChannelProcessor CreateChannelProcessor(Symbol publisherId)
        {
            var logger           = Services.GetRequiredService <ILoggerFactory>().CreateLogger(nameof(ReplicatorChannelProcessor));
            var channelProcessor = new ReplicatorChannelProcessor(this, publisherId, logger);

            channelProcessor.Run().ContinueWith(_ => {
                // Since ChannelProcessor is AsyncProcessorBase desc.,
                // its disposal will shut down Run as well,
                // so "subscribing" to Run completion is the
                // same as subscribing to its disposal.
                ChannelProcessors.TryRemove(publisherId, channelProcessor);
            });
            return(channelProcessor);
        }