コード例 #1
0
        public ReceiveEndpointHandle Start(CancellationToken cancellationToken)
        {
            LogContext.SetCurrentIfNull(_context.LogContext);

            if (_handle != null)
            {
                throw new InvalidOperationException($"The receive endpoint was already started: {InputAddress}");
            }

            _handle = new EndpointHandle(this, _transport, _startObserver, cancellationToken);

            _handle.Start();

            return(_handle);
        }
コード例 #2
0
        public async Task Stop(bool removed, CancellationToken cancellationToken)
        {
            LogContext.SetCurrentIfNull(_context.LogContext);

            if (_handle != null)
            {
                await _context.EndpointObservers.Stopping(new ReceiveEndpointStoppingEvent(_context.InputAddress, this, removed)).ConfigureAwait(false);

                await _handle.TransportHandle.Stop(cancellationToken).ConfigureAwait(false);

                _handle = null;
            }

            _context.Reset();
        }
コード例 #3
0
 public ConnectHandle ConnectEndpointHandle(EndpointHandle handle)
 {
     return(_handles.Connect(handle));
 }