Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idempotent Producer #200

Closed
4 tasks done
ianwsperber opened this issue Nov 8, 2018 · 4 comments
Closed
4 tasks done

Idempotent Producer #200

ianwsperber opened this issue Nov 8, 2018 · 4 comments
Assignees

Comments

@ianwsperber
Copy link
Contributor

ianwsperber commented Nov 8, 2018

Allow users to create idempotent producers. We create an idempotent producer by passing an idempotent flag during creation:

const idempotentProducer = kafka.producer({ idempotent: true });

Creating an idempotent producer is a prerequisite for the transactional producer (see related discussion in #173 )

Tasks

Spec

From KIP-98:

When idempotence is enabled, we enforce that acks=all, retries > 1, and max.inflight.requests.per.connection=1. Without these values for these configurations, we cannot guarantee idempotence. If these settings are not explicitly overidden by the application, the producer will set acks=all, retries=Integer.MAX_VALUE, and max.inflight.requests.per.connection=1 when idempotence is enabled.

@ianwsperber
Copy link
Contributor Author

@tulios Is there a configuration like the Java API's max.in.flight.requests.per.connection in place currently for KafkaJS? As far as I can tell there is not, though I haven't spent a lot of time looking through the networking or send messages code so don't want to make any assumptions. From what I can tell this would require implementing some sort of internal request queue.

@tulios
Copy link
Owner

tulios commented Nov 8, 2018

KafkaJS doesn't have maxInflight connection yet, I might start it in 1 or 2 weeks. Take a look at #148 where we had a discussion about it.

@ianwsperber
Copy link
Contributor Author

@tulios Ok cool. I don't think that's a blocker for implementing the rest of the idempotent producer, though it seems we can't strictly guarantee eos without it

ianwsperber added a commit that referenced this issue Nov 8, 2018
@ianwsperber
Copy link
Contributor Author

FYI I'm creating a "transactionManager" module for the producer, so we can easily share state around transactions. You can see how I'm planning to use it here, where I provide it to the sendMessages factory method so that it can later be used to increment the topic/partition sequence: https://github.com/tulios/kafkajs/blob/eos-200-idempotent-producer/src/producer/index.js#L27

ianwsperber added a commit that referenced this issue Nov 13, 2018
ianwsperber added a commit that referenced this issue Nov 13, 2018
tulios added a commit that referenced this issue Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants