Reputation: 21
I'm using Kafka 2.1.0 and want to publish a message once the subscription has taken place. Is there a way for the producer to know if a subscription has happened and then publish a message? Otherwise I'd be losing the 1st message every time.
Upvotes: 0
Views: 1296
Reputation: 2892
From https://kafka.apache.org/documentation.html#newconsumerconfigs, auto.offset.reset
states:
What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted):
earliest: automatically reset the offset to the earliest offset
latest: automatically reset the offset to the latest offset
none: throw exception to the consumer if no previous offset is found for the consumer's group
anything else: throw exception to the consumer.
Default value of auto.offset.reset
is latest
. To ensure that your consumer doesn't loses out first record, you need to set auto.offset.reset
to earliest
.
Upvotes: 1