Exemplo n.º 1
0
 public Task <BaseCommand> Outgoing(CommandSeek command)
 {
     using (TakeConsumerSenderLock(command.ConsumerId))
     {
         return(_requestResponseHandler.Outgoing(command));
     }
 }
Exemplo n.º 2
0
 public static BaseCommand ToBaseCommand(this CommandSeek value)
 {
     return(new BaseCommand
     {
         type = BaseCommand.Type.Seek,
         Seek = value
     });
 }
Exemplo n.º 3
0
        public async Task Send(CommandSeek command, CancellationToken cancellationToken)
        {
            command.ConsumerId = _id;
            var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);

            response.Expect(BaseCommand.Type.Success);
            _batchHandler.Clear();
        }
Exemplo n.º 4
0
 public static BaseCommand AsBaseCommand(this CommandSeek command)
 {
     return(new BaseCommand
     {
         CommandType = BaseCommand.Type.Seek,
         Seek = command
     });
 }
Exemplo n.º 5
0
        public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();

            var seek = new CommandSeek {
                MessageId = messageId.ToMessageIdData()
            };
            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 6
0
        public async ValueTask Seek(ulong publishTime, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();

            var seek = new CommandSeek {
                MessagePublishTime = publishTime
            };
            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 7
0
        public async Task <CommandSuccess> Send(CommandSeek command)
        {
            command.ConsumerId = _id;
            var response = await _connection.Send(command);

            response.Expect(BaseCommand.Type.Success);
            _batchHandler.Clear();
            return(response.Success);
        }
Exemplo n.º 8
0
        public async ValueTask Seek(DateTimeOffset publishTime, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();

            var seek = new CommandSeek {
                MessagePublishTime = (ulong)publishTime.ToUnixTimeMilliseconds()
            };

            _ = await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 9
0
        public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
        {
            var seek = new CommandSeek {
                MessageId = messageId.Data
            };

            _ = await _executor.Execute(() => Stream.Send(seek), cancellationToken);

            return;
        }
Exemplo n.º 10
0
        public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();
            var seek = new CommandSeek {
                MessageId = messageId.Data
            };

            _ = await _executor.Execute(() => _channel.Send(seek), cancellationToken);

            return;
        }
Exemplo n.º 11
0
        public static ReadOnlySequence <byte> NewSeek(long consumerId, long requestId, long timestamp)
        {
            var seek = new CommandSeek
            {
                ConsumerId         = (ulong)consumerId,
                RequestId          = (ulong)requestId,
                MessagePublishTime = (ulong)timestamp
            };

            return(Serializer.Serialize(seek.ToBaseCommand()));
        }
Exemplo n.º 12
0
        public static ReadOnlySequence <byte> NewSeek(long consumerId, long requestId, long ledgerId, long entryId, long[] ackSet)
        {
            var seek = new CommandSeek {
                ConsumerId = (ulong)consumerId, RequestId = (ulong)requestId
            };

            var messageId = new MessageIdData {
                ledgerId = (ulong)ledgerId, entryId = (ulong)entryId, AckSets = ackSet
            };

            seek.MessageId = messageId;
            return(Serializer.Serialize(seek.ToBaseCommand()));
        }
Exemplo n.º 13
0
        public async Task <BaseCommand> Send(CommandSeek 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.º 14
0
        public async Task <CommandSuccess> Send(CommandSeek command)
        {
            try
            {
                command.ConsumerId = _id;
                var response = await _connection.Send(command);

                response.Expect(BaseCommand.Type.Success);
                _batchHandler.Clear();
                return(response.Success);
            }
            catch (Exception exception)
            {
                OnException(exception);
                throw;
            }
        }
Exemplo n.º 15
0
 private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
 => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
Exemplo n.º 16
0
 public Task <BaseCommand> Outgoing(CommandSeek command)
 {
     command.RequestId = _requestId.FetchNext();
     return(_requests.CreateTask(StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId, BaseCommand.Type.Seek)));
 }
Exemplo n.º 17
0
 public Task <BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken)
 => SendRequestResponse(command.AsBaseCommand(), cancellationToken);
Exemplo n.º 18
0
 public Task <CommandSuccess> Send(CommandSeek command, CancellationToken cancellationToken)
 => throw GetException();
Exemplo n.º 19
0
 public Task <CommandSuccess> Send(CommandSeek command) => throw GetException();
Exemplo n.º 20
0
 public async Task <BaseCommand> Send(CommandSeek command) => await SendRequestResponse(command.AsBaseCommand());