-
-
Notifications
You must be signed in to change notification settings - Fork 270
Description
librdkafka has two methods that are very useful for comitting offsets manually when consuming.
rd_kafka_position
: https://github.com/edenhill/librdkafka/blob/dca8b2ee91076f2ca72f00abb4d18102a4b7e19a/src/rdkafka.h#L2035
and
rd_kafka_committed
:
https://github.com/edenhill/librdkafka/blob/dca8b2ee91076f2ca72f00abb4d18102a4b7e19a/src/rdkafka.h#L2016
That is, instead of relying on commit()
without arguments which automatically commits the fetched messages, it's possible to manually provide the offsets to be committed.
The use case is when fetched messages are consumed partially. That is, if 10 messages are fetched but only the first 5 have been processed for one reason or another, it's wanted to only commit 5 messages, hence pass custom information to commit()
.
However, currently in php-rdkafka there's no way to know such offsets, if I'm not wrong.
rd_kafka_position
is certainly the most interesting for such a use case, but given rd_kafka_committed
has a similar API, it shouldn't be hard to also expose it.