You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "zhanglistar (via GitHub)" <gi...@apache.org> on 2026/03/04 01:41:13 UTC
[PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
zhanglistar opened a new pull request, #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543
Fixes #<xyz>
<!-- or this PR is one task of an issue -->
Master Issue: #<xyz>
### 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**
- Added `setOperationTimeoutMs(int timeoutMs)` to set client operation timeout in milliseconds (subscribe, create producer, close, unsubscribe, etc.).
- Added `getOperationTimeoutMs() const` to return the current operation timeout in milliseconds.
- Documented that calling `setOperationTimeoutMs` after `setOperationTimeoutSeconds` overrides the previous value (same internal `operationTimeout` storage).
- **lib/ClientConfiguration.cc**
- Implemented `setOperationTimeoutMs()` by assigning `std::chrono::milliseconds(timeoutMs)` to the existing `impl_->operationTimeout` (stored as `std::chrono::nanoseconds`).
- Implemented `getOperationTimeoutMs()` by casting `operationTimeout` to 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
- [ ] Make sure that the change passes the CI checks.
This change is a trivial rework / code cleanup without any test coverage.
*(Optional: existing tests that use `setOperationTimeoutSeconds` (e.g. in `ClientTest.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)
- [x] `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)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on code in PR #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543#discussion_r2881508905
##########
LegacyFindPackages.cmake:
##########
@@ -79,6 +79,10 @@ if (APPLE)
set(OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR} /usr/local/opt/openssl/ /opt/homebrew/opt/openssl)
endif ()
find_package(OpenSSL REQUIRED)
+# Ensure OPENSSL_LIBRARIES is a proper CMake list (ssl and crypto as separate entries)
Review Comment:
That's right. Though it's more recommended to enable `INTEGRATE_VCPKG` if you're building the library yourself. Currently, this option is stilled reserved only for the Windows build workflow, which installs dependencies via `vcpkg install` first, then find dependencies in legacy mode.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
Posted by "zhanglistar (via GitHub)" <gi...@apache.org>.
zhanglistar commented on code in PR #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543#discussion_r2881481117
##########
lib/CMakeLists.txt:
##########
@@ -41,6 +41,7 @@ else ()
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}"
Review Comment:
Yes, but it helps to debug which protoc used for debug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
Posted by "zhanglistar (via GitHub)" <gi...@apache.org>.
zhanglistar commented on code in PR #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543#discussion_r2881526600
##########
LegacyFindPackages.cmake:
##########
@@ -79,6 +79,10 @@ if (APPLE)
set(OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR} /usr/local/opt/openssl/ /opt/homebrew/opt/openssl)
endif ()
find_package(OpenSSL REQUIRED)
+# Ensure OPENSSL_LIBRARIES is a proper CMake list (ssl and crypto as separate entries)
Review Comment:
Yes for debug, reverted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on code in PR #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543#discussion_r2881456044
##########
lib/CMakeLists.txt:
##########
@@ -41,6 +41,7 @@ else ()
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}"
Review Comment:
This change is not necessary
##########
LegacyFindPackages.cmake:
##########
@@ -79,6 +79,10 @@ if (APPLE)
set(OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR} /usr/local/opt/openssl/ /opt/homebrew/opt/openssl)
endif ()
find_package(OpenSSL REQUIRED)
+# Ensure OPENSSL_LIBRARIES is a proper CMake list (ssl and crypto as separate entries)
Review Comment:
Changes on this file are not related, please revert them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][client-cpp] Add operation timeout configuration in milliseconds [pulsar-client-cpp]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower merged PR #543:
URL: https://github.com/apache/pulsar-client-cpp/pull/543
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org