Exemplo n.º 1
0
        public async Task CanFetch()
        {
            int partitionId = 0;
            var router      = new BrokerRouter(new KafkaOptions(TestConfig.IntegrationUri));

            var    producer     = new Producer(router);
            string messageValue = Guid.NewGuid().ToString();
            var    response     = await producer.SendMessageAsync(new Message(messageValue), TestConfig.TopicName(), partitionId, CancellationToken.None);

            var offset = response.Offset;

            var fetch = new FetchRequest.Topic(TestConfig.TopicName(), partitionId, offset, 32000);

            var fetchRequest = new FetchRequest(fetch, minBytes: 10);

            var r = await router.SendAsync(fetchRequest, TestConfig.TopicName(), partitionId, CancellationToken.None);

            Assert.IsTrue(r.Topics.First().Messages.First().Value.ToUtf8String() == messageValue);
        }