public async Task ConsumerMetadataRequestShouldReturnWithoutError() { using (var router = new BrokerRouter(_options)) { var conn = await router.GetBrokerRouteAsync(TestConfig.TopicName(), 0, CancellationToken.None); var request = new GroupCoordinatorRequest(TestConfig.ConsumerName()); var response = await conn.Connection.SendAsync(request, CancellationToken.None); Assert.That(response, Is.Not.Null); Assert.That(response.ErrorCode, Is.EqualTo(ErrorResponseCode.None)); } }
public async Task OffsetCommitShouldStoreMetadata() { const int partitionId = 0; const long offset = 101; const string metadata = "metadata"; var router = new BrokerRouter(_options); var conn = await router.GetBrokerRouteAsync(TestConfig.TopicName(), partitionId, CancellationToken.None); // ensure the group exists var group = new GroupCoordinatorRequest(TestConfig.ConsumerName()); var groupResponse = await conn.Connection.SendAsync(group, CancellationToken.None); Assert.That(groupResponse, Is.Not.Null); Assert.That(groupResponse.ErrorCode, Is.EqualTo(ErrorResponseCode.None)); var commit = new OffsetCommitRequest(group.GroupId, new [] { new OffsetCommitRequest.Topic(TestConfig.TopicName(), partitionId, offset, metadata) }); var commitResponse = await conn.Connection.SendAsync(commit, CancellationToken.None); var commitTopic = commitResponse.Topics.SingleOrDefault(); Assert.That(commitTopic, Is.Not.Null); Assert.That(commitTopic.ErrorCode, Is.EqualTo(ErrorResponseCode.None)); var fetch = new OffsetFetchRequest(TestConfig.ConsumerName(), commitTopic); var fetchResponse = await conn.Connection.SendAsync(fetch, CancellationToken.None); var fetchTopic = fetchResponse.Topics.SingleOrDefault(); Assert.That(fetchTopic, Is.Not.Null); Assert.That(fetchTopic.ErrorCode, Is.EqualTo(ErrorResponseCode.None)); Assert.That(fetchTopic.Offset, Is.EqualTo(offset)); Assert.That(fetchTopic.MetaData, Is.EqualTo(metadata)); router.Dispose(); }