Ejemplo n.º 1
0
 public Task <BaseCommand> Outgoing(CommandGetLastMessageId command)
 {
     using (TakeConsumerSenderLock(command.ConsumerId))
     {
         return(_requestResponseHandler.Outgoing(command));
     }
 }
Ejemplo n.º 2
0
        public async ValueTask <MessageId> GetLastMessageId(CancellationToken cancellationToken)
        {
            ThrowIfDisposed();

            var getLastMessageId = new CommandGetLastMessageId();

            return(await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public static BaseCommand AsBaseCommand(this CommandGetLastMessageId command)
 {
     return(new BaseCommand
     {
         CommandType = BaseCommand.Type.GetLastMessageId,
         GetLastMessageId = command
     });
 }
Ejemplo n.º 5
0
 public static BaseCommand ToBaseCommand(this CommandGetLastMessageId value)
 {
     return(new BaseCommand
     {
         type = BaseCommand.Type.GetLastMessageId,
         getLastMessageId = value
     });
 }
Ejemplo n.º 6
0
        public async Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command)
        {
            command.ConsumerId = _id;
            var response = await _connection.Send(command);

            response.Expect(BaseCommand.Type.GetLastMessageIdResponse);
            return(response.GetLastMessageIdResponse);
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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;
            }
        }
Ejemplo n.º 10
0
 public Builder()
 {
     _last = new CommandGetLastMessageId();
 }
Ejemplo n.º 11
0
 public Task <BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
 => SendRequestResponse(command.AsBaseCommand(), cancellationToken);
Ejemplo n.º 12
0
 public Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
 => throw GetException();
Ejemplo n.º 13
0
 public async Task <BaseCommand> Send(CommandGetLastMessageId command) => await SendRequestResponse(command.AsBaseCommand());
Ejemplo n.º 14
0
        private async ValueTask <MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
        {
            var response = await _channel.Send(command, cancellationToken).ConfigureAwait(false);

            return(new MessageId(response.LastMessageId));
        }
Ejemplo n.º 15
0
 private async ValueTask <MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
 => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
Ejemplo n.º 16
0
 public Task <CommandGetLastMessageIdResponse> Send(CommandGetLastMessageId command) => throw GetException();
Ejemplo n.º 17
0
 public Task <BaseCommand> Outgoing(CommandGetLastMessageId command)
 {
     command.RequestId = _requestId.FetchNext();
     return(_requests.CreateTask(StandardRequest.WithRequestId(command.RequestId)));
 }