Topic messages are disappearing from a topic when using confluent client. The only ones I can see (while not reloading page), are messages which I create using the "Produce" option in the same page. Kafka configurations are ok (I think), but I still don't understand what is wrong?
Asked
Active
Viewed 1,159 times
1
-
1Please provide enough code so others can better understand or reproduce the problem. – Community Nov 20 '21 at 05:31
1 Answers
0
Looks like you are producing and consuming messages through a web browser.
Consumers typically subscribe to a topic and commit the offsets which have been consumed. The subsequent polls do not return the older messages (unless you do a seek operation) but only the newly produced messages.
The term disappearing may be applicable in two contexts:
- As said above, consumer has already consumed that message and doesn't consume it again (because it has polled it already)
- Your topic retention policy could be deleting older messages. You can check this, by using built in tools like
kafka-console-consumer
orkafka-avro-console-consumer
with--from-beginning
flag. If the messages are there means that is an issue with your consumer.
If you are calling consumer.poll()
on every reload, then you will only get the messages after the previous call to poll (i.e. produced after the last reload). In case, you want all messages that have been present in the topic, since beginning or since sometime, you need to seek
from beginning
or since some timestamp or offset. See seek in KafkaConsumer

JavaTechnical
- 8,846
- 8
- 61
- 97