Пример #1
0
        public void Dispose()
        {
            var disposableScheduler = _taskFactory.Scheduler as IDisposable;

            if (disposableScheduler != null)
            {
                disposableScheduler.Dispose();
            }

            _next.Dispose();
        }
Пример #2
0
        public async void Dispose()
        {
            // Register for receipt
            var subscription = IncommingMessages.GetObservable("RECEIPT")
                               .Where(m => m.Headers.Any(h => h.Key == "receipt-id" && h.Value.ToString() == "disconnect-msg"));

            using (var lateSubscriber = new LateSubscriber <IMessage>(subscription))
            {
                // Dispose nicely, Send Discnonect message and wait for receipt.
                await SendMessage(new MessageBuilder("DISCONNECT").Header("receipt", "disconnect-msg").WithoutBody());

                var message = lateSubscriber.RecordedItems.FirstAsync().Wait();
            }

            _disposed = true;

            _messageSerializer.Dispose();
            _incommingMessagesSubject.Dispose();
            _outgoingMessagesSubject.Dispose();
            _client.Close();
        }
Пример #3
0
 public void Dispose()
 {
     _binder?.Dispose();
     _channel?.Dispose();
     _serializer?.Dispose();
 }