/// <summary> /// It executes steps needed when closing the instance /// </summary> /// <exception cref="System.NotImplementedException"></exception> protected override void OnClosing() { MessageReceiver.FeedMessageReceived -= OnMessageReceived; MessageReceiver.FeedMessageDeserializationFailed -= OnMessageDeserializationFailed; _messageProcessor.MessageProcessed -= OnMessageProcessed; MessageReceiver.Close(); }
/// <summary> /// Closes the current instance /// </summary> /// <exception cref="InvalidOperationException">Current FeedSystemSession is already closed</exception> public void Close() { if (Interlocked.CompareExchange(ref _isOpened, 0, 1) == 0) { throw new InvalidOperationException("Current FeedSystemSession is already closed"); } _messageReceiver.FeedMessageReceived -= OnFeedMessageReceived; _messageReceiver.FeedMessageDeserializationFailed -= OnFeedMessageDeserializationFailed; _messageReceiver.Close(); }
public void EventsAreNotRaisedAfterTheReceiverIsClosed() { _messageReceiver.Open(MessageInterest.AllMessages, FeedRoutingKeyBuilder.GetStandardKeys()); _messageReceiver.Close(); EventsAreNotRaisedBeforeTheReceiverIsOpened(); }