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); }
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(); }
public ConnectHandle ConnectEndpointHandle(EndpointHandle handle) { return(_handles.Connect(handle)); }