public async Task UpdateOrCreateOffsetNegativeOffsetTest() { // Creating a broker router and a protocol gateway for the producer and consumer var protocolGateway = new ProtocolGateway(_kafkaUri); var partitionId = 0; var topic = _topic + Guid.NewGuid(); var consumerGroup = _defaultConsumerGroup; ManualConsumer consumer = new ManualConsumer(partitionId, topic, protocolGateway, "TestClient", DefaultMaxMessageSetSize); var offest = -5; await consumer.UpdateOrCreateOffset(consumerGroup, offest); }
public async Task UpdateOrCreateOffsetConsumerGroupExistsTest() { // Creating a broker router and a protocol gateway for the producer and consumer var protocolGateway = new ProtocolGateway(_kafkaUri); var partitionId = 0; var consumerGroup = _defaultConsumerGroup + Guid.NewGuid(); ManualConsumer consumer = new ManualConsumer(partitionId, _topic, protocolGateway, "TestClient", DefaultMaxMessageSetSize); var offest = 5; var newOffset = 10; await consumer.UpdateOrCreateOffset(consumerGroup, offest); var res = await consumer.FetchOffset(consumerGroup); Assert.AreEqual(offest, res); await consumer.UpdateOrCreateOffset(consumerGroup, newOffset); res = await consumer.FetchOffset(consumerGroup); Assert.AreEqual(newOffset, res); }
public async Task UpdateOrCreateOffsetPartitionDoesntExistTest() { // Creating a broker router and a protocol gateway for the producer and consumer var protocolGateway = new ProtocolGateway(_kafkaUri); var partitionId = 100; var consumerGroup = Guid.NewGuid().ToString(); ManualConsumer consumer = new ManualConsumer(partitionId, _topic, protocolGateway, "TestClient", DefaultMaxMessageSetSize); var offest = 5; await consumer.UpdateOrCreateOffset(consumerGroup, offest); }
public async Task FetchOffsetConsumerGroupIsEmptyTest() { // Creating a broker router and a protocol gateway for the producer and consumer var protocolGateway = new ProtocolGateway(_kafkaUri); var partitionId = 0; var consumerGroup = _defaultConsumerGroup; ManualConsumer consumer = new ManualConsumer(partitionId, _topic, protocolGateway, "TestClient", DefaultMaxMessageSetSize); var offest = 5; await consumer.UpdateOrCreateOffset(consumerGroup, offest); await consumer.FetchOffset(string.Empty); }