Configure producer id/epoch at creation time to reuse idempotency ids from upstream systems #4029
slinkydeveloper
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I have a use case where I have my upstream system that wants to push messages to Kafka in an exactly once fashion. This upstream system has a deduplication mechanism using something like the producer id/epoch (called deduplication id), used to implement exactly once in internal messaging. The state to implement the deduplication is also durably persisted, meaning the system can recover after failures without duplicating messages. Hence my question: would it be possible to bridge our "deduplication ids" to
rd_kafka_pid_t
used internally in librdkafka idempotent producers to achieve exactly once across system restarts?I did some investigation, this is what I found:
rd_kafka_new
at some point invokesrd_kafka_idemp_init
which down the line sets the producer idempotency stateRD_KAFKA_IDEMP_STATE_REQ_PID
, requesting a new pid. Once the response is receivedrd_kafka_idemp_pid_update
is invoked and the new pid is set.rd_kafka_new
could skip altogether the pid request and simply put itself in theRD_KAFKA_IDEMP_STATE_ASSIGNED
state, setting the provided pid.Does this makes sense, or is there something I overlooked?
If it can work, would you be interested in supporting such feature? I can provide a patch for this.
Beta Was this translation helpful? Give feedback.
All reactions