[feat][client-cpp] Add operation timeout configuration in milliseconds#543
Merged
BewareMyPower merged 2 commits intoapache:mainfrom Mar 4, 2026
Merged
Conversation
| set(PULSAR_SOURCES ${PULSAR_SOURCES} ${PROTO_SOURCES}) | ||
| ADD_CUSTOM_COMMAND( | ||
| OUTPUT ${PROTO_SOURCES} | ||
| COMMAND ${CMAKE_COMMAND} -E echo "Generating PulsarApi.pb.cc/h with: ${PROTOC_PATH} -I ../proto ../proto/PulsarApi.proto --cpp_out=${LIB_AUTOGEN_DIR}" |
Contributor
There was a problem hiding this comment.
This change is not necessary
Contributor
Author
There was a problem hiding this comment.
Yes, but it helps to debug which protoc used for debug.
260a57e to
dce1b98
Compare
BewareMyPower
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #
Master Issue: #
Motivation
ClientConfiguration only exposes operation timeout in seconds via
setOperationTimeoutSeconds()/getOperationTimeoutSeconds(). Applications that need sub-second or precise millisecond timeouts (e.g. 500ms, 1500ms) have to convert manually and cannot express values that are not whole seconds. Adding a millisecond-based API allows finer control and avoids conversion in user code.Modifications
include/pulsar/ClientConfiguration.h
setOperationTimeoutMs(int timeoutMs)to set client operation timeout in milliseconds (subscribe, create producer, close, unsubscribe, etc.).getOperationTimeoutMs() constto return the current operation timeout in milliseconds.setOperationTimeoutMsaftersetOperationTimeoutSecondsoverrides the previous value (same internaloperationTimeoutstorage).lib/ClientConfiguration.cc
setOperationTimeoutMs()by assigningstd::chrono::milliseconds(timeoutMs)to the existingimpl_->operationTimeout(stored asstd::chrono::nanoseconds).getOperationTimeoutMs()by castingoperationTimeoutto milliseconds and returning the count.No new fields; all existing code that reads
operationTimeout(e.g.ClientImpl::getOperationTimeout,HandlerBase, lookup services) continues to work without change. Backward compatibility is preserved.Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
(Optional: existing tests that use
setOperationTimeoutSeconds(e.g. inClientTest.cc,ConsumerTest.cc,BasicEndToEndTest.cc) continue to pass; the new ms API uses the same internal value.)Documentation
doc-required(Your PR needs to update docs and you will update later)doc-not-needed(New API is self-documenting via existing header comments; no separate doc site change required for a single overload-style API.)
doc(Your PR contains doc changes)doc-complete(Docs have been already added)