You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2023/12/16 13:53:40 UTC
Re: [PR] [PIP-60] [Proxy-Client] Support SNI routing for Pulsar CPP client [pulsar-client-cpp]
BewareMyPower commented on code in PR #373:
URL: https://github.com/apache/pulsar-client-cpp/pull/373#discussion_r1428810554
##########
include/pulsar/ClientConfiguration.h:
##########
@@ -320,6 +324,33 @@ class PULSAR_PUBLIC ClientConfiguration {
*/
ClientConfiguration& setConnectionTimeout(int timeoutMs);
+ /**
+ * Set proxy-service url when client would like to connect to broker via proxy. Client must configure both
+ * proxyServiceUrl and appropriate proxyProtocol.
+ *
+ * Example: pulsar+ssl://ats-proxy.example.com:4443
+ *
+ * @param proxyServiceUrl proxy url to connect with broker
+ * @return
+ */
+ ClientConfiguration& setProxyServiceUrl(const std::string& proxyServiceUrl);
+
+ const std::string& getProxyServiceUrl() const;
+
+ /**
+ * Set appropriate proxy-protocol along with proxy-service url. Currently Pulsar supports SNI proxy
+ * routing.
+ *
+ * SNI routing:
+ * https://docs.trafficserver.apache.org/en/latest/admin-guide/layer-4-routing.en.html#sni-routing.
+ *
+ * @param proxyProtocol possible options (SNI)
+ * @return
+ */
+ ClientConfiguration& setProxyProtocol(const ProxyProtocol proxyProtocol);
+
+ const ProxyProtocol getProxyProtocol() const;
Review Comment:
It's better to return a non-const value type, see https://stackoverflow.com/questions/8716330/purpose-of-returning-by-const-value
##########
include/pulsar/ClientConfiguration.h:
##########
@@ -320,6 +324,33 @@ class PULSAR_PUBLIC ClientConfiguration {
*/
ClientConfiguration& setConnectionTimeout(int timeoutMs);
+ /**
+ * Set proxy-service url when client would like to connect to broker via proxy. Client must configure both
+ * proxyServiceUrl and appropriate proxyProtocol.
+ *
+ * Example: pulsar+ssl://ats-proxy.example.com:4443
+ *
+ * @param proxyServiceUrl proxy url to connect with broker
+ * @return
+ */
+ ClientConfiguration& setProxyServiceUrl(const std::string& proxyServiceUrl);
+
+ const std::string& getProxyServiceUrl() const;
+
+ /**
+ * Set appropriate proxy-protocol along with proxy-service url. Currently Pulsar supports SNI proxy
+ * routing.
+ *
+ * SNI routing:
+ * https://docs.trafficserver.apache.org/en/latest/admin-guide/layer-4-routing.en.html#sni-routing.
+ *
+ * @param proxyProtocol possible options (SNI)
+ * @return
+ */
+ ClientConfiguration& setProxyProtocol(const ProxyProtocol proxyProtocol);
Review Comment:
```suggestion
ClientConfiguration& setProxyProtocol(ProxyProtocol proxyProtocol);
```
`const` for the parameter only works in the method implementation. When providing an API for users, it's better only to use `const` for references and pointers.
--
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