-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,9 +48,15 @@ class ProducerConfiguration { | |
ProducerConfiguration(const ProducerConfiguration&); | ||
ProducerConfiguration& operator=(const ProducerConfiguration&); | ||
|
||
ProducerConfiguration& setProducerName(const std::string& producerName); | ||
const std::string& getProducerName() const; | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be -1 (default value) |
||
int64_t getInitialSequenceId() const; | ||
|
||
ProducerConfiguration& setCompressionType(CompressionType compressionType); | ||
CompressionType getCompressionType() const; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,25 @@ ProducerConfiguration& ProducerConfiguration::operator=(const ProducerConfigurat | |
return *this; | ||
} | ||
|
||
ProducerConfiguration& ProducerConfiguration::setProducerName(const std::string& producerName) { | ||
impl_->producerName = Optional<std::string>::of(producerName); | ||
return *this; | ||
} | ||
|
||
const std::string& ProducerConfiguration::getProducerName() const { | ||
static const std::string emptyString; | ||
return impl_->producerName.is_present() ? impl_->producerName.value() : emptyString; | ||
} | ||
|
||
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 commentThe 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 commentThe 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 commentThe 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 commentThe 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? |
||
return *this; | ||
} | ||
|
||
int64_t ProducerConfiguration::getInitialSequenceId() const { | ||
return impl_->initialSequenceId.is_present() ? impl_->initialSequenceId.value() : -1ll; | ||
} | ||
|
||
ProducerConfiguration& ProducerConfiguration::setSendTimeout(int sendTimeoutMs) { | ||
impl_->sendTimeoutMs = sendTimeoutMs; | ||
return *this; | ||
|
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.