Exemplo n.º 1
0
        public async Task <BaseCommand> Send(CommandCloseProducer command)
        {
            var response = await SendRequestResponse(command.AsBaseCommand());

            if (response.CommandType == BaseCommand.Type.Success)
            {
                _producerManager.Remove(command.ProducerId);
            }
            return(response);
        }
Exemplo n.º 2
0
        public async Task <BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();

            Task <BaseCommand>?responseTask;

            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
            {
                responseTask = _channelManager.Outgoing(command);
                var sequence = Serializer.Serialize(command.AsBaseCommand());
                await _stream.Send(sequence).ConfigureAwait(false);
            }

            return(await responseTask.ConfigureAwait(false));
        }
Exemplo n.º 3
0
        public async Task <BaseCommand> Send(CommandCloseProducer command)
        {
            Task <BaseCommand>?responseTask = null;

            using (await _lock.Lock())
            {
                var baseCommand = command.AsBaseCommand();
                responseTask = _requestResponseHandler.Outgoing(baseCommand);
                _channelManager.Outgoing(command, responseTask);
                var sequence = Serializer.Serialize(baseCommand);
                await _stream.Send(sequence);
            }

            return(await responseTask);
        }