public Task <BaseCommand> Outgoing(CommandGetLastMessageId command) { using (TakeConsumerSenderLock(command.ConsumerId)) { return(_requestResponseHandler.Outgoing(command)); } }
public async ValueTask <MessageId> GetLastMessageId(CancellationToken cancellationToken) { ThrowIfDisposed(); var getLastMessageId = new CommandGetLastMessageId(); return(await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false)); }
public async Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command, CancellationToken cancellationToken) { command.ConsumerId = _id; var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false); response.Expect(BaseCommand.Type.GetLastMessageIdResponse); return(response.GetLastMessageIdResponse); }
public static BaseCommand AsBaseCommand(this CommandGetLastMessageId command) { return(new BaseCommand { CommandType = BaseCommand.Type.GetLastMessageId, GetLastMessageId = command }); }
public static BaseCommand ToBaseCommand(this CommandGetLastMessageId value) { return(new BaseCommand { type = BaseCommand.Type.GetLastMessageId, getLastMessageId = value }); }
public async Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command) { command.ConsumerId = _id; var response = await _connection.Send(command); response.Expect(BaseCommand.Type.GetLastMessageIdResponse); return(response.GetLastMessageIdResponse); }
public async ValueTask <MessageId> GetLastMessageId(CancellationToken cancellationToken) { ThrowIfDisposed(); var getLastMessageId = new CommandGetLastMessageId(); var response = await _executor.Execute(() => _channel.Send(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false); return(new MessageId(response.LastMessageId)); }
public async Task <BaseCommand> Send(CommandGetLastMessageId 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)); }
public async Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command) { try { command.ConsumerId = _id; var response = await _connection.Send(command); response.Expect(BaseCommand.Type.GetLastMessageIdResponse); return(response.GetLastMessageIdResponse); } catch (Exception exception) { OnException(exception); throw; } }
public Builder() { _last = new CommandGetLastMessageId(); }
public Task <BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken) => SendRequestResponse(command.AsBaseCommand(), cancellationToken);
public Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command, CancellationToken cancellationToken) => throw GetException();
public async Task <BaseCommand> Send(CommandGetLastMessageId command) => await SendRequestResponse(command.AsBaseCommand());
private async ValueTask <MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken) { var response = await _channel.Send(command, cancellationToken).ConfigureAwait(false); return(new MessageId(response.LastMessageId)); }
private async ValueTask <MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken) => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
public Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command) => throw GetException();
public Task <BaseCommand> Outgoing(CommandGetLastMessageId command) { command.RequestId = _requestId.FetchNext(); return(_requests.CreateTask(StandardRequest.WithRequestId(command.RequestId))); }