public OffsetRequest(String topic, Int32[] partitions, OffsetOption offsetOption) : base(ApiKey.OffsetRequest) { if (partitions == null || partitions.Length == 0) { throw new ArgumentOutOfRangeException("partitions"); } var details = new List <OffsetsRequestTopicPartitionDetail>(); foreach (var partition in partitions) { details.Add(new OffsetsRequestTopicPartitionDetail() { Partition = partition, Time = (Int64)offsetOption, MaxNumberOfOffsets = 1 }); } ReplicaId = -1; TopicPartitions = new[] { new OffsetsRequestTopicPartition { TopicName = topic, Details = details } }; }
public void SetActiveValue(double offset, bool legacy) { OffsetOption.SetActiveValue(offset); VelocityGainOffsetCheck.Checked = !legacy; LegacyOffsetCheck.Checked = legacy; }
public Int64[] Offset(String topic, Int32[] partitions, OffsetOption option) { if (partitions == null || partitions.Length == 0) { throw new ArgumentOutOfRangeException("partitions"); } var offsets = new Int64[partitions.Length]; for (int i = 0; i < partitions.Length; i++) { offsets[i] = Offset(topic, partitions[i], option); } return(offsets); }
public Int64 Offset(String topic, Int32 partition, OffsetOption option) { EnsureLegalTopicSpelling(topic); var broker = _topicBrokerDispatcher.SelectBroker(topic, partition); var request = new OffsetRequest(topic, new[] { partition }, option); var response = (OffsetResponse)SubmitRequest(broker, request); var errors = response.TopicPartitions .SelectMany(r => r.PartitionOffsets) .Where(x => x.ErrorCode != ErrorCode.NoError) .ToList(); if (errors.Count > 0 && errors.All(e => e.ErrorCode == ErrorCode.UnknownTopicOrPartition)) { return(-1L); } if (errors.Count > 1) { throw new ProtocolException(errors.First().ErrorCode); } return(response.TopicPartitions[0].PartitionOffsets[0].Offsets[0]); }
public override void AlignActiveValues() { OffsetOption.AlignActiveValues(); }
public override void Show(string name) { OffsetOption.Show(name); }
public void Show() { OffsetOption.Show(); }
public override void Hide() { OffsetOption.Hide(); }