Example #1
0
        public async Task UpdateOrCreateOffsetConsumerGroupEmptyTest()
        {
            // 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();

            ManualConsumer consumer = new ManualConsumer(partitionId, topic, protocolGateway, "TestClient", DefaultMaxMessageSetSize);

            var offest = 5;

            await consumer.UpdateOrCreateOffset(string.Empty, offest);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        public async Task FetchOffsetConsumerGroupIsNullTest()
        {
            // 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(null);
        }