-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Cpp producer sequence id changes #763
Conversation
6e92377
to
91dceed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.. @saandrews do you also want to take a look of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestions
* <p> | ||
* The sequence id can be used for deduplication purposes and it needs to follow these rules: | ||
* <ol> | ||
* <li><code>sequenceId >= 0</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion for this - also why not use uint64_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check. Keeping int64_t
for consistency with initialSequence id which can be negative.
ProducerConfiguration& setSendTimeout(int sendTimeoutMs); | ||
int getSendTimeout() const; | ||
|
||
ProducerConfiguration& setInitialSequenceId(int64_t initialSequenceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint64_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be -1 (default value)
} | ||
|
||
ProducerConfiguration& ProducerConfiguration::setInitialSequenceId(int64_t initialSequenceId) { | ||
impl_->initialSequenceId = Optional<int64_t>::of(initialSequenceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disallow negative value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed your earlier comment. Should we allow any negative in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, initial can also be -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to someone setting it to -10 for example. Do we have to reject any value less than -1? Ot it doesn't matter for us?
Motivation
C++ and Python equivalent of the Java client library changes made in #760
Last set of changes for PIP-6 implementation.
Changes in client side to expose sequence id in the
Producer
andMessageBuilder
interfaces.This change will enable applications to take advantage of deduplication and ensure messages can be stored only-once even after the producer application crashes or get restarted.
Modifications
ProducerConfiguration
options:setProducerName()
This was already used internally by replicator. Exposed in public APIsetInitialSequenceId()
Let the application specify the initial sequence idProducer
interface:Producer.getLastSequenceId()
to return the last persisted sequence id for a producerProducer.getProducerName()
to access the auto-generated producer nameMessageBuilder.setSequenceId()
: manually specify the sequence id of a message. This may be related to some application specific property