c# - Kafka being able to write to a topic beyond retention period -
what behavior of topics go beyond retention period? possible write them after retention policy period? have been trying write them on confluent-kafka-dotnet (a .net library) when run consumer don't see messages streaming through. value of partition empty string array. possible write topic beyond retention time or topic disabled?
using (var consumer = new consumer(config)) { consumer.assign(new list<topicpartitionoffset> { new topicpartitionoffset(topicname, 0, 0) }); while (true) { message msg; if (consumer.consume(out msg)) { console.writeline("topic: {0} response: p{1},o{1} :{3}", msg.topic, msg.partition, msg.topicpartitionoffset, encoding.utf8.getstring(msg.value)); } } }
kafka's retention period applies past events, not event writing right now. should able see new messages no matter retention policy is.
example: topic 24h retention created @ midnight, july 1st. on 23:50, july 1st, data wrote during entire day still there. @ 01:00, july 2nd, data written after 1:00am, july 1st stored (last 24h), earlier events "purged".
if consumer can't see new messages, 1 of two: 1. messages being written @ all? (kafka has file-dump utility check) 2. when consumer start reading? if consumer starts @ end of topic, may miss earlier messages. if starts @ beginning, messages in topic. "auto.offset.reset" configuration controls this. "--from-beginning" if using console consumer.
Comments
Post a Comment