Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,571 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef PULSAR_AUTHENTICATION_H_ +#define PULSAR_AUTHENTICATION_H_ + +#include <pulsar/Result.h> +#include <pulsar/defines.h> + +#include <functional> +#include <map> +#include <memory> +#include <string> +#include <vector> + +namespace pulsar { + +class ClientConfiguration; +class Authentication; + +class PULSAR_PUBLIC AuthenticationDataProvider { + public: + virtual ~AuthenticationDataProvider(); + + /** + * @return true if the authentication data contains data for TLS + */ + virtual bool hasDataForTls(); + + /** + * @return a client certificate chain or ânoneâ if the data is not available + */ + virtual std::string getTlsCertificates(); + + /** + * @return a private key for the client certificate or ânoneâ if the data is not available + */ + virtual std::string getTlsPrivateKey(); + + /** + * @return true if this authentication data contains data for HTTP + */ + virtual bool hasDataForHttp(); + + /** + * @return an authentication scheme or ânoneâ if the request is not authenticated + */ + virtual std::string getHttpAuthType(); + + /** + * @return the string of HTTP header or ânoneâ if the request is not authenticated + */ + virtual std::string getHttpHeaders(); + + /** + * @return true if authentication data contains data from Pulsar protocol + */ + virtual bool hasDataFromCommand(); + + /** + * @return authentication data which is stored in a command + */ + virtual std::string getCommandData(); + + protected: + AuthenticationDataProvider(); +}; + +typedef std::shared_ptr<AuthenticationDataProvider> AuthenticationDataPtr; +typedef std::shared_ptr<Authentication> AuthenticationPtr; +typedef std::map<std::string, std::string> ParamMap; + +class PULSAR_PUBLIC Authentication { + public: + virtual ~Authentication(); + + /** + * @return the authentication method name supported by this provider + */ + virtual const std::string getAuthMethodName() const = 0; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataContent the shared pointer of AuthenticationData. The content of AuthenticationData + * is changed to the internal data of the current instance. + * @return ResultOk or ResultAuthenticationError if authentication failed + */ + virtual Result getAuthData(AuthenticationDataPtr& authDataContent) { + authDataContent = authData_; + return ResultOk; + } + + /** + * Parse the authentication parameter string to a map whose key and value are both strings + * + * The parameter string can have multiple lines. The format of each line is a comma-separated âkey:valueâ + * string. + * + * For example, âk1:v1,k2:v2â is parsed to two key-value pairs `(k1, v1)` and `(k2, v2)`. + * + * @param authParamsString the authentication parameter string to be parsed + * @return the parsed map whose key and value are both strings + */ + static ParamMap parseDefaultFormatAuthParams(const std::string& authParamsString); + + protected: + Authentication(); + AuthenticationDataPtr authData_; + friend class ClientConfiguration; +}; + +/** + * AuthFactory is used to create instances of Authentication class when + * configuring a Client instance. It loads the authentication from an + * external plugin. + * + * To use authentication methods that are internally supported, you should + * use `AuthTls::create("my-cert.pem", "my-private.key")` or similar. + */ +class PULSAR_PUBLIC AuthFactory { + public: + static AuthenticationPtr Disabled(); + + /** + * Create an AuthenticationPtr with an empty ParamMap + * + * @see create(const std::string&, const ParamMap&) + */ + static AuthenticationPtr create(const std::string& pluginNameOrDynamicLibPath); + + /** + * Create an AuthenticationPtr with a ParamMap that is converted from authParamsString + * + * @see Authentication::parseDefaultFormatAuthParams + * @see create(const std::string&, const ParamMap&) + */ + static AuthenticationPtr create(const std::string& pluginNameOrDynamicLibPath, + const std::string& authParamsString); + + /** + * Create an AuthenticationPtr + * + * When the first parameter represents the plugin name, the type of authentication can be one of the + * following: + * - AuthTls (if the plugin name is âtlsâ) + * - AuthToken (if the plugin name is âtokenâ or âorg.apache.pulsar.client.impl.auth.AuthenticationTokenâ) + * - AuthAthenz (if the plugin name is âathenzâ or + * âorg.apache.pulsar.client.impl.auth.AuthenticationAthenzâ) + * - AuthOauth2 (if the plugin name is âoauth2tokenâ or + * âorg.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2â) + * + * @param pluginNameOrDynamicLibPath the plugin name or the path or a dynamic library that contains the + * implementation of Authentication + * @param params the ParamMap that is passed to Authentication::create method + */ + static AuthenticationPtr create(const std::string& pluginNameOrDynamicLibPath, ParamMap& params); + + protected: + static bool isShutdownHookRegistered_; + static std::vector<void*> loadedLibrariesHandles_; + static void release_handles(); +}; + +/** + * TLS implementation of Pulsar client authentication + */ +class PULSAR_PUBLIC AuthTls : public Authentication { + public: + AuthTls(AuthenticationDataPtr&); + ~AuthTls(); + + /** + * Create an AuthTls with a ParamMap + * + * It is equal to create(params[âtlsCertFileâ], params[âtlsKeyFileâ]) + * @see create(const std::string&, const std::string&) + */ + static AuthenticationPtr create(ParamMap& params); + + /** + * Create an AuthTls with an authentication parameter string + * + * @see Authentication::parseDefaultFormatAuthParams + */ + static AuthenticationPtr create(const std::string& authParamsString); + + /** + * Create an AuthTls with the required parameters + * + * @param certificatePath the file path for a client certificate + * @param privateKeyPath the file path for a client private key + */ + static AuthenticationPtr create(const std::string& certificatePath, const std::string& privateKeyPath); + + /** + * @return âtlsâ + */ + const std::string getAuthMethodName() const; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataTls the shared pointer of AuthenticationData. The content of AuthenticationData is + * changed to the internal data of the current instance. + * @return ResultOk + */ + Result getAuthData(AuthenticationDataPtr& authDataTls); + + private: + AuthenticationDataPtr authDataTls_; +}; + +typedef std::function<std::string()> TokenSupplier; + +/** + * Token based implementation of Pulsar client authentication + */ +class PULSAR_PUBLIC AuthToken : public Authentication { + public: + AuthToken(AuthenticationDataPtr&); + ~AuthToken(); + + /** + * Create an AuthToken with a ParamMap + * + * @param parameters it must contain a key-value, where key means how to get the token and value means the + * token source + * + * If the key is âtokenâ, the value is the token + * + * If the key is âfileâ, the value is the file that contains the token + * + * If the key is âenvâ, the value is the environment variable whose value is the token + * + * Otherwise, a `std::runtime_error` error is thrown. + * @see create(const std::string& authParamsString) + */ + static AuthenticationPtr create(ParamMap& params); + + /** + * Create an AuthToken with an authentication parameter string + * + * @see Authentication::parseDefaultFormatAuthParams + */ + static AuthenticationPtr create(const std::string& authParamsString); + + /** + * Create an authentication provider for token based authentication + * + * @param token + * a string containing the auth token + */ + static AuthenticationPtr createWithToken(const std::string& token); + + /** + * Create an authentication provider for token based authentication + * + * @param tokenSupplier + * a supplier of the client auth token + */ + static AuthenticationPtr create(const TokenSupplier& tokenSupplier); + + /** + * @return âtokenâ + */ + const std::string getAuthMethodName() const; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataToken the shared pointer of AuthenticationData. The content of AuthenticationData + * is changed to the internal data of the current instance. + * @return ResultOk + */ + Result getAuthData(AuthenticationDataPtr& authDataToken); + + private: + AuthenticationDataPtr authDataToken_; +}; + +/** + * Basic based implementation of Pulsar client authentication + */ +class PULSAR_PUBLIC AuthBasic : public Authentication { + public: + explicit AuthBasic(AuthenticationDataPtr&); + ~AuthBasic() override; + + /** + * Create an AuthBasic with a ParamMap + * + * It is equal to create(params[âusernameâ], params[âpasswordâ]) + * @see create(const std::string&, const std::string&) + */ + static AuthenticationPtr create(ParamMap& params); + + /** + * Create an AuthBasic with an authentication parameter string + * + * @param authParamsString the JSON format string: {"username": "admin", "password": "123456"} + */ + static AuthenticationPtr create(const std::string& authParamsString); + + /** + * Create an AuthBasic with the required parameters + */ + static AuthenticationPtr create(const std::string& username, const std::string& password); + + /** + * Create an AuthBasic with the required parameters + */ + static AuthenticationPtr create(const std::string& username, const std::string& password, + const std::string& method); + + /** + * @return âbasicâ + */ + const std::string getAuthMethodName() const override; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataBasic the shared pointer of AuthenticationData. The content of AuthenticationData + * is changed to the internal data of the current instance. + * @return ResultOk + */ + Result getAuthData(AuthenticationDataPtr& authDataBasic) override; + + private: + AuthenticationDataPtr authDataBasic_; +}; + +/** + * Athenz implementation of Pulsar client authentication + */ +class PULSAR_PUBLIC AuthAthenz : public Authentication { + public: + AuthAthenz(AuthenticationDataPtr&); + ~AuthAthenz(); + + /** + * Create an AuthAthenz with a ParamMap + * + * The required parameter keys are âtenantDomainâ, âtenantServiceâ, âproviderDomainâ, âprivateKeyâ, and + * âztsUrlâ + * + * @param params the key-value to construct ZTS client + * @see http://pulsar.apache.org/docs/en/security-athenz/ + */ + static AuthenticationPtr create(ParamMap& params); + + /** + * Create an AuthAthenz with an authentication parameter string + * + * @see Authentication::parseDefaultFormatAuthParams + */ + static AuthenticationPtr create(const std::string& authParamsString); + + /** + * @return âathenzâ + */ + const std::string getAuthMethodName() const; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataAthenz the shared pointer of AuthenticationData. The content of AuthenticationData + * is changed to the internal data of the current instance. + * @return ResultOk + */ + Result getAuthData(AuthenticationDataPtr& authDataAthenz); + + private: + AuthenticationDataPtr authDataAthenz_; +}; + +// OAuth 2.0 token and associated information. +// currently mainly works for access token +class Oauth2TokenResult { + public: + enum + { + undefined_expiration = -1 + }; + + Oauth2TokenResult(); + ~Oauth2TokenResult(); + + /** + * Set the access token string + * + * @param accessToken the access token string + */ + Oauth2TokenResult& setAccessToken(const std::string& accessToken); + + /** + * Set the ID token + * + * @param idToken the ID token + */ + Oauth2TokenResult& setIdToken(const std::string& idToken); + + /** + * Set the refresh token which can be used to obtain new access tokens using the same authorization grant + * or null for none + * + * @param refreshToken the refresh token + */ + Oauth2TokenResult& setRefreshToken(const std::string& refreshToken); + + /** + * Set the token lifetime + * + * @param expiresIn the token lifetime + */ + Oauth2TokenResult& setExpiresIn(const int64_t expiresIn); + + /** + * @return the access token string + */ + const std::string& getAccessToken() const; + + /** + * @return the ID token + */ + const std::string& getIdToken() const; + + /** + * @return the refresh token which can be used to obtain new access tokens using the same authorization + * grant or null for none + */ + const std::string& getRefreshToken() const; + + /** + * @return the token lifetime in milliseconds + */ + int64_t getExpiresIn() const; + + private: + // map to json "access_token" + std::string accessToken_; + // map to json "id_token" + std::string idToken_; + // map to json "refresh_token" + std::string refreshToken_; + // map to json "expires_in" + int64_t expiresIn_; +}; + +typedef std::shared_ptr<Oauth2TokenResult> Oauth2TokenResultPtr; + +class Oauth2Flow { + public: + virtual ~Oauth2Flow(); + + /** + * Initializes the authorization flow. + */ + virtual void initialize() = 0; + + /** + * Acquires an access token from the OAuth 2.0 authorization server. + * @return a token result including an access token. + */ + virtual Oauth2TokenResultPtr authenticate() = 0; + + /** + * Closes the authorization flow. + */ + virtual void close() = 0; + + protected: + Oauth2Flow(); +}; + +typedef std::shared_ptr<Oauth2Flow> FlowPtr; + +class CachedToken { + public: + virtual ~CachedToken(); + + /** + * @return true if the token has expired + */ + virtual bool isExpired() = 0; + + /** + * Get AuthenticationData from the current instance + * + * @return ResultOk or ResultAuthenticationError if authentication failed + */ + virtual AuthenticationDataPtr getAuthData() = 0; + + protected: + CachedToken(); +}; + +typedef std::shared_ptr<CachedToken> CachedTokenPtr; + +/** + * Oauth2 based implementation of Pulsar client authentication. + * Passed in parameter would be like: + * ``` + * "type": "client_credentials", + * "issuer_url": "https://accounts.google.com", + * "client_id": "d9ZyX97q1ef8Cr81WHVC4hFQ64vSlDK3", + * "client_secret": "on1uJ...k6F6R", + * "audience": "https://broker.example.com" + * ``` + * If passed in as std::string, it should be in Json format. + */ +class PULSAR_PUBLIC AuthOauth2 : public Authentication { + public: + AuthOauth2(ParamMap& params); + ~AuthOauth2(); + + /** + * Create an AuthOauth2 with a ParamMap + * + * The required parameter keys are âissuer_urlâ, âprivate_keyâ, and âaudienceâ + * + * @param parameters the key-value to create OAuth 2.0 client credentials + * @see http://pulsar.apache.org/docs/en/security-oauth2/#client-credentials + */ + static AuthenticationPtr create(ParamMap& params); + + /** + * Create an AuthOauth2 with an authentication parameter string + * + * @see Authentication::parseDefaultFormatAuthParams + */ + static AuthenticationPtr create(const std::string& authParamsString); + + /** + * @return âtokenâ + */ + const std::string getAuthMethodName() const; + + /** + * Get AuthenticationData from the current instance + * + * @param[out] authDataOauth2 the shared pointer of AuthenticationData. The content of AuthenticationData + * is changed to the internal data of the current instance. + * @return ResultOk or ResultAuthenticationError if authentication failed + */ + Result getAuthData(AuthenticationDataPtr& authDataOauth2); + + private: + FlowPtr flowPtr_; + CachedTokenPtr cachedTokenPtr_; +}; + +} // namespace pulsar + +#endif /* PULSAR_AUTHENTICATION_H_ */
Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZsACgkQT0AbyNP5 ++1VmIQ/8C1gyUf9cs8MTZgoRUneC46KpVa52a3Rn0rNVK1t4M2YwUnKRknyIM3A8 +/GfNTqt9oArw2rp834+9WT3j9tAqE/JVd3cvXjz+eAhQGNRI8Sz8qgXCN7roR+nV +3fJLH0DkmqJrxKmkgQMRuLKJ04ck3u5XIvrTMD8oDerq4O9qCLkYabXIqG34E+8t +8v1n9sNSTi99l6MS8YL/ztCHZRxroZ4aX1dNL3BvJ8tmzTUyi2aqT7SmN0tr2hQG +2kVWHs/Jwx4ks+gx+55PzZ/5TMvdYc22/RUnk4z3SzNx50wfHV4Vr6v1UeoR2+e6 +z7+hLngqcrv9rsiqoUW6z9FYlYbuJFXf4/brzLP97tAB1m6aKlxu5KBadZE0Wyux +8ycsiThvH+lQwvqREC6gBWGr3uwLTan1j2LKEnhkLx+MZ1NImFS+NFddPEYRoSCc +6PzzF72tf7RxZwO02ZcaguHvNglJg7TkSDg01hZxJPelzXd2oIHv348d/9J9K7oQ +ZwTGgrX2LogOCuseaqWrID+hBE3uBc/4HC68oIVuajMq54f9FBq2V3f0y/ZZImrl +HOjIPGjYzNs1k0FUYVqKtoFjJpOhqR7zC9Qy03b5jrAfS7KxjBs+PmbknGs36z5Z +tsMQxnu8CvzEgEpokx5OQdhJGmwyzxXj3XGIbmPPh9Dk26ffJEU= +=xZUy +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Authentication.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +bcab25147d95dec8d5071739e7d0c02424056d1fa9c2431be00f575f19b3d27e234a2bb2d9c6efd9f8775284f9dc2c7c66571d2ba0db45e4ac45fb4152fbf49a ./x64-windows-static/include/pulsar/Authentication.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,91 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef BATCH_RECEIVE_POLICY_HPP_ +#define BATCH_RECEIVE_POLICY_HPP_ + +#include <pulsar/defines.h> + +#include <memory> + +namespace pulsar { + +struct BatchReceivePolicyImpl; + +/** + * Configuration for message batch receive {@link Consumer#batchReceive()} {@link + * Consumer#batchReceiveAsync()}. + * + * <p>Batch receive policy can limit the number and bytes of messages in a single batch, and can specify a + * timeout for waiting for enough messages for this batch. + * + * <p>A batch receive action is completed as long as any one of the + * conditions (the batch has enough number or size of messages, or the waiting timeout is passed) are met. + * + * <p>Examples: + * 1.If set maxNumMessages = 10, maxSizeOfMessages = 1MB and without timeout, it + * means {@link Consumer#batchReceive()} will always wait until there is enough messages. + * 2.If set maxNumberOfMessages = 0, maxNumBytes = 0 and timeout = 100ms, it + * means {@link Consumer#batchReceive()} will wait for 100ms no matter whether there are enough messages. + * + * <p>Note: + * Must specify messages limitation(maxNumMessages, maxNumBytes) or wait timeout. + * Otherwise, {@link Messages} ingest {@link Message} will never end. + * + * @since 2.4.1 + */ +class PULSAR_PUBLIC BatchReceivePolicy { + public: + /** + * Default value: {maxNumMessage: -1, maxNumBytes: 10 * 1024 * 1024, timeoutMs: 100} + */ + BatchReceivePolicy(); + + /** + * + * @param maxNumMessage Max num message, if less than 0, it means no limit. + * @param maxNumBytes Max num bytes, if less than 0, it means no limit. + * @param timeoutMs If less than 0, it means no limit. + */ + BatchReceivePolicy(int maxNumMessage, long maxNumBytes, long timeoutMs); + + /** + * Get max time out ms. + * + * @return + */ + long getTimeoutMs() const; + + /** + * Get the maximum number of messages. + * @return + */ + int getMaxNumMessages() const; + + /** + * Get max num bytes. + * @return + */ + long getMaxNumBytes() const; + + private: + std::shared_ptr<BatchReceivePolicyImpl> impl_; +}; +} // namespace pulsar + +#endif /* BATCH_RECEIVE_POLICY_HPP_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZcACgkQT0AbyNP5 ++1UWoBAAnGckwgsRPCkeMr+z7x97TrsaQBgZQhF1fsZDQCj9cdUtDDJkDXQqu0Tz +s0N1fyEts3CPmIC0b0gTlraGK8Hz5ERP5sR4lBlcR1lujz6MDYBhIXYmFqTZcxdL +/7K6wWDlSSLVItDaCNWgp8TOK8HicXwQL+XH7Q82g1kZyyoaUE3wzY9uu+FA/11S +aCmFI2zBTs0a/EWHM6w+sRRiK+u5b8qSfTs/AFdl6E5qL0GAJmDctPI8sm1zXsUQ +MdzHD6W1sqsYbOcgbVxSBPCPE6n2zg+ucYxQ6xCIbvhHS/boP1rqfiZ/TN70PvwT +9JxsGbic7yesns4AgM0+YF1Y+PSd3pT5avw5VYTQgEsyT1tapB//f8HmBbfk7DLy +URkv91wX4QksXL5mrA7cD0RYBDqOFNMLpI4MUsjDSCO3LIfexaABxzMPpth+eo2G +gld9nnPUO5Wc28egGPAMrZ3Cz0sZSVUaYOPCck9U0iuiDqBR1c4KQ2ZEDCLi6BsZ +xKvY0KqlKTOb+1zmNJ51cTewbprxTPc+O8kMyhz3XOd1v1Hd4qvkxeuYtyJfBKZ6 +D277osXYsvA2sUFELOO2T6FaGKkOzRK82snhnMfX79MiioRnJHyvE570gHN5XFhi +X4st5UIWEOfFFksKCZR1wv0BbzbzlQiGQkbtAKy3x5l7P0M07x4= +=sCgv +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BatchReceivePolicy.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +56c71d814cb3526d751964c61f5cfec211a74f243be6eed4c6345dc13b61f0bff79dad48e7a81aff65713a982508c70844fca0546b56e3816894df40025c9c48 ./x64-windows-static/include/pulsar/BatchReceivePolicy.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,94 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef PULSAR_CPP_BROKERCONSUMERSTATS_H +#define PULSAR_CPP_BROKERCONSUMERSTATS_H + +#include <pulsar/ConsumerType.h> +#include <pulsar/Result.h> +#include <pulsar/defines.h> + +#include <functional> +#include <iostream> +#include <memory> + +namespace pulsar { +class BrokerConsumerStatsImplBase; +class PulsarWrapper; + +/* @note: isValid() or getXXX() methods are not allowed on an invalid BrokerConsumerStats */ +class PULSAR_PUBLIC BrokerConsumerStats { + private: + std::shared_ptr<BrokerConsumerStatsImplBase> impl_; + + public: + BrokerConsumerStats() = default; + explicit BrokerConsumerStats(std::shared_ptr<BrokerConsumerStatsImplBase> impl); + + virtual ~BrokerConsumerStats() = default; + + /** Returns true if the Stats are still valid **/ + virtual bool isValid() const; + + /** Returns the rate of messages delivered to the consumer. msg/s */ + virtual double getMsgRateOut() const; + + /** Returns the throughput delivered to the consumer. bytes/s */ + virtual double getMsgThroughputOut() const; + + /** Returns the rate of messages redelivered by this consumer. msg/s */ + virtual double getMsgRateRedeliver() const; + + /** Returns the Name of the consumer */ + virtual const std::string getConsumerName() const; + + /** Returns the Number of available message permits for the consumer */ + virtual uint64_t getAvailablePermits() const; + + /** Returns the Number of unacknowledged messages for the consumer */ + virtual uint64_t getUnackedMessages() const; + + /** Returns true if the consumer is blocked due to unacked messages. */ + virtual bool isBlockedConsumerOnUnackedMsgs() const; + + /** Returns the Address of this consumer */ + virtual const std::string getAddress() const; + + /** Returns the Timestamp of connection */ + virtual const std::string getConnectedSince() const; + + /** Returns Whether this subscription is Exclusive or Shared or Failover */ + virtual const ConsumerType getType() const; + + /** Returns the rate of messages expired on this subscription. msg/s */ + virtual double getMsgRateExpired() const; + + /** Returns the Number of messages in the subscription backlog */ + virtual uint64_t getMsgBacklog() const; + + /** @deprecated */ + std::shared_ptr<BrokerConsumerStatsImplBase> getImpl() const; + + friend class PulsarWrapper; + friend PULSAR_PUBLIC std::ostream &operator<<(std::ostream &os, const BrokerConsumerStats &obj); +}; +typedef std::function<void(Result result, BrokerConsumerStats brokerConsumerStats)> + BrokerConsumerStatsCallback; +} // namespace pulsar + +#endif // PULSAR_CPP_BROKERCONSUMERSTATS_H Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZcACgkQT0AbyNP5 ++1VcihAAgL9mVWsVzD+Gk3vAWD2xzHBAsvePGwOmRSelhSWIrjQG/knsHKHTRQnu +WV7cXS74DjMbFkK7v2sg8DsgHsXIYZA8sNPGMr3o58bUgxpkbsGoNCGdhti9o/WJ +psTsHx9eeg9pIIASKPAVsZFrFVZkxaEYSxrnpgQNQGOq0wX3hU/q9UV8aEDAcUAi +ivi1gDR4YpEgmeM4q7lJd0tAfuNgc0D5tprR+6xQ/29nW5g8wT0lg7rVtMAekk6C +wMHWgKfIjn/bKd7j5gGTOrzPLzlP3qLIoeXHHeNwvVcDwFyDCdEu5RafmrDYwEKR +O/c20Lm7Pr7wuIq/1e9i5eK8cCJEzMdnWQZg9zHA44SuIVXar930oVI4XswRotF6 +K57Loa34qHgrvI6DDC1sphDqXgMY0114ywPWQUf+tbUzEZWyz6u/QXWRqh2W4EBo +03v6FjLnDSWT6oGnSQ0IrZRqA6BaIwayPqq+0tMKqGZNf8oBWNskRJX1Be0qijuN +cCxJf2STs4GT00ZpidifHBdNFcfwpOYQ/pnC9pwiOSHhchOnoxcnyP7rWfY94P2B +M1IRvliNLxzg+D3yrBJ1D68Q49+gnuhozNIK2kN5BVI2svep1+/wEIlizoUbn4dE +kTrJKnXpYiXuC6H90zs9TOSjI2GWoTTeNuYOZkXB9zrJnLd3dhY= +=bGdC +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/BrokerConsumerStats.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +5eb73f1f378c906e65908562efc7eafa7a171d5f145c225b7566c68f85cf9bb02238f8652a7e2d9464090c98c4357dd18171191818f5f0d516ef83c2617ef5a3 ./x64-windows-static/include/pulsar/BrokerConsumerStats.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,386 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef PULSAR_CLIENT_HPP_ +#define PULSAR_CLIENT_HPP_ + +#include <pulsar/ClientConfiguration.h> +#include <pulsar/ConsoleLoggerFactory.h> +#include <pulsar/Consumer.h> +#include <pulsar/FileLoggerFactory.h> +#include <pulsar/Message.h> +#include <pulsar/MessageBuilder.h> +#include <pulsar/Producer.h> +#include <pulsar/Reader.h> +#include <pulsar/Result.h> +#include <pulsar/Schema.h> +#include <pulsar/defines.h> + +#include <string> + +namespace pulsar { +typedef std::function<void(Result, Producer)> CreateProducerCallback; +typedef std::function<void(Result, Consumer)> SubscribeCallback; +typedef std::function<void(Result, Reader)> ReaderCallback; +typedef std::function<void(Result, const std::vector<std::string>&)> GetPartitionsCallback; +typedef std::function<void(Result)> CloseCallback; + +class ClientImpl; +class PulsarFriend; +class PulsarWrapper; + +class PULSAR_PUBLIC Client { + public: + /** + * Create a Pulsar client object connecting to the specified cluster address and using the default + * configuration. + * + * @param serviceUrl the Pulsar endpoint to use (eg: pulsar://localhost:6650) + * @throw std::invalid_argument if `serviceUrl` is invalid + */ + Client(const std::string& serviceUrl); + + /** + * Create a Pulsar client object connecting to the specified cluster address and using the specified + * configuration. + * + * @param serviceUrl the Pulsar endpoint to use (eg: + * http://brokerv2-pdev.messaging.corp.gq1.yahoo.com:4080 for Sandbox access) + * @param clientConfiguration the client configuration to use + * @throw std::invalid_argument if `serviceUrl` is invalid + */ + Client(const std::string& serviceUrl, const ClientConfiguration& clientConfiguration); + + /** + * Create a producer with default configuration + * + * @see createProducer(const std::string&, const ProducerConfiguration&, Producer&) + * + * @param topic the topic where the new producer will publish + * @param producer a non-const reference where the new producer will be copied + * @return ResultOk if the producer has been successfully created + * @return ResultError if there was an error + */ + Result createProducer(const std::string& topic, Producer& producer); + + /** + * Create a producer with specified configuration + * + * @see createProducer(const std::string&, const ProducerConfiguration&, Producer&) + * + * @param topic the topic where the new producer will publish + * @param conf the producer config to use + * @param producer a non-const reference where the new producer will be copied + * @return ResultOk if the producer has been successfully created + * @return ResultError if there was an error + */ + Result createProducer(const std::string& topic, const ProducerConfiguration& conf, Producer& producer); + + /** + * Asynchronously create a producer with the default ProducerConfiguration for publishing on a specific + * topic + * + * @param topic the name of the topic where to produce + * @param callback the callback that is triggered when the producer is created successfully or not + * @param callback Callback function that is invoked when the operation is completed + */ + void createProducerAsync(const std::string& topic, CreateProducerCallback callback); + + /** + * Asynchronously create a producer with the customized ProducerConfiguration for publishing on a specific + * topic + * + * @param topic the name of the topic where to produce + * @param conf the customized ProducerConfiguration + */ + void createProducerAsync(const std::string& topic, ProducerConfiguration conf, + CreateProducerCallback callback); + + /** + * Subscribe to a given topic and subscription combination with the default ConsumerConfiguration + * + * @param topic the topic name + * @param subscriptionName the subscription name + * @param[out] consumer the consumer instance to be returned + * @return ResultOk if it subscribes to the topic successfully + */ + Result subscribe(const std::string& topic, const std::string& subscriptionName, Consumer& consumer); + + /** + * Subscribe to a given topic and subscription combination with the customized ConsumerConfiguration + * + * @param topic the topic name + * @param subscriptionName the subscription name + * @param[out] consumer the consumer instance to be returned + * @return ResultOk if it subscribes to the topic successfully + */ + Result subscribe(const std::string& topic, const std::string& subscriptionName, + const ConsumerConfiguration& conf, Consumer& consumer); + + /** + * Asynchronously subscribe to a given topic and subscription combination with the default + * ConsumerConfiguration + * + * @param topic the topic name + * @param subscriptionName the subscription name + * @param callback the callback that is triggered when a given topic and subscription combination with the + * default ConsumerConfiguration are asynchronously subscribed successfully or not + */ + void subscribeAsync(const std::string& topic, const std::string& subscriptionName, + SubscribeCallback callback); + + /** + * Asynchronously subscribe to a given topic and subscription combination with the customized + * ConsumerConfiguration + * + * @param topic the topic name + * @param subscriptionName the subscription name + * @param conf the customized ConsumerConfiguration + * @param callback the callback that is triggered when a given topic and subscription combination with the + * customized ConsumerConfiguration are asynchronously subscribed successfully or not + */ + void subscribeAsync(const std::string& topic, const std::string& subscriptionName, + const ConsumerConfiguration& conf, SubscribeCallback callback); + + /** + * Subscribe to multiple topics under the same namespace. + * + * @param topics a list of topic names to subscribe to + * @param subscriptionName the subscription name + * @param[out] consumer the consumer instance to be returned + */ + Result subscribe(const std::vector<std::string>& topics, const std::string& subscriptionName, + Consumer& consumer); + + /** + * Subscribe to multiple topics with the customized ConsumerConfiguration under the same namespace + * + * @param topics a list of topic names to subscribe to + * @param subscriptionName the subscription name + * @param conf the customized ConsumerConfiguration + * @param[out] consumer the consumer instance to be returned + */ + Result subscribe(const std::vector<std::string>& topics, const std::string& subscriptionName, + const ConsumerConfiguration& conf, Consumer& consumer); + + /** + * Asynchronously subscribe to a list of topics and subscription combination using the default + ConsumerConfiguration + * + * @param topics the topic list + * @param subscriptionName the subscription name + * @param callback the callback that is triggered when a list of topics and subscription combination using + the default ConsumerConfiguration are asynchronously subscribed successfully or not + + */ + void subscribeAsync(const std::vector<std::string>& topics, const std::string& subscriptionName, + SubscribeCallback callback); + + /** + * Asynchronously subscribe to a list of topics and subscription combination using the customized + * ConsumerConfiguration + * + * @param topics the topic list + * @param subscriptionName the subscription name + * @param conf the customized ConsumerConfiguration + * @param callback the callback that is triggered when a list of topics and subscription combination using + * the customized ConsumerConfiguration are asynchronously subscribed successfully or not + */ + void subscribeAsync(const std::vector<std::string>& topics, const std::string& subscriptionName, + const ConsumerConfiguration& conf, SubscribeCallback callback); + + /** + * Subscribe to multiple topics, which match given regexPattern, under the same namespace. + */ + Result subscribeWithRegex(const std::string& regexPattern, const std::string& subscriptionName, + Consumer& consumer); + + /** + * Subscribe to multiple topics (which match given regexPatterns) with the customized + * ConsumerConfiguration under the same namespace + */ + Result subscribeWithRegex(const std::string& regexPattern, const std::string& subscriptionName, + const ConsumerConfiguration& conf, Consumer& consumer); + + /** + * Asynchronously subscribe to multiple topics (which match given regexPatterns) with the default + * ConsumerConfiguration under the same namespace + * + * @see subscribeWithRegexAsync(const std::string&, const std::string&, const ConsumerConfiguration&, + * SubscribeCallback) + */ + void subscribeWithRegexAsync(const std::string& regexPattern, const std::string& subscriptionName, + SubscribeCallback callback); + + /** + * Asynchronously subscribe to multiple topics (which match given regexPatterns) with the customized + * ConsumerConfiguration under the same namespace + * + * @param regexPattern the regular expression for topics pattern + * @param subscriptionName the subscription name + * @param conf the ConsumerConfiguration + * @param callback the callback that is triggered when multiple topics with the customized + * ConsumerConfiguration under the same namespace are asynchronously subscribed successfully or not + */ + void subscribeWithRegexAsync(const std::string& regexPattern, const std::string& subscriptionName, + const ConsumerConfiguration& conf, SubscribeCallback callback); + + /** + * Create a topic reader with given {@code ReaderConfiguration} for reading messages from the specified + * topic. + * <p> + * The Reader provides a low-level abstraction that allows for manual positioning in the topic, without + * using a + * subscription. Reader can only work on non-partitioned topics. + * <p> + * The initial reader positioning is done by specifying a message id. The options are: + * <ul> + * <li><code>MessageId.earliest</code> : Start reading from the earliest message available in the topic + * <li><code>MessageId.latest</code> : Start reading from the end topic, only getting messages published + * after the + * reader was created + * <li><code>MessageId</code> : When passing a particular message id, the reader will position itself on + * that + * specific position. The first message to be read will be the message next to the specified messageId. + * </ul> + * + * @param topic + * The name of the topic where to read + * @param startMessageId + * The message id where the reader will position itself. The first message returned will be the + * one after + * the specified startMessageId + * @param conf + * The {@code ReaderConfiguration} object + * @return The {@code Reader} object + */ + Result createReader(const std::string& topic, const MessageId& startMessageId, + const ReaderConfiguration& conf, Reader& reader); + + /** + * Asynchronously create a topic reader with the customized ReaderConfiguration for reading messages from + * the specified topic. + * + * The Reader provides a low-level abstraction that allows for manual positioning in the topic, without + * using a + * subscription. The reader can only work on non-partitioned topics. + * + * The initial reader positioning is done by specifying a message ID. The options are as below: + * <ul> + * <li><code>MessageId.earliest</code> : start reading from the earliest message available in the topic + * <li><code>MessageId.latest</code> : start reading from the latest topic, only getting messages + * published after the reader was created <li><code>MessageId</code> : when passing a particular message + * ID, the reader positions itself on that is the message next to the specified messageId. + * </ul> + * + * @param topic + * the name of the topic where to read + * @param startMessageId + * the message ID where the reader positions itself. The first message returned is the + * one after + * the specified startMessageId + * @param conf + * the ReaderConfiguration object + * @return the Reader object + */ + void createReaderAsync(const std::string& topic, const MessageId& startMessageId, + const ReaderConfiguration& conf, ReaderCallback callback); + + /** + * Get the list of partitions for a given topic. + * + * If the topic is partitioned, this will return a list of partition names. If the topic is not + * partitioned, the returned list will contain the topic name itself. + * + * This can be used to discover the partitions and create Reader, Consumer or Producer + * instances directly on a particular partition. + * + * @param topic + * the topic name + * @since 2.3.0 + */ + Result getPartitionsForTopic(const std::string& topic, std::vector<std::string>& partitions); + + /** + * Get the list of partitions for a given topic in asynchronous mode. + * + * If the topic is partitioned, this will return a list of partition names. If the topic is not + * partitioned, the returned list will contain the topic name itself. + * + * This can be used to discover the partitions and create Reader, Consumer or Producer + * instances directly on a particular partition. + * + * @param topic + * the topic name + * @param callback + * the callback that will be invoked when the list of partitions is available + * @since 2.3.0 + */ + void getPartitionsForTopicAsync(const std::string& topic, GetPartitionsCallback callback); + + /** + * + * @return + */ + Result close(); + + /** + * Asynchronously close the Pulsar client and release all resources. + * + * All producers, consumers, and readers are orderly closed. The client waits until all pending write + * requests are persisted. + * + * @param callback the callback that is triggered when the Pulsar client is asynchronously closed + * successfully or not + */ + void closeAsync(CloseCallback callback); + + /** + * Perform immediate shutdown of Pulsar client. + * + * Release all resources and close all producer, consumer, and readers without waiting + * for ongoing operations to complete. + */ + void shutdown(); + + /** + * @brief Get the number of alive producers on the current client. + * + * @return The number of alive producers on the current client. + */ + uint64_t getNumberOfProducers(); + + /** + * @brief Get the number of alive consumers on the current client. + * + * @return The number of alive consumers on the current client. + */ + uint64_t getNumberOfConsumers(); + + private: + Client(const std::string& serviceUrl, const ClientConfiguration& clientConfiguration, + bool poolConnections); + Client(const std::shared_ptr<ClientImpl>); + + friend class PulsarFriend; + friend class PulsarWrapper; + std::shared_ptr<ClientImpl> impl_; +}; +} // namespace pulsar + +#endif /* PULSAR_CLIENT_HPP_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZYACgkQT0AbyNP5 ++1VR8w/+ILnwieyoyPkBpgffgZ+LbSDOkUrP4r+mvjLpQgjDcpZvoh5H6BTtMZz+ +7EwnOw6hM87sz3YGZtfJbElRqT3GHR37MdnPUqdXd3wxe34obl62bs1tRYqst2I2 +8ab+4NOf9duKITfRtg/0BfdUYhlvCcB4dtSZj/vCErCJ4CzoZ8dPYpX6B1swgQ67 +3MGwEHYa/dkUAzZQrrcyuOogAMunuvSf65IaSgy0+vy4gaLO8oFTJn48A7933IDX +CGIV03iM0pU0oPikG5LtM12ViGYnoh/hWd3XQOLjGoXWfqZm8A130epZOjyWNxVa +09QxnS+OtvvTPREzc/hVzKM7jijbij4NRLQ4QwJ27tAltWfdQ0ohDTqc6FAT9EjP +LwrnWZTDyHdorkad751W1XdfV77FMGS3EdD0S4vmFrgsMsDMwhg/2853zJyQSBHW +eIz41H56p6b/xvvRJvVuQVvPLL2j1miQx/t/q8QqVrSxLlGlSGguyYn16ixpfnur +mCwPQ8VAEHYbtXpTv1uAWZhO2hflMOrGgPmmBB2l7dGDlQrdpEBJCOokva1b3BKf +3BtZqej1OEdyCZD7DmB8d2RAjJ2x4/CTnsXilSpG7ffBKrfSZvAsvC1Sd9nfvYci +CW1JcjgPCTeLm21MaLBhC4krHFZ8hJLEaZrd0dypvuchsVXkNK0= +=uvVO +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Client.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +eef220deccb81afa8832eefb9012419c36429061d91c934b082114406fc1f506f41de4d5704217158b6f71f1c73e5910c94e2aa80d9f1d399382aa0aacaffbdf ./x64-windows-static/include/pulsar/Client.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,296 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef PULSAR_CLIENTCONFIGURATION_H_ +#define PULSAR_CLIENTCONFIGURATION_H_ + +#include <pulsar/Authentication.h> +#include <pulsar/Logger.h> +#include <pulsar/defines.h> + +namespace pulsar { +class PulsarWrapper; +struct ClientConfigurationImpl; +class PULSAR_PUBLIC ClientConfiguration { + public: + ClientConfiguration(); + ~ClientConfiguration(); + ClientConfiguration(const ClientConfiguration&); + ClientConfiguration& operator=(const ClientConfiguration&); + + /** + * Configure a limit on the amount of memory that will be allocated by this client instance. + * Setting this to 0 will disable the limit. By default this is disabled. + * + * @param memoryLimitBytes the memory limit + */ + ClientConfiguration& setMemoryLimit(uint64_t memoryLimitBytes); + + /** + * @return the client memory limit in bytes + */ + uint64_t getMemoryLimit() const; + + /** + * Set the authentication method to be used with the broker + * + * @param authentication the authentication data to use + */ + ClientConfiguration& setAuth(const AuthenticationPtr& authentication); + + /** + * @return the authentication data + */ + Authentication& getAuth() const; + + /** + * Set timeout on client operations (subscribe, create producer, close, unsubscribe) + * Default is 30 seconds. + * + * @param timeout the timeout after which the operation will be considered as failed + */ + ClientConfiguration& setOperationTimeoutSeconds(int timeout); + + /** + * @return the client operations timeout in seconds + */ + int getOperationTimeoutSeconds() const; + + /** + * Set the number of IO threads to be used by the Pulsar client. Default is 1 + * thread. + * + * @param threads number of threads + */ + ClientConfiguration& setIOThreads(int threads); + + /** + * @return the number of IO threads to use + */ + int getIOThreads() const; + + /** + * Set the number of threads to be used by the Pulsar client when delivering messages + * through message listener. Default is 1 thread per Pulsar client. + * + * If using more than 1 thread, messages for distinct MessageListener will be + * delivered in different threads, however a single MessageListener will always + * be assigned to the same thread. + * + * @param threads number of threads + */ + ClientConfiguration& setMessageListenerThreads(int threads); + + /** + * @return the number of IO threads to use + */ + int getMessageListenerThreads() const; + + /** + * Number of concurrent lookup-requests allowed on each broker-connection to prevent overload on broker. + * <i>(default: 50000)</i> It should be configured with higher value only in case of it requires to + * produce/subscribe on + * thousands of topic using created {@link PulsarClient} + * + * @param concurrentLookupRequest + */ + ClientConfiguration& setConcurrentLookupRequest(int concurrentLookupRequest); + + /** + * @return Get configured total allowed concurrent lookup-request. + */ + int getConcurrentLookupRequest() const; + + /** + * Initialize the log configuration + * + * @param logConfFilePath path of the configuration file + * @deprecated + */ + ClientConfiguration& setLogConfFilePath(const std::string& logConfFilePath); + + /** + * Get the path of log configuration file (log4cpp) + */ + const std::string& getLogConfFilePath() const; + + /** + * Configure a custom logger backend to route of Pulsar client library + * to a different logger implementation. + * + * By default, log messages are printed on standard output. + * + * When passed in, the configuration takes ownership of the loggerFactory object. + * The logger factory can only be set once per process. Any subsequent calls to + * set the logger factory will have no effect, though the logger factory object + * will be cleaned up. + */ + ClientConfiguration& setLogger(LoggerFactory* loggerFactory); + + /** + * Configure whether to use the TLS encryption on the connections. + * + * The default value is false. + * + * @param useTls + */ + ClientConfiguration& setUseTls(bool useTls); + + /** + * @return whether the TLS encryption is used on the connections + */ + bool isUseTls() const; + + /** + * Set the path to the TLS private key file. + * + * @param tlsPrivateKeyFilePath + */ + ClientConfiguration& setTlsPrivateKeyFilePath(const std::string& tlsKeyFilePath); + + /** + * @return the path to the TLS private key file + */ + const std::string& getTlsPrivateKeyFilePath() const; + + /** + * Set the path to the TLS certificate file. + * + * @param tlsCertificateFilePath + */ + ClientConfiguration& setTlsCertificateFilePath(const std::string& tlsCertificateFilePath); + + /** + * @return the path to the TLS certificate file + */ + const std::string& getTlsCertificateFilePath() const; + + /** + * Set the path to the trusted TLS certificate file. + * + * @param tlsTrustCertsFilePath + */ + ClientConfiguration& setTlsTrustCertsFilePath(const std::string& tlsTrustCertsFilePath); + + /** + * @return the path to the trusted TLS certificate file + */ + const std::string& getTlsTrustCertsFilePath() const; + + /** + * Configure whether the Pulsar client accepts untrusted TLS certificates from brokers. + * + * The default value is false. + * + * @param tlsAllowInsecureConnection + */ + ClientConfiguration& setTlsAllowInsecureConnection(bool allowInsecure); + + /** + * @return whether the Pulsar client accepts untrusted TLS certificates from brokers + */ + bool isTlsAllowInsecureConnection() const; + + /** + * Configure whether it allows validating hostname verification when a client connects to a broker over + * TLS. + * + * It validates the incoming x509 certificate and matches the provided hostname (CN/SAN) with the + * expected broker's hostname. It follows the server identity hostname verification in RFC 2818. + * + * The default value is false. + * + * @see [RFC 2818](https://tools.ietf.org/html/rfc2818). + * + * @param validateHostName whether to enable the TLS hostname verification + */ + ClientConfiguration& setValidateHostName(bool validateHostName); + + /** + * @return true if the TLS hostname verification is enabled + */ + bool isValidateHostName() const; + + /** + * Configure the listener name that the broker returns the corresponding `advertisedListener`. + * + * @param name the listener name + */ + ClientConfiguration& setListenerName(const std::string& listenerName); + + /** + * @return the listener name for the broker + */ + const std::string& getListenerName() const; + + /** + * Initialize stats interval in seconds. Stats are printed and reset after every `statsIntervalInSeconds`. + * + * Default: 600 + * + * Set to 0 means disabling stats collection. + */ + ClientConfiguration& setStatsIntervalInSeconds(const unsigned int&); + + /** + * @return the stats interval configured for the client + */ + const unsigned int& getStatsIntervalInSeconds() const; + + /** + * Set partitions update interval in seconds. + * If a partitioned topic is produced or subscribed and `intervalInSeconds` is not 0, every + * `intervalInSeconds` seconds the partition number will be retrieved by sending lookup requests. If + * partition number has been increased, more producer/consumer of increased partitions will be created. + * Default is 60 seconds. + * + * @param intervalInSeconds the seconds between two lookup request for partitioned topic's metadata + */ + ClientConfiguration& setPartititionsUpdateInterval(unsigned int intervalInSeconds); + + /** + * Get partitions update interval in seconds. + */ + unsigned int getPartitionsUpdateInterval() const; + + /** + * Set the duration of time to wait for a connection to a broker to be established. If the duration passes + * without a response from the broker, the connection attempt is dropped. + * + * Default: 10000 + * + * @param timeoutMs the duration in milliseconds + * @return + */ + ClientConfiguration& setConnectionTimeout(int timeoutMs); + + /** + * The getter associated with setConnectionTimeout(). + */ + int getConnectionTimeout() const; + + friend class ClientImpl; + friend class PulsarWrapper; + + private: + const AuthenticationPtr& getAuthPtr() const; + std::shared_ptr<ClientConfigurationImpl> impl_; +}; +} // namespace pulsar + +#endif /* PULSAR_CLIENTCONFIGURATION_H_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xaAACgkQT0AbyNP5 ++1Whaw//WoPgHU2Tkzwd/xbcb8GQo80lHx/Q0hVS9LIrXDtfKh3CD9M4N+3fxssx +TBRPi850uTlgEtjAnkfDr91MYik8qZX0JFvTmNLrqFXneVduQAnnoPQMwVX5ZlaT +i8ZGIz/spGvIa9eEhhiuxLdtUWZ4S+GTgNdlCMQ7opipsBjIqWEpbdSWI8ZHTkH5 +OFgN9eJQnu2lu2zBbDCJvBFbO/+MBJt+jKd4mHBHW2p0LDPo1uO+asbXKOW4oKJd +10hIbHiLU3r//CW02/OjLC8oclkN6Joky4QLowkeop0kZLQW/aiEC7X3TDaSwJA2 +RLiKOz/rr4GEIF/wf2nWV3ivlrBYHb1YictlzvOKP6sRRFzGUQ8pZQmX5H/Btz1z +SPyRQJ54NSHudUwiklF/S7gFfQeygjn2zqnqXOJJxxEtWA1q4keKJkB7IaRCG/DE +wL+lkBndxPiqnXQJlsk7Z+l2hvLbRhFgePlXv8wktN4V3lPmVMSFuf5IH3X7qyRN +xqvtRq9lPZQv9+A7I7kT2OUimRlKcLi3e3jEPcUbMbZtxA1rzX/FZiUdUj/iBRf+ +1FsiztprSXay6rq7Zb6hejT3wXnWffoY1+um3IsjWpjhP6RqwcF845F/b6tpOfFN +gnEDMX7eBSMZaMnoqSDjfSIxrR24KZSqw03npblg/EyCavaWXgw= +=lq4u +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ClientConfiguration.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +8554f8a949c14bfefcc6656cd3923565dda0508b3236a517c3be553a4d05c5d494b7128315bb003c11365ffcedac1ba0b949222a6a257faf8dd64554c326c413 ./x64-windows-static/include/pulsar/ClientConfiguration.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +#ifndef PULSAR_COMPRESSIONTYPE_H_ +#define PULSAR_COMPRESSIONTYPE_H_ + +namespace pulsar { +enum CompressionType +{ + CompressionNone = 0, + CompressionLZ4 = 1, + CompressionZLib = 2, + CompressionZSTD = 3, + CompressionSNAPPY = 4 +}; +} + +#endif /* PULSAR_COMPRESSIONTYPE_H_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZwACgkQT0AbyNP5 ++1VUnhAAp9c6DwN+Ojan1fbFuHKTPHI/K9ZLj7h4MiEez1/eEmxb7SwXggZypiH9 +/cu4EEouGmbziD2LFz5pNwS6alcoF8qa1gYQOIIJxlIbWzYqu8t5A6A4tbTlobfb +FA/o+IT+SfDGbcahqzB7w/6dw5CRuhxycKaA/0ryqzB/V0wP+nIeWUD5KMxgMBuz +7IChRo4jb7kfhVztkpHI6p5/dC3Yz2R8jhzN2OQyraL0PQG7lBJbdhjUVOjU9he/ +vCFOenhgSS5YmBL9km8OsDx89gy+P4Fh2iUG7EyxA4nsmSLyoXozb+KGUJJmVy4h +rigHhlALXRSQ2gvVYrHIaed3DOqbdp3ThCRFAW7MfmcUPOyIIlEngr0r/FuSnpAZ +bvpia6ZctN25UXmW0tACt/M28BUAQbiFEMm1tFoROdfsDlmLGMpCJZWqntCEEqX/ +87QBibuRhnbVB3Xz6l1aV84aJOOFKdy3zzRXxukcZS8u43G7ReJ5F6187dJ7y3xj +tSplJFd16/7rXVMesEfMznxfReLh4jzGi7/WNsx7mpLVcLHz9FGHM1aBLiN77mwT +DbQlx0NQXIL0YF/1u/RlItk28aCkl73cCAtF4VFu/I81XMN3J8vL2FrP6sxX/vxq +JUKo1wi8n4S+Y6IYeX/Uir8SHtB7xmCTwYFg6UidB+vkKRJVRkQ= +=qzKJ +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/CompressionType.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +ae9ec44d3d6eb8834ded45d3e0ff991c831e34d68a70ae083817f44cd2ba20fcacb148408af09804fef64e39bab8ae578fc998329e6580fd197a81cb96f8ae12 ./x64-windows-static/include/pulsar/CompressionType.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include <pulsar/Logger.h> + +namespace pulsar { + +class ConsoleLoggerFactoryImpl; + +/** + * The default LoggerFactory of Client if `USE_LOG4CXX` macro was not defined during compilation. + * + * + * The log format is "yyyy-MM-dd HH:mm:ss,SSS Z <level> <thread-id> <file>:<line> | <msg>", like + * + * ``` + * 2021-03-24 17:35:46,571 +0800 INFO [0x10a951e00] ConnectionPool:85 | Created connection for ... + * ``` + * + * It uses `std::cout` to prints logs to standard output. You can use this factory class to change your log + * level simply. + * + * ```c++ + * #include <pulsar/ConsoleLoggerFactory.h> + * + * ClientConfiguration conf; + * conf.setLogger(new ConsoleLoggerFactory(Logger::LEVEL_DEBUG)); + * Client client("pulsar://localhost:6650", conf); + * ``` + */ +class PULSAR_PUBLIC ConsoleLoggerFactory : public LoggerFactory { + public: + explicit ConsoleLoggerFactory(Logger::Level level = Logger::LEVEL_INFO); + + ~ConsoleLoggerFactory(); + + Logger* getLogger(const std::string& fileName) override; + + private: + std::unique_ptr<ConsoleLoggerFactoryImpl> impl_; +}; + +} // namespace pulsar Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZYACgkQT0AbyNP5 ++1W1Pw/9GL+6ORdJz1BISAo/5UQf3FfHQO2+ceWUgwXY/R57OtUbLqh4GvVyP7dX +wTmn5f6FRFgM7qKts0hHXE1P6ENrq4cTCv9vEdA6kar8K2gg9NXmE9AYYlfzHFF4 +FmTQgu5btwUcA6kPgVZa/0pNV/W8S43DyBJwOojBcE2QgfAf41SP6n9+yjpl3QcT +hPv7KilJF5IWa7G9wIUXtb3hde+6HWjy0YdTqt9XQX/9swpcebXWhJ1SUxDUpijh +1U3yFPS5/ub1gs8HvC57TMc1VgUBd4U7Y2VviVSqE98qYsP6oWVOVDTgolJ5GQAX +HXZ2jNQfY91lSDmq1zk1oiknXej67aiQz9fdSoIP9qa3bt7o4aNN7cqAKPWx1zEn +Dgq8HApY5vAvUw3WiA0GomrqoCejHSsHHJ/tfmesfsMtMetF664hO5TZYRiusJ9U +4yZSs3l/wIJ0YMYNACm4qttfIz9c4F9wQUZpnRYciePGFMFkkpSJjQh7jDMzCaov +8nysOH+h5IcdBqCbKPB/917CYD9aB8DfukZ4XrYZxB/kEpbNxTwbEVKm2WbfzRMh +NEiii5UgEPotGnK8rVAfPPSz8DSNdNf6pjhUTuIrgrvElLB63Hd2ehZYSY0gwQd0 +f3qXGFQCZ4341JqgaRu59+jyB8y6//3xLFg9s3QtH6H37yYfrKw= +=1y/N +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ConsoleLoggerFactory.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +55368be472b0d636d7a9e136e0272018cd151751ab65f299056d85645afb0ed22dac2995c1d1c82c4793093dc1bdf53b1131f59acc6353b9233f1a3d4f8e1f7e ./x64-windows-static/include/pulsar/ConsoleLoggerFactory.h
