Example #1
0
 public Task <BaseCommand> Outgoing(CommandSeek command)
 {
     using (TakeConsumerSenderLock(command.ConsumerId))
     {
         return(_requestResponseHandler.Outgoing(command));
     }
 }
Example #2
0
 public static BaseCommand ToBaseCommand(this CommandSeek value)
 {
     return(new BaseCommand
     {
         type = BaseCommand.Type.Seek,
         Seek = value
     });
 }
Example #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();
        }
Example #4
0
 public static BaseCommand AsBaseCommand(this CommandSeek command)
 {
     return(new BaseCommand
     {
         CommandType = BaseCommand.Type.Seek,
         Seek = command
     });
 }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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;
        }
Example #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;
        }
Example #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()));
        }
Example #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()));
        }
Example #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));
        }
Example #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;
            }
        }
Example #15
0
 private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
 => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
Example #16
0
 public Task <BaseCommand> Outgoing(CommandSeek command)
 {
     command.RequestId = _requestId.FetchNext();
     return(_requests.CreateTask(StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId, BaseCommand.Type.Seek)));
 }
Example #17
0
 public Task <BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken)
 => SendRequestResponse(command.AsBaseCommand(), cancellationToken);
 public Task <CommandSuccess> Send(CommandSeek command, CancellationToken cancellationToken)
 => throw GetException();
Example #19
0
 public Task <CommandSuccess> Send(CommandSeek command) => throw GetException();
Example #20
0
 public async Task <BaseCommand> Send(CommandSeek command) => await SendRequestResponse(command.AsBaseCommand());