Beispiel #1
0
        public async Task Cleanup()
        {
            if (logger.IsVerbose)
            {
                logger.Verbose("Cleanup() called");
            }
            if (myExtension == null)
            {
                return;
            }

            var allHandles = myExtension.GetAllStreamHandles <T>();
            var tasks      = new List <Task>();

            foreach (var handle in allHandles)
            {
                myExtension.RemoveObserver(handle.SubscriptionId);
                tasks.Add(pubSub.UnregisterConsumer(handle.SubscriptionId, stream.StreamId, streamProviderName));
            }
            try
            {
                await Task.WhenAll(tasks);
            } catch (Exception exc)
            {
                logger.Warn((int)ErrorCode.StreamProvider_ConsumerFailedToUnregister,
                            "Ignoring unhandled exception during PubSub.UnregisterConsumer", exc);
            }
            myExtension = null;
        }
Beispiel #2
0
        public async Task Cleanup()
        {
            _ = RequestContextExtensions.SuppressCurrentCallChainFlow();

            if (logger.IsEnabled(LogLevel.Debug))
            {
                logger.LogDebug("Cleanup() called");
            }
            if (myExtension == null)
            {
                return;
            }

            var allHandles = myExtension.GetAllStreamHandles <T>();
            var tasks      = new List <Task>();

            foreach (var handle in allHandles)
            {
                myExtension.RemoveObserver(handle.SubscriptionId);
                tasks.Add(pubSub.UnregisterConsumer(handle.SubscriptionId, stream.InternalStreamId));
            }
            try
            {
                await Task.WhenAll(tasks);
            } catch (Exception exc)
            {
                logger.LogWarning(
                    (int)ErrorCode.StreamProvider_ConsumerFailedToUnregister,
                    exc,
                    "Ignoring unhandled exception during PubSub.UnregisterConsumer");
            }
            myExtension = null;
        }