Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,84 @@ +/** + * 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 KEY_VALUE_HPP_ +#define KEY_VALUE_HPP_ + +#include <memory> +#include <string> + +#include "Schema.h" +#include "defines.h" + +namespace pulsar { + +class KeyValueImpl; + +/** + * Use to when the user uses key value schema. + */ +class PULSAR_PUBLIC KeyValue { + public: + /** + * Constructor key value, according to keyValueEncodingType, whether key and value be encoded together. + * + * @param key key data. + * @param value value data. + * @param keyValueEncodingType key value encoding type. + */ + KeyValue(std::string &&key, std::string &&value); + + /** + * Get the key of KeyValue. + * + * @return character stream for key + */ + std::string getKey() const; + + /** + * Get the value of the KeyValue. + * + * + * @return the pointer to the KeyValue value + */ + const void *getValue() const; + + /** + * Get the value length of the keyValue. + * + * @return the length of the KeyValue value + */ + size_t getValueLength() const; + + /** + * Get string representation of the KeyValue value. + * + * @return the string representation of the KeyValue value + */ + std::string getValueAsString() const; + + private: + typedef std::shared_ptr<KeyValueImpl> KeyValueImplPtr; + KeyValue(KeyValueImplPtr keyValueImplPtr); + KeyValueImplPtr impl_; + friend class Message; + friend class MessageBuilder; +}; +} // namespace pulsar + +#endif /* KEY_VALUE_HPP_ */
Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZUACgkQT0AbyNP5 ++1VcsA/+OThVXCcSCEDMC2lVdA1J6wdYSb+Cgw9cRRA6prjBvf28V+FdKOASZSG0 +yakihvAUPjE6MHgFidnJiptsRJJyh43tUhwmiwEcqiZKEjpxViWdRQ4hohJSXBcI +z/4gC4RNpW4M5SSdYsjrGz2KkHklI4SX6mGJ4NfnSM4GZgdhHNHCY4Amclsa20tO +Br1qSRKW9/UZnVjDt9ZhreDfJgxqyH0ngLrrdKuWBYbNRoKGPPxynhj57z6mG2UG +JbIWGo5JfJGf1qOkd8j1B0HZnjJm9GW4s7NM6OpTfUeodAI6MhJCiIg0DGL2DZPR +hNn8L/9xCGcw9SFapG2s01dmzPoWTl64wAFPEIbhy9JV9PYa7reNy8vXfBimIIzr +gqWMXLGJNrAf6ulDZ9+kcxRSWXl39O7f1orwJhKa8HwDyee8hjkUhwcRSL/DAEVK +lc/+LOdQDyEZluXjTB6DWpnXq5wSZ5jEoxo8yOvZtyhumQ2vsOQeNvpvvxy9vg1C +xuVmhysKfeLjkSWNM2SfDKepIrp/EXth26zD28ea206ms4OhA/uu8Zq/u+R0jRq1 +0mehzrWc+Lk9Lu33JX9cxXBbA3Pd3+DPPRh1ZlahwLD/M1E/cl4IFrbkgEoZKdew +j1iG7s6X0RQK2Ib2rSaYg8KnebLHMhQq+IhIgTKJxSnR6dmwlWw= +=ebhH +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/KeyValue.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6586d55519400fd64482b0221b74fe361347018d64a3faef9243c274980edc9a39cbc57eaafc506e070607dcb52557c0e7e55930790bbe45678dbb33e7e3cc88 ./x64-windows-static/include/pulsar/KeyValue.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,72 @@ +/** + * 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/defines.h> + +#include <memory> +#include <string> + +namespace pulsar { + +class PULSAR_PUBLIC Logger { + public: + enum Level + { + LEVEL_DEBUG = 0, + LEVEL_INFO = 1, + LEVEL_WARN = 2, + LEVEL_ERROR = 3 + }; + + virtual ~Logger() {} + + /** + * Check whether the log level is enabled + * + * @param level the Logger::Level + * @return true if log is enabled + */ + virtual bool isEnabled(Level level) = 0; + + /** + * Log the message with related metadata + * + * @param level the Logger::Level + * @param line the line number of this log + * @param message the message to log + */ + virtual void log(Level level, int line, const std::string& message) = 0; +}; + +class PULSAR_PUBLIC LoggerFactory { + public: + virtual ~LoggerFactory() {} + + /** + * Create a Logger that is created from the filename + * + * @param fileName the filename that is used to construct the Logger + * @return a pointer to the created Logger instance + * @note the pointer must be allocated with the `new` keyword in C++ + */ + virtual Logger* getLogger(const std::string& fileName) = 0; +}; + +} // namespace pulsar Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZsACgkQT0AbyNP5 ++1Wf0RAAgv23bf9UOPRHjvCmZ389Ce6jVYBixOmQz9zOqV02Aom7f9Gb1e4KRwks +NbmtCvDzMWRe6R/+SBdHa+ik+YxZcXpyocVxIWSbf9VkOohLIfc3Jt8xEOzMiL5g +DFNLdqES6HKD9j9ZlDJf0K77Q3NIROGmCpJKK+B/Q2qv/ijlrs1cWbU9gB2R+D12 +uD+QNIl+NkGtlHhHn3ivG/vLNX/iHQqTvGGoiH3f5vKFV3FhLhnhjnFLl2eqQwFL +7BMsf8lrkZOGwDsUWPC3Lf3IsZosjPd8IH/RCiW0loPpa244YxCBs101SwRjIxtd +fYJftjCrz5wc5eynXAXMSeR4f0qgDis+a+3TiAdQKzarULWBbA61T9yYGMzOY1wQ +otu5IOe4iqsAk5AohEl21t2iWPSv7KxdTjvAeHFfua2+GFBeHXCLiJUt4zuqUTGH +lNFcMHBGFgJtaeDkcIE+KO3pT7i2ErqqcFcZy4u/tbtFPOnMAzmVaCYO4apy82cf +1ypdN2grS7Hoa8A65stN+Y2SJBcx0kLShuPEeiJ3/DkfVHeKQLP+mDRwdhoAs06+ +3hdKoX92YcMCvsESbTQJsNqfLorav3daEtOsxx2J7eCOiKQBqhLpJ+YM2mErj2Wk +r76BkgG9ol04WIceoFJa3k0pQBdbPvVEEvvVXSxcgicCLUbI9vI= +=nJkG +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Logger.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +50af93256fc4428b20d40565d706f4bc276948a7901c6c3c9e30651fe1dbbfed8ef18415d34a32f77397dc9fd5f979f4e7a680ebe89d69e6e9b1f3c4c845c70b ./x64-windows-static/include/pulsar/Logger.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,214 @@ +/** + * 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 MESSAGE_HPP_ +#define MESSAGE_HPP_ + +#include <pulsar/defines.h> + +#include <map> +#include <memory> +#include <string> + +#include "KeyValue.h" +#include "MessageId.h" + +namespace pulsar { +namespace proto { +class CommandMessage; +class MessageMetadata; +class SingleMessageMetadata; +} // namespace proto + +class SharedBuffer; +class MessageBuilder; +class MessageImpl; +class PulsarWrapper; + +class PULSAR_PUBLIC Message { + public: + typedef std::map<std::string, std::string> StringMap; + + Message(); + + /** + * Return the properties attached to the message. + * Properties are application defined key/value pairs that will be attached to the message + * + * @return an unmodifiable view of the properties map + */ + const StringMap& getProperties() const; + + /** + * Check whether the message has a specific property attached. + * + * @param name the name of the property to check + * @return true if the message has the specified property + * @return false if the property is not defined + */ + bool hasProperty(const std::string& name) const; + + /** + * Get the value of a specific property + * + * @param name the name of the property + * @return the value of the property or null if the property was not defined + */ + const std::string& getProperty(const std::string& name) const; + + /** + * Get the content of the message + * + * + * @return the pointer to the message payload + */ + const void* getData() const; + + /** + * Get the length of the message + * + * @return the length of the message payload + */ + std::size_t getLength() const; + + /** + * Get string representation of the message + * + * @return the string representation of the message payload + * + * NOTE: For MSVC with debug mode, return a thread local std::string object to avoid memory allocation + * across DLLs and applications, which could lead to a crash. + */ +#if defined(_MSC_VER) && !defined(NDEBUG) + const std::string& getDataAsString() const; +#else + std::string getDataAsString() const; +#endif + + /** + * Get key value message. + * + * @return key value message. + */ + KeyValue getKeyValueData() const; + + /** + * Get the unique message ID associated with this message. + * + * The message id can be used to univocally refer to a message without having to keep the entire payload + * in memory. + * + * Only messages received from the consumer will have a message id assigned. + * + */ + const MessageId& getMessageId() const; + + /** + * Set the unique message ID. + * + */ + void setMessageId(const MessageId& messageId) const; + + /** + * Get the partition key for this message + * @return key string that is hashed to determine message's topic partition + */ + const std::string& getPartitionKey() const; + + /** + * @return true if the message has a partition key + */ + bool hasPartitionKey() const; + + /** + * Get the ordering key of the message + * + * @return the ordering key of the message + */ + const std::string& getOrderingKey() const; + + /** + * Check whether the message has a ordering key + * + * @return true if the ordering key was set while creating the message + * false if the ordering key was not set while creating the message + */ + bool hasOrderingKey() const; + + /** + * Get the UTC based timestamp in milliseconds referring to when the message was published by the client + * producer + */ + uint64_t getPublishTimestamp() const; + + /** + * Get the event timestamp associated with this message. It is set by the client producer. + */ + uint64_t getEventTimestamp() const; + + /** + * Get the topic Name from which this message originated from + */ + const std::string& getTopicName() const; + + /** + * Get the redelivery count for this message + */ + const int getRedeliveryCount() const; + + /** + * Check if schema version exists + */ + bool hasSchemaVersion() const; + + /** + * Get the schema version + */ + const std::string& getSchemaVersion() const; + + bool operator==(const Message& msg) const; + + private: + typedef std::shared_ptr<MessageImpl> MessageImplPtr; + MessageImplPtr impl_; + + Message(MessageImplPtr& impl); + Message(const proto::CommandMessage& msg, proto::MessageMetadata& data, SharedBuffer& payload, + int32_t partition); + /// Used for Batch Messages + Message(const MessageId& messageId, proto::MessageMetadata& metadata, SharedBuffer& payload, + proto::SingleMessageMetadata& singleMetadata, const std::string& topicName); + friend class PartitionedProducerImpl; + friend class MultiTopicsConsumerImpl; + friend class MessageBuilder; + friend class ConsumerImpl; + friend class ProducerImpl; + friend class Commands; + friend class BatchMessageContainerBase; + friend class BatchAcknowledgementTracker; + friend class PulsarWrapper; + friend class MessageBatch; + friend struct OpSendMsg; + + friend PULSAR_PUBLIC std::ostream& operator<<(std::ostream& s, const StringMap& map); + friend PULSAR_PUBLIC std::ostream& operator<<(std::ostream& s, const Message& msg); + friend class PulsarFriend; +}; +} // namespace pulsar + +#endif /* MESSAGE_HPP_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIxBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZgACgkQT0AbyNP5 ++1WPtQ/wgd03n2xzIABRSFC3tM4QtiEq8H1LXBdfw8MWer3O5BlgJtyoxrqoKCb5 +UgzDFywkxnb08inyyKR6YjzSZx3mxmVuaZNpMdaTsoAY5UiXWuo4+Dkdbu3+5aU1 ++/ytogKw7xBk88HQS4YnuqqrP9dyuaM5OtbmbUfJay2/KJbSxEYeTtop3cPKS/gA +Yxc0quf9SEUMUyxKvFxv8d8fvVYPAKJpJMFszx6ogEvWWPsiV0qNGWQuYqzlowss +1fL2aSOnIMQ9aOm+HTnKbErcku7VeepKXwPv26mICOj+HRTOzB87hOH7CAhhUs/A +0xfOVchlCZDVp/YGpi2lS+E+6J3k2SeOUZIksL/lsasGxzR7rH3XwsRLXNJhzj9L +zykuWn9SWgFGlgjaJsQdvz0pLHEbzX4xkbepzLwgZTdbGEY1mFS+LwWG2AI9jgyv +T2oLLZ7EmwSrXhzAcxUXzEyp4BZykUgwXAK3NYyinS9BIoI5PE9xtRAifRDNh3pR +qtZIF2vpxJvVvw9/YrrZEJu08gzLAn+TQG5qH1tHohNUYE/WKa+uh1w0LjirYKt2 +8OjTTooQvuLrClyutis5qDZULmSTMvUhsjd61J63FaMC5dN7kbKdJVQTn4ZF1pm+ +SXLOFwXafUKE2urvchyeXqojgckjaTkFO9iSfi6vwG1gri5L +=r9An +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Message.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +9cf64692cd5565122df15dad9c7bc3acfbb091db78c4caefeb9648de20f972dc6404181967c584df2ede495b5f7d0c563c94bde7bef6aa65bd7498fcec22d07f ./x64-windows-static/include/pulsar/Message.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,49 @@ +/** + * 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 LIB_MESSAGE_BATCH_H +#define LIB_MESSAGE_BATCH_H +#include <pulsar/Message.h> +#include <pulsar/defines.h> + +#include <vector> + +namespace pulsar { + +class PULSAR_PUBLIC MessageBatch { + public: + MessageBatch(); + + MessageBatch& withMessageId(const MessageId& messageId); + + MessageBatch& parseFrom(const std::string& payload, uint32_t batchSize); + + MessageBatch& parseFrom(const SharedBuffer& payload, uint32_t batchSize); + + const std::vector<Message>& messages(); + + private: + typedef std::shared_ptr<MessageImpl> MessageImplPtr; + MessageImplPtr impl_; + Message batchMessage_; + + std::vector<Message> batch_; +}; +} // namespace pulsar +#endif // LIB_MESSAGE_BATCH_H Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZgACgkQT0AbyNP5 ++1UARQ/9GY5nOpI4DuvusAt09XCMRGhKG+YRkijDhX/vGsvEGcf9aVUf7AaT05yC +gpQxB3imj6AZLKGCZ07vHeZ+xzExRSURpKKltyDmGKM7qDe2D5/Yn0ev+nD9HaFh +iAabdH54ZoZvS5jmx+9jIFkGdF0efcewfScpk35GEJabm9bJFmCtj2Lag+C81Ixs +Tiu56fO4143jCFEiIbtqkHphGWoElXqXAeW2qxTSrMtbzLwTyRQHVpb4Lc3GyvMa +dyhDfFTyoWK/FfDHooj86wTKYVUO6d2rBoN0xwrjxxV80o+v+Q/ZDyaZbnHMwvlB +/D43wHgd50zWXIxhYOYQumInu0w3OQynGUbOEP3Qy+GVVr/hebUn4o4QqSXrxNzz +WJTp/2UEki5u0cqa6s5MaW0UJvfmKjeMyCKD8k2s9Ggz4UOjaNZzM3ARopyJR0wo +EnmKs3hzkRofcMLv1kQu3LMfDg9iMXpdMnTBKiabuyqn/O2I2NZ4moj7GL+aOk/y +/7aM5ZHvVuh9pOgdqsnESS6VGEgE++KnHEP48m6FLg+uqWT8tmRlj6Kr13ozDvG2 +Ui4nr4hjRCa1+iwyqp6r77M3lZSaHaDeWhnknxyBbxDLHPE1zZIqZNo59bBEdh5U +pA5lA69W9MIP9Uq3hBYbXuaedkoCkYTJlvoTQvzJ4YFfZrmL1Y0= +=JTZP +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBatch.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6c1164a0f5d37a1d5b8a372d9dd85273e61d1ddd132d47d4e2b4a43d05d9140b8b3465174403348c5c5b01bae8888bfb6025ce4429b51ecaa030c8a8e04a554f ./x64-windows-static/include/pulsar/MessageBatch.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,175 @@ +/** + * 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 MESSAGE_BUILDER_H +#define MESSAGE_BUILDER_H + +#include <pulsar/KeyValue.h> +#include <pulsar/Message.h> +#include <pulsar/defines.h> + +#include <chrono> +#include <string> +#include <vector> + +namespace pulsar { +class PulsarWrapper; + +class PULSAR_PUBLIC MessageBuilder { + public: + MessageBuilder(); + + typedef std::map<std::string, std::string> StringMap; + + /** + * Finalize the immutable message + */ + Message build(); + + /** + * Set content of the message. The given data is copied into message. + */ + MessageBuilder& setContent(const void* data, size_t size); + + /** + * Set the content of the message + * + * @param data the content of the message. + * @see setContent(const void*, size_t) + */ + MessageBuilder& setContent(const std::string& data); + + /** + * Set the content of the message + * + * @param data the content of the message. The given data is moved into message. + */ + MessageBuilder& setContent(std::string&& data); + + /** + * Set the key value content of the message + * + * @param data the content of the key value. + */ + MessageBuilder& setContent(const KeyValue& data); + + /** + * Set content of the message to a buffer already allocated by the caller. No copies of + * this buffer will be made. The caller is responsible to ensure the memory buffer is + * valid until the message has been persisted (or an error is returned). + */ + MessageBuilder& setAllocatedContent(void* data, size_t size); + + /** + * Sets a new property on a message. + * @param name the name of the property + * @param value the associated value + */ + MessageBuilder& setProperty(const std::string& name, const std::string& value); + + /** + * Add all the properties in the provided map + */ + MessageBuilder& setProperties(const StringMap& properties); + + /** + * set partition key for message routing and topic compaction + * @param hash of this key is used to determine message's topic partition + */ + MessageBuilder& setPartitionKey(const std::string& partitionKey); + + /** + * set ordering key used for key_shared subscriptions + * @param the ordering key for the message + */ + MessageBuilder& setOrderingKey(const std::string& orderingKey); + + /** + * Specify a delay for the delivery of the messages. + * + * @param delay the delay in milliseconds + */ + MessageBuilder& setDeliverAfter(const std::chrono::milliseconds delay); + + /** + * Specify the this message should not be delivered earlier than the + * specified timestamp. + * + * @param deliveryTimestamp UTC based timestamp in milliseconds + */ + MessageBuilder& setDeliverAt(uint64_t deliveryTimestamp); + + /** + * Set the event timestamp for the message. + */ + MessageBuilder& setEventTimestamp(uint64_t eventTimestamp); + + /** + * Specify a custom sequence id for the message being published. + * <p> + * The sequence id can be used for deduplication purposes and it needs to follow these rules: + * <ol> + * <li><code>sequenceId >= 0</code> + * <li>Sequence id for a message needs to be greater than sequence id for earlier messages: + * <code>sequenceId(N+1) > sequenceId(N)</code> + * <li>It's not necessary for sequence ids to be consecutive. There can be holes between + * messages. Eg. the <code>sequenceId</code> could represent an offset or a cumulative size. + * </ol> + * + * @param sequenceId + * the sequence id to assign to the current message + * @since 1.20.0 + */ + MessageBuilder& setSequenceId(int64_t sequenceId); + + /** + * override namespace replication clusters. note that it is the + * caller's responsibility to provide valid cluster names, and that + * all clusters have been previously configured as topics. + * + * given an empty list, the message will replicate per the namespace + * configuration. + * + * @param clusters where to send this message. + */ + MessageBuilder& setReplicationClusters(const std::vector<std::string>& clusters); + + /** + * Do not replicate this message + * @param flag if true, disable replication, otherwise use default + * replication + */ + MessageBuilder& disableReplication(bool flag); + + /** + * create a empty message, with no properties or data + * + */ + MessageBuilder& create(); + + private: + MessageBuilder(const MessageBuilder&); + void checkMetadata(); + static std::shared_ptr<MessageImpl> createMessageImpl(); + Message::MessageImplPtr impl_; + + friend class PulsarWrapper; +}; +} // namespace pulsar + +#endif Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZcACgkQT0AbyNP5 ++1VoCg/+NqNjHGIv2LjI5wpEsAqskD+ImJ8aUipMlJV/VaRiJm/fYP8/IsaZvLMn +2a+MO3abYcd2JVr8qZvYVsUV3TGnBexDUxYOIi0ZluOu/lL/LnSpY7ZYyyRWljtH +PYw6Q+UsDyDWP1JJEklx1Jh2cuSX2M06BFvjG5APL6Bo0HLmzSCBBc2b+9IFhcVZ +sgMNaBBe3ymGPYgEG5v1b9ET+aWZ93o3exHqtY6MNwlsEAFsbk7G2W6lZ5qE6q4u +q2aFQv5cG9tRVDnm3Um/wKbfgtR2h7Zjhtupp+yw9EUIrn5u5Z7IeZUdsdANfM2r +BNa4VnSdUq2UNx8aJcLnr6ESO3MdusVjE8HbHdpn3/7mQEtxKgkouhF5Ez44ZBjH +vac5bhNJlAiFQ1ls2EL8hZOVYtrew8GFUYmxOup9SvIV+pMqpszH3da0TLmpSfct +eUjNmkPZEl6qAVGElaeguZd/9+jQUGv/nSsDvnvu5PYL2rfk6MDBZvExmv6WZK5F +pdd0sfOWsUfLubQ2FQaOLbt/+T5cyOBosZVZu1LABcMX6Xf4lFLhWy1TBGmixdFL +ATaJF6hiQiV7C77L/+kCoSbRacimNx8ISkTmjFix5U9oICvFnNsj4JSw2K/zSqmQ +42aaKq0zvRq16+YY0NQKsCWfkaFGRP8q1AobMf1exjtmN9Ju17I= +=jzk0 +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageBuilder.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +f7a06413f310faae64943df25cf751fd2b1b3ee583fcb1253e6b3e97ab372f2930577301337a2767cfb0a6b6bccc460b2d9ebba5c6d29541bd0dce69d84508c5 ./x64-windows-static/include/pulsar/MessageBuilder.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,123 @@ +/** + * 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 MESSAGE_ID_H +#define MESSAGE_ID_H + +#include <pulsar/defines.h> +#include <stdint.h> + +#include <iosfwd> +#include <memory> +#include <string> +#include <vector> + +namespace pulsar { + +class MessageIdImpl; + +class PULSAR_PUBLIC MessageId { + public: + MessageId& operator=(const MessageId&); + MessageId(); + + /** + * @deprecated + * + * Construct the MessageId + * + * NOTE: This API still exists for backward compatibility, use MessageIdBuilder instead. + * + * @param partition the partition number of a topic + * @param ledgerId the ledger id + * @param entryId the entry id + * @param batchIndex the batch index of a single message in a batch + */ + explicit MessageId(int32_t partition, int64_t ledgerId, int64_t entryId, int32_t batchIndex); + + /** + * MessageId representing the "earliest" or "oldest available" message stored in the topic + */ + static const MessageId& earliest(); + + /** + * MessageId representing the "latest" or "last published" message in the topic + */ + static const MessageId& latest(); + + /** + * Serialize the message id into a binary string for storing + */ + void serialize(std::string& result) const; + + /** + * Get the topic Name from which this message originated from + */ + const std::string& getTopicName() const; + + /** + * Set the topicName + */ + void setTopicName(const std::string& topicName); + + /** + * Deserialize a message id from a binary string + */ + static MessageId deserialize(const std::string& serializedMessageId); + + // These functions compare the message order as stored in bookkeeper + bool operator<(const MessageId& other) const; + bool operator<=(const MessageId& other) const; + bool operator>(const MessageId& other) const; + bool operator>=(const MessageId& other) const; + bool operator==(const MessageId& other) const; + bool operator!=(const MessageId& other) const; + + int64_t ledgerId() const; + int64_t entryId() const; + int32_t batchIndex() const; + int32_t partition() const; + int32_t batchSize() const; + + private: + friend class ConsumerImpl; + friend class ReaderImpl; + friend class Message; + friend class MessageImpl; + friend class Commands; + friend class PartitionedProducerImpl; + friend class MultiTopicsConsumerImpl; + friend class UnAckedMessageTrackerEnabled; + friend class BatchAcknowledgementTracker; + friend class PulsarWrapper; + friend class PulsarFriend; + friend class NegativeAcksTracker; + friend class MessageIdBuilder; + + friend PULSAR_PUBLIC std::ostream& operator<<(std::ostream& s, const MessageId& messageId); + + typedef std::shared_ptr<MessageIdImpl> MessageIdImplPtr; + MessageIdImplPtr impl_; + + explicit MessageId(const MessageIdImplPtr& impl); +}; + +typedef std::vector<MessageId> MessageIdList; +} // namespace pulsar + +#endif // MESSAGE_ID_H Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZsACgkQT0AbyNP5 ++1UJSRAAjLqRFdGLs9vcHy/56+AAO5HKf5eEUpcAuLSKxvQwCyybYvB1a3NMHIp4 +lAqNAj4qp31MlPz0FIhHuHYclIFgiYl7G3RvqUQqr+e2I+4sXeZ3TwVEd7sIUdSt +n0+HkJwuuSixgHevpYbs8Qe4K8CQucrWCn+U8RVrR74aTfymkHMDfYUB+O7JXPT1 +izA1lLlBHs+ojGk461R/CPHGlqrkCmqYZ7QdLdaLwhM8kFr2B3CYrZLsmPDJ6E1d +7x9rTVj0KSYgKeDgj6k5L3of+5lyWBNy2CHOGID284yiZFsimz+OYg8QgcDfLPix +ZXmNYdUQRI30zkRd4dh/Vy6sTaV2uNcCX0BbeI/7rp0/MKTJisnIZeiuI223XVMG +XVEBFHqH7bc4DLlzslaMU6FXbXy/Dt54G8MuZrEVAihnDVygpNt3gcwpxIdq3LI/ +elfPW8GMWSufLSyqmIt3WtGZhYrEZ8tQZ8cWCG5Vca9d6hITAecDNIRGMCOUdJDw +/9pu3IvUHhzygxaZxpWzkLGyRFlBmT9z0+GEogJZefY5UxE9/jsHiI2AT5p7hZgn +vM8FG3e6he+bQCwutYUySmHKIleHAraqkbmZWhUBx32AOpJVR0c1MINnIwqJ+5NG +UXEaYwS4ic3W9TJsSlEsMJ7siMqZ9wf3r4k2vdqUFJslmmedUA0= +=z2gR +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageId.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +c88b6b17f810131efc8917a88344ac8fbb4191e6999f753b2fb1a4e9e916bc73e8ccdea43d149d97343d6617e481fc06404971a81156ccb9b706d7f807449e5f ./x64-windows-static/include/pulsar/MessageId.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,115 @@ +/** + * 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/MessageId.h> + +#include <memory> + +namespace pulsar { + +namespace proto { +class MessageIdData; +} + +/** + * The builder to build a MessageId. + * + * Example of building a single MessageId: + * + * ```c++ + * MessageId msgId = MessageIdBuilder() + * .ledgerId(0L) + * .entryId(0L) + * .build(); + * ``` + * + * Example of building a batched MessageId: + * + * ```c++ + * MessageId msgId = MessageIdBuilder() + * .ledgerId(0L) + * .entryId(0L) + * .batchIndex(0) + * .batchSize(2) + * .build(); + * ``` + */ +class PULSAR_PUBLIC MessageIdBuilder { + public: + explicit MessageIdBuilder(); + + /** + * Create an instance that copies the data from messageId. + */ + static MessageIdBuilder from(const MessageId& messageId); + + /** + * Create an instance from the proto::MessageIdData instance. + * + * @note It's an internal API that converts the MessageIdData defined by PulsarApi.proto + * @see https://github.com/apache/pulsar-client-cpp/blob/main/proto/PulsarApi.proto + */ + static MessageIdBuilder from(const proto::MessageIdData& messageIdData); + + /** + * Build a MessageId. + */ + MessageId build() const; + + /** + * Set the ledger ID field. + * + * Default: -1L + */ + MessageIdBuilder& ledgerId(int64_t ledgerId); + + /** + * Set the entry ID field. + * + * Default: -1L + */ + MessageIdBuilder& entryId(int64_t entryId); + + /** + * Set the partition index. + * + * Default: -1 + */ + MessageIdBuilder& partition(int32_t partition); + + /** + * Set the batch index. + * + * Default: -1 + */ + MessageIdBuilder& batchIndex(int32_t batchIndex); + + /** + * Set the batch size. + * + * Default: 0 + */ + MessageIdBuilder& batchSize(int32_t batchSize); + + private: + std::shared_ptr<MessageIdImpl> impl_; +}; + +} // namespace pulsar Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZwACgkQT0AbyNP5 ++1WO0g/9EsHF/inT5q03lUMtPqAp2vnTtSWWYvqaU/9i8EIpRdQ1cfHR3N7q8hV4 +sCBzp2n4GmXSmjQjwh6YHopvA0RdoddWZxcgDd92WRFKMBX09gq0kQOmzAccC1FL +Hd0IOkF1pXSd3tsNzBA6M557Gk+2pTPmSQVrfXoP//C8MxCB6fDVFinjMKPrZW/8 +bmgAL//XweK8Govf+vjkTGadfmJdn6lf6Vb9840mDvziWzt5FG0MlyzPbAKamZpP +RHYe2EGgXLQ/43gR5j02Jj9SqBj5GWWngCXNEH3zrv4dpRK/VXVocQhm1yUJtwcS +t1ge8ECgCEAXrpSPItyjQpSce+qvUsx3KRI7Zo+AjiCkKJmd+Jw2YhuxkHkFjTz8 +srxDsafpFUU+m39czHIm/+ZPDQA3gPPD9m4XlHT12NZ99tMXSejkT9H01e81E/ry +dv5AyQ+cK5kM+olc2Z45n/Qt1mECojbBlZyAhqLSQJFvgZLZERgeqGV9sgz9JlM+ +zHlOH4BQICBdFLciJQuS7zU1wmIp2cwG2nh1ehiJe+JL/HWft250UnDX/JYfaSzn +EGKSNqcya2POyK4GGHjzGu9dGEP1Oe6R7nUshA4eIUlvusLo7HaLZW3MJk4b9m7d +KCsWsaICn2o9KKOo6c9VRXXaQBkTQtR+Z69bvogU0xO2o1X1wM8= +=f3w6 +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageIdBuilder.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +8a1f726bbd33759b4c773255038f10bedf86ba50dcd66993cbf20261d37a1545d07fdb9deeea7a93137b2d09ab01d18a13b09bd1fd0a7198d7eaf84c2f2171c3 ./x64-windows-static/include/pulsar/MessageIdBuilder.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,63 @@ +/** + * 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_MESSAGE_ROUTING_POLICY_HEADER_ +#define PULSAR_MESSAGE_ROUTING_POLICY_HEADER_ + +#include <pulsar/DeprecatedException.h> +#include <pulsar/Message.h> +#include <pulsar/TopicMetadata.h> +#include <pulsar/defines.h> + +#include <memory> + +/* + * Implement this interface to define custom policy giving message to + * partition mapping. + */ +namespace pulsar { + +class PULSAR_PUBLIC MessageRoutingPolicy { + public: + virtual ~MessageRoutingPolicy() {} + + /** @deprecated + Use int getPartition(const Message& msg, const TopicMetadata& topicMetadata) + */ + virtual int getPartition(const Message& msg) { + throw DeprecatedException( + "Use int getPartition(const Message& msg," + " const TopicMetadata& topicMetadata)"); + } + + /** + * Choose the partition from the message and topic metadata + * + * @param message the Message + * @param topicMetadata the TopicMetadata that contains the partition number + * @return the partition number + */ + virtual int getPartition(const Message& msg, const TopicMetadata& topicMetadata) { + return getPartition(msg); + } +}; + +typedef std::shared_ptr<MessageRoutingPolicy> MessageRoutingPolicyPtr; +} // namespace pulsar + +#endif // PULSAR_MESSAGE_ROUTING_POLICY_HEADER_ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZYACgkQT0AbyNP5 ++1Wyzg/+K6o7Hu4YEtiqmUIR5CV220Q6zImUg70fZMq5hxagY3BSITLar5UEkaLU +hZmQawFJJuCVL8ukTtRBC2+0CZW6N+orIFoKAIh+SQhpZMVs/BsSiuPdS6H8jj3t +c3pBTMOnyOzZpdD4Chd6AfVtP/lECtHxNY3cIvo//rKN9Xns+g11XK7VN5IiHl8r +qI4zQOInVz9zAGfgpUB7Z6+9cidU3c0AMMsLIz3WDrmBXB84mVzTB1O+PU+xIMC1 +/TmBR1L+tv06+RfUes3LyV7O1sUHxe04T87sDXgTkkXhF/KfaOdSPMwNI0QU5XKn +bBBPcCS36zgURx43DSe8KR/RsJa7ktTCBCD/shGSZvPGWR3F1m2cGGNdMBduxb+Y +BdB2uMGv9yBkYKEfztTuaaYVdmrBfQaqQX9qi2J5PSYaFU5Abnjtt84xV1wlG5dt +9hL6itdiBLsW21BPvrml1tGn1xEP4hijrNgzlAU9Wcc5RXCUjm0bEENrA4yEoLEq +zFE3+CfA08EaK4xG/6lfBstgUtUyWp97fB+XG37P8FaQe2xnv5qFqoLVJfJDw3iy +HmxAP6FSZJDhjW4DuaPljXCRr2ez00IrI7Sk8dRWwb4OJuHG+P7ngbT/kmhz3VDY +ZvqW0+3aIqr43IbT6n6un2pufIzpeOSx4CTLwYRzb3NqsGRt9s4= +=3/6v +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6890205e620bc251913f782fc704486ddb0ef356d10e6b0a2370315dac928616828bb5758e3bf71cbbb8a724194165b625c844f0ff9162d57d75a0f7cc8c4f04 ./x64-windows-static/include/pulsar/MessageRoutingPolicy.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,177 @@ +/** + * 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 PRODUCER_HPP_ +#define PRODUCER_HPP_ + +#include <pulsar/ProducerConfiguration.h> +#include <pulsar/defines.h> +#include <stdint.h> + +#include <memory> + +namespace pulsar { +class ProducerImplBase; +class PulsarWrapper; +class PulsarFriend; + +typedef std::function<void(Result)> FlushCallback; +typedef std::shared_ptr<ProducerImplBase> ProducerImplBasePtr; + +class PULSAR_PUBLIC Producer { + public: + /** + * Construct an uninitialized Producer. + */ + Producer(); + + /** + * @return the topic to which producer is publishing to + */ + const std::string& getTopic() const; + + /** + * @return the producer name which could have been assigned by the system or specified by the client + */ + const std::string& getProducerName() const; + + /** + * @deprecated + * It's the same with send(const Message& msg, MessageId& messageId) except that MessageId will be stored + * in `msg` though `msg` is `const`. + */ + Result send(const Message& msg); + + /** + * Publish a message on the topic associated with this Producer and get the associated MessageId. + * + * This method will block until the message will be accepted and persisted + * by the broker. In case of errors, the client library will try to + * automatically recover and use a different broker. + * + * If it wasn't possible to successfully publish the message within the sendTimeout, + * an error will be returned. + * + * This method is equivalent to asyncSend() and wait until the callback is triggered. + * + * @param [in] msg message to publish + * @param [out] messageId the message id assigned to the published message + * @return ResultOk if the message was published successfully + * @return ResultTimeout if message was not sent successfully in ProducerConfiguration#getSendTimeout + * @return ResultProducerQueueIsFull if the outgoing messsage queue is full when + * ProducerConfiguration::getBlockIfQueueFull was false + * @return ResultMessageTooBig if message size is bigger than the maximum message size + * @return ResultAlreadyClosed if Producer was already closed when message was sent + * @return ResultCryptoError if ProducerConfiguration::isEncryptionEnabled returns true but the message + * was failed to encrypt + * @return ResultInvalidMessage if message's invalid, it's usually caused by resending the same Message + */ + Result send(const Message& msg, MessageId& messageId); + + /** + * Asynchronously publish a message on the topic associated with this Producer. + * + * This method will initiate the publish operation and return immediately. The + * provided callback will be triggered when the message has been be accepted and persisted + * by the broker. In case of errors, the client library will try to + * automatically recover and use a different broker. + * + * If it wasn't possible to successfully publish the message within the sendTimeout, the + * callback will be triggered with a Result::WriteError code. + * + * @param msg message to publish + * @param callback the callback to get notification of the completion + */ + void sendAsync(const Message& msg, SendCallback callback); + + /** + * Flush all the messages buffered in the client and wait until all messages have been successfully + * persisted. + */ + Result flush(); + + /** + * Flush all the messages buffered in the client and wait until all messages have been successfully + * persisted. + */ + void flushAsync(FlushCallback callback); + + /** + * Get the last sequence id that was published by this producer. + * + * This represent either the automatically assigned or custom sequence id (set on the MessageBuilder) that + * was published and acknowledged by the broker. + * + * After recreating a producer with the same producer name, this will return the last message that was + * published in + * the previous producer session, or -1 if there no message was ever published. + * + * @return the last sequence id published by this producer + */ + int64_t getLastSequenceId() const; + + /** + * Return an identifier for the schema version that this producer was created with. + * + * When the producer is created, if a schema info was passed, the broker will + * determine the version of the passed schema. This identifier should be treated + * as an opaque identifier. In particular, even though this is represented as a string, the + * version might not be ascii printable. + */ + const std::string& getSchemaVersion() const; + + /** + * Close the producer and release resources allocated. + * + * No more writes will be accepted from this producer. Waits until + * all pending write requests are persisted. In case of errors, + * pending writes will not be retried. + * + * @return an error code to indicate the success or failure + */ + Result close(); + + /** + * Close the producer and release resources allocated. + * + * No more writes will be accepted from this producer. The provided callback will be + * triggered when all pending write requests are persisted. In case of errors, + * pending writes will not be retried. + */ + void closeAsync(CloseCallback callback); + + /** + * @return Whether the producer is currently connected to the broker + */ + bool isConnected() const; + + private: + explicit Producer(ProducerImplBasePtr); + + friend class ClientImpl; + friend class PulsarFriend; + friend class PulsarWrapper; + + ProducerImplBasePtr impl_; + + // For unit test case BatchMessageTest::producerFailureResult only + void producerFailMessages(Result result); +}; +} // namespace pulsar + +#endif /* PRODUCER_HPP_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZoACgkQT0AbyNP5 ++1WWWA//aO/8tK90Uia12cMLNm5e7GDwpkRSvUIhoFYIX+pglS2GTVCj+iSZizTE +9sUEui5DuGhL6+IuRxMwBl6Rl96zDgfNuN+MHvXFSug1e7RxHUQ/TvNS/V3w1Y9z +lF/jrYVdizYuvc4GdQatmQiBEOB/b1w6Cf/XTuCoLTwcBOAjOy98hr3Zdxn3vT9G +WKh/TL8HLgji/PbT1vOdWTDmU/RHGY1ezI/AhuLgyXP1NliYhp8aNaq1hTu4PiKY +9bQ60pEQqDbw4+zxQxLmb9Q8jE1/1v6JAsOzW4oT9lvLg9NCiI+lGJpRdlk326XP +11F7Ed92YuzgvMDeHka6zBBk/tWQtEv0Ihty8kGf3ZKmMHUZZl+yUEeZIoR/dIoh +ZVU1FLsi5P4kzcPEgooCqQhHldyL2+oltjBkibpbMEBTBQJ49uBVI+xEySpVK7BA +CcokN32pc+c4iWFwDdr5NjSu7wHDUchzt5Lsvuhygl45/NCOw6PaKjyf9SJ9x1iz +CGy8q86MOcXA4FmKDUeHHUCastAi9lv3g9qrd8+WRzSEWBAqKQrDlb2NGHt84L6h +C2aKxDl823kMQphVggg1Ibev4QvbHTNjO3VRtf0hDV1dR8+4zZP3LMPc40ITEC88 +cZLc2laInwJz7ERFVT3mYplWuGb7urjxS9VM0+AjqV2zGd+GoG4= +=RVTg +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/Producer.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +18a796debc4ca8daf2a5159fccf0bb04706a56bfa7e9539689d5825084081151eb58d7407c1d14313ada78fc1a442a17750eb24ee8aa2ad12e42151b6ca7a50f ./x64-windows-static/include/pulsar/Producer.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,542 @@ +/** + * 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_PRODUCERCONFIGURATION_H_ +#define PULSAR_PRODUCERCONFIGURATION_H_ +#include <pulsar/CompressionType.h> +#include <pulsar/CryptoKeyReader.h> +#include <pulsar/Message.h> +#include <pulsar/MessageRoutingPolicy.h> +#include <pulsar/ProducerCryptoFailureAction.h> +#include <pulsar/Result.h> +#include <pulsar/Schema.h> +#include <pulsar/defines.h> + +#include <functional> +#include <set> + +namespace pulsar { + +typedef std::function<void(Result, const MessageId& messageId)> SendCallback; +typedef std::function<void(Result)> CloseCallback; + +struct ProducerConfigurationImpl; +class PulsarWrapper; + +/** + * Class that holds the configuration for a producer + */ +class PULSAR_PUBLIC ProducerConfiguration { + public: + enum PartitionsRoutingMode + { + UseSinglePartition, + RoundRobinDistribution, + CustomPartition + }; + enum HashingScheme + { + Murmur3_32Hash, + BoostHash, + JavaStringHash + }; + enum BatchingType + { + /** + * Default batching. + * + * <p>incoming single messages: + * (k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3) + * + * <p>batched into single batch message: + * [(k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3)] + */ + DefaultBatching, + + /** + * Key based batching. + * + * <p>incoming single messages: + * (k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3) + * + * <p>batched into single batch message: + * [(k1, v1), (k1, v2), (k1, v3)], [(k2, v1), (k2, v2), (k2, v3)], [(k3, v1), (k3, v2), (k3, v3)] + */ + KeyBasedBatching + }; + enum ProducerAccessMode + { + /** + * By default multiple producers can publish on a topic. + */ + Shared = 0, + + /** + * Require exclusive access for producer. Fail immediately if there's already a producer connected. + */ + Exclusive = 1, + + /** + * Producer creation is pending until it can acquire exclusive access. + */ + WaitForExclusive = 2 + }; + + ProducerConfiguration(); + ~ProducerConfiguration(); + ProducerConfiguration(const ProducerConfiguration&); + ProducerConfiguration& operator=(const ProducerConfiguration&); + + /** + * Set the producer name which could be assigned by the system or specified by the client. + * + * @param producerName producer name. + * @return + */ + ProducerConfiguration& setProducerName(const std::string& producerName); + + /** + * The getter associated with setProducerName(). + */ + const std::string& getProducerName() const; + + /** + * Declare the schema of the data that will be published by this producer. + * + * The schema will be checked against the schema of the topic, and it + * will fail if it's not compatible, though the client library will + * not perform any validation that the actual message payload are + * conforming to the specified schema. + * + * For all purposes, this + * @param schemaInfo + * @return + */ + ProducerConfiguration& setSchema(const SchemaInfo& schemaInfo); + + /** + * @return the schema information declared for this producer + */ + const SchemaInfo& getSchema() const; + + /** + * The getter associated with getSendTimeout() + */ + ProducerConfiguration& setSendTimeout(int sendTimeoutMs); + + /** + * Get the send timeout is milliseconds. + * + * If a message is not acknowledged by the server before the sendTimeout expires, an error will be + * reported. + * + * If the timeout is zero, there will be no timeout. + * + * @return the send timeout in milliseconds (Default: 30000) + */ + int getSendTimeout() const; + + /** + * Set the baseline of the sequence ID for messages published by the producer. + * <p> + * The first message uses (initialSequenceId + 1) as its sequence ID and subsequent messages are assigned + * incremental sequence IDs. + * + * Default: -1, which means the first message's sequence ID is 0. + * + * @param initialSequenceId the initial sequence ID for the producer. + * @return + */ + ProducerConfiguration& setInitialSequenceId(int64_t initialSequenceId); + + /** + * The getter associated with setInitialSequenceId(). + */ + int64_t getInitialSequenceId() const; + + /** + * Set the compression type for the producer. + * <p> + * By default, message payloads are not compressed. Supported compression types are: + * <ul> + * + * <li>{@link CompressionNone}: No compression</li> + * <li>{@link CompressionLZ4}: LZ4 Compression https://lz4.github.io/lz4/ + * <li>{@link CompressionZLib}: ZLib Compression http://zlib.net/</li> + * <li>{@link CompressionZSTD}: Zstandard Compression https://facebook.github.io/zstd/ (Since Pulsar 2.3. + * Zstd cannot be used if consumer applications are not in version >= 2.3 as well)</li> + * <li>{@link CompressionSNAPPY}: Snappy Compression https://google.github.io/snappy/ (Since Pulsar 2.4. + * Snappy cannot be used if consumer applications are not in version >= 2.4 as well)</li> + * </ul> + */ + ProducerConfiguration& setCompressionType(CompressionType compressionType); + + /** + * The getter associated with setCompressionType(). + */ + CompressionType getCompressionType() const; + + /** + * Set the max size of the queue holding the messages pending to receive an acknowledgment from the + * broker. <p> When the queue is full, by default, all calls to Producer::send and Producer::sendAsync + * would fail unless blockIfQueueFull is set to true. Use {@link #setBlockIfQueueFull} to change the + * blocking behavior. + * + * Default: 1000 + * + * @param maxPendingMessages max number of pending messages. + * @return + */ + ProducerConfiguration& setMaxPendingMessages(int maxPendingMessages); + + /** + * The getter associated with setMaxPendingMessages(). + */ + int getMaxPendingMessages() const; + + /** + * Set the number of max pending messages across all the partitions + * <p> + * This setting will be used to lower the max pending messages for each partition + * ({@link #setMaxPendingMessages(int)}), if the total exceeds the configured value. + * + * Default: 50000 + * + * @param maxPendingMessagesAcrossPartitions + */ + ProducerConfiguration& setMaxPendingMessagesAcrossPartitions(int maxPendingMessagesAcrossPartitions); + + /** + * @return the maximum number of pending messages allowed across all the partitions + */ + int getMaxPendingMessagesAcrossPartitions() const; + + /** + * Set the message routing modes for partitioned topics. + * + * Default: UseSinglePartition + * + * @param PartitionsRoutingMode partition routing mode. + * @return + */ + ProducerConfiguration& setPartitionsRoutingMode(const PartitionsRoutingMode& mode); + + /** + * The getter associated with setPartitionsRoutingMode(). + */ + PartitionsRoutingMode getPartitionsRoutingMode() const; + + /** + * Set a custom message routing policy by passing an implementation of MessageRouter. + * + * @param messageRouter message router. + * @return + */ + ProducerConfiguration& setMessageRouter(const MessageRoutingPolicyPtr& router); + + /** + * The getter associated with setMessageRouter(). + */ + const MessageRoutingPolicyPtr& getMessageRouterPtr() const; + + /** + * Set the hashing scheme, which is a standard hashing function available when choosing the partition + * used for a particular message. + * + * Default: HashingScheme::BoostHash + * + * <p>Standard hashing functions available are: + * <ul> + * <li>{@link HashingScheme::JavaStringHash}: Java {@code String.hashCode()} (Default). + * <li>{@link HashingScheme::BoostHash}: Use [Boost hashing + * function](https://www.boost.org/doc/libs/1_72_0/doc/html/boost/hash.html). + * <li>{@link HashingScheme::Murmur3_32Hash}: Use [Murmur3 hashing + * function](https://en.wikipedia.org/wiki/MurmurHash"). + * </ul> + * + * @param scheme hashing scheme. + * @return + */ + ProducerConfiguration& setHashingScheme(const HashingScheme& scheme); + + /** + * The getter associated with setHashingScheme(). + */ + HashingScheme getHashingScheme() const; + + /** + * This config affects producers of partitioned topics only. It controls whether + * producers register and connect immediately to the owner broker of each partition + * or start lazily on demand. The internal producer of one partition is always + * started eagerly, chosen by the routing policy, but the internal producers of + * any additional partitions are started on demand, upon receiving their first + * message. + * Using this mode can reduce the strain on brokers for topics with large numbers of + * partitions and when the SinglePartition routing policy is used without keyed messages. + * Because producer connection can be on demand, this can produce extra send latency + * for the first messages of a given partition. + * @param true/false as to whether to start partition producers lazily + * @return + */ + ProducerConfiguration& setLazyStartPartitionedProducers(bool); + + /** + * The getter associated with setLazyStartPartitionedProducers() + */ + bool getLazyStartPartitionedProducers() const; + + /** + * The setter associated with getBlockIfQueueFull() + */ + ProducerConfiguration& setBlockIfQueueFull(bool); + + /** + * @return whether Producer::send or Producer::sendAsync operations should block when the outgoing message + * queue is full. (Default: false) + */ + bool getBlockIfQueueFull() const; + + // Zero queue size feature will not be supported on consumer end if batching is enabled + + /** + * Control whether automatic batching of messages is enabled or not for the producer. + * + * Default: true + * + * When automatic batching is enabled, multiple calls to Producer::sendAsync can result in a single batch + * to be sent to the broker, leading to better throughput, especially when publishing small messages. If + * compression is enabled, messages are compressed at the batch level, leading to a much better + * compression ratio for similar headers or contents. + * + * When the default batch delay is set to 10 ms and the default batch size is 1000 messages. + * + * @see ProducerConfiguration::setBatchingMaxPublishDelayMs + * + */ + ProducerConfiguration& setBatchingEnabled(const bool& batchingEnabled); + + /** + * Return the flag whether automatic message batching is enabled or not for the producer. + * + * @return true if automatic message batching is enabled. Otherwise it returns false. + * @since 2.0.0 <br> + * It is enabled by default. + */ + const bool& getBatchingEnabled() const; + + /** + * Set the max number of messages permitted in a batch. <i>Default value: 1000.</i> If you set this option + * to a value greater than 1, messages are queued until this threshold is reached or batch interval has + * elapsed. + * + * All messages in a batch are published as + * a single batch message. The consumer is delivered individual messages in the batch in the same + * order they are enqueued. + * @param batchMessagesMaxMessagesPerBatch max number of messages permitted in a batch + * @return + */ + ProducerConfiguration& setBatchingMaxMessages(const unsigned int& batchingMaxMessages); + + /** + * The getter associated with setBatchingMaxMessages(). + */ + const unsigned int& getBatchingMaxMessages() const; + + /** + * Set the max size of messages permitted in a batch. + * <i>Default value: 128 KB.</i> If you set this option to a value greater than 1, + * messages are queued until this threshold is reached or + * batch interval has elapsed. + * + * <p>All messages in a batch are published as a single batch message. + * The consumer is delivered individual + * messages in the batch in the same order they are enqueued. + * + * @param batchingMaxAllowedSizeInBytes + */ + ProducerConfiguration& setBatchingMaxAllowedSizeInBytes( + const unsigned long& batchingMaxAllowedSizeInBytes); + + /** + * The getter associated with setBatchingMaxAllowedSizeInBytes(). + */ + const unsigned long& getBatchingMaxAllowedSizeInBytes() const; + + /** + * Set the max time for message publish delay permitted in a batch. + * <i>Default value: 10 ms.</i> + * + * @param batchingMaxPublishDelayMs max time for message publish delay permitted in a batch. + * @return + */ + ProducerConfiguration& setBatchingMaxPublishDelayMs(const unsigned long& batchingMaxPublishDelayMs); + + /** + * The getter associated with setBatchingMaxPublishDelayMs(). + */ + const unsigned long& getBatchingMaxPublishDelayMs() const; + + /** + * Default: DefaultBatching + * + * @see BatchingType + */ + ProducerConfiguration& setBatchingType(BatchingType batchingType); + + /** + * @return batching type. + * @see BatchingType. + */ + BatchingType getBatchingType() const; + + /** + * The getter associated with setCryptoKeyReader(). + */ + const CryptoKeyReaderPtr getCryptoKeyReader() const; + + /** + * Set the shared pointer to CryptoKeyReader. + * + * @param shared pointer to CryptoKeyReader. + * @return + */ + ProducerConfiguration& setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader); + + /** + * The getter associated with setCryptoFailureAction(). + */ + ProducerCryptoFailureAction getCryptoFailureAction() const; + + /** + * Sets the ProducerCryptoFailureAction to the value specified. + * + * @param action + * the action taken by the producer in case of encryption failures. + * @return + */ + ProducerConfiguration& setCryptoFailureAction(ProducerCryptoFailureAction action); + + /** + * @return all the encryption keys added + */ + const std::set<std::string>& getEncryptionKeys() const; + + /** + * @return true if encryption keys are added + */ + bool isEncryptionEnabled() const; + + /** + * Add public encryption key, used by producer to encrypt the data key. + * + * At the time of producer creation, Pulsar client checks if there are keys added to encryptionKeys. If + * keys are found, a callback getKey(String keyName) is invoked against each key to load the values of the + * key. Application should implement this callback to return the key in pkcs8 format. If compression is + * enabled, message is encrypted after compression. If batch messaging is enabled, the batched message is + * encrypted. + * + * @key the encryption key to add + * @return the ProducerConfiguration self + */ + ProducerConfiguration& addEncryptionKey(std::string key); + + /** + * Check whether the producer has a specific property attached. + * + * @param name the name of the property to check + * @return true if the message has the specified property + * @return false if the property is not defined + */ + bool hasProperty(const std::string& name) const; + + /** + * Get the value of a specific property + * + * @param name the name of the property + * @return the value of the property or null if the property was not defined + */ + const std::string& getProperty(const std::string& name) const; + + /** + * Get all the properties attached to this producer. + */ + std::map<std::string, std::string>& getProperties() const; + + /** + * Sets a new property on the producer + * . + * @param name the name of the property + * @param value the associated value + */ + ProducerConfiguration& setProperty(const std::string& name, const std::string& value); + + /** + * Add all the properties in the provided map + */ + ProducerConfiguration& setProperties(const std::map<std::string, std::string>& properties); + + /** + * If message size is higher than allowed max publish-payload size by broker then enableChunking helps + * producer to split message into multiple chunks and publish them to broker separately in order. So, it + * allows client to successfully publish large size of messages in pulsar. + * + * Set it true to enable this feature. If so, you must disable batching (see setBatchingEnabled), + * otherwise the producer creation will fail. + * + * There are some other recommendations when it's enabled: + * 1. This features is right now only supported for non-shared subscription and persistent-topic. + * 2. It's better to reduce setMaxPendingMessages to avoid producer accupying large amount of memory by + * buffered messages. + * 3. Set message-ttl on the namespace to cleanup chunked messages. Sometimes due to broker-restart or + * publish time, producer might fail to publish entire large message. So, consumer will not be able to + * consume and ack those messages. + * + * Default: false + * + * @param chunkingEnabled whether chunking is enabled + * @return the ProducerConfiguration self + */ + ProducerConfiguration& setChunkingEnabled(bool chunkingEnabled); + + /** + * The getter associated with setChunkingEnabled(). + */ + bool isChunkingEnabled() const; + + /** + * Set the type of access mode that the producer requires on the topic. + * + * @see ProducerAccessMode + * @param accessMode + * The type of access to the topic that the producer requires + */ + ProducerConfiguration& setAccessMode(const ProducerAccessMode& accessMode); + + /** + * Get the type of access mode that the producer requires on the topic. + */ + ProducerAccessMode getAccessMode() const; + + friend class PulsarWrapper; + + private: + struct Impl; + std::shared_ptr<ProducerConfigurationImpl> impl_; +}; +} // namespace pulsar +#endif /* PULSAR_PRODUCERCONFIGURATION_H_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xaAACgkQT0AbyNP5 ++1WQBQ//Yolw0YZdD5tJ9DabBXgTeYTaGgJUBpgEW1CerxvpPU77JeOUToRh0LCV +o0v2GIzlDnNsbktLoBE9JD3vJJ3g37ZcKT0cOsgbKRxcwnIyzPO57z+YEKuFqFNH +QlkXexfCQMBtG9v1T+1ABHdLsa9s5SEujjlMyCfBmp7op5FnGQ1BkMJTsCmDAWca +0/PmodzNRSXPkY45G7IH7ukiYHyXprhfr5CHz8R6FtdpaYQySYIQHk+yD8XtoO27 +rEcsK2phTFvCLNtoNVGm25am52PJjho9+dS222e55cHPDT8ZK1qBQ/FFoiL2JF39 +e91wypBz7j8X9FnYRlBFDmkv1xyrHOY3mxPSM+ENCaSbo1dgNxL4hvdsyjS8iP1Q +U67tCxIlrqjg3u/8+W+N+H0wWLDeVWI1xGpfrS4CNdkOHDKSErikq5WdiDBbdTMj +ozz814b0mU6AGBS19pt7w/pyrYcFhEynfHizlH2hgq7ikemG8Fn8IjB9c+dpQahJ +mjnO94j7KhoFsgxeonWcL/6zYQkA9pAYdBJTuy+wyxQJBQ6ZWmVYyb9yLIB7tygY +7Snxj2bm7jEZ8+0trTbIGlajdXm/vqJbgWejvx4jQ33B8WCIV0ocwsa4jwGdbBYB +Dy/HqF0T3A+WElY5jjT4akKzBiXTgnL3Wxok6YASVdrSPQrrNf0= +=OvDz +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerConfiguration.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +cb7dc450ff1bc8e7732aee60080cd07e5b505e69c135dc8fd1d48f639160c57928bf93de1f053044867cd1f9fe8917f68aea9e8cd283b9434ae27213a48a0ab6 ./x64-windows-static/include/pulsar/ProducerConfiguration.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,32 @@ +/** + * 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 PRODUCERCRYPTOFAILUREACTION_H_ +#define PRODUCERCRYPTOFAILUREACTION_H_ + +namespace pulsar { + +enum class ProducerCryptoFailureAction +{ + FAIL, // This is the default option to fail send if crypto operation fails + SEND // Ignore crypto failure and proceed with sending unencrypted messages +}; + +} /* namespace pulsar */ + +#endif /* PRODUCERCRYPTOFAILUREACTION_H_ */ Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZcACgkQT0AbyNP5 ++1VEKg//R/JnA2ltkVy9phBZ99od+VcvF7uSEDcld3mbxj7smt6XGchvdsbYCE53 +B0kESB0spm+aLGMNEVxZ2RdTeKb3OF8V27r1bORR+nmJUC1J86yHZQPfe6sGCSV9 +NbzRBuSt+qjxtQSDdDUVrxpPPZu8cD3zpu4XKDq/DYzyO/1xzzINDEkzwUTJMOfH +KhVxlHjBnYuup6GzMTx4EvykD7kaO/0LBGGYyYq/yENXiHuL2Te4zOBr1z4xIUSZ +nA2AuOoxJtdcRBYJYRRE5BqbBhllhLTXr/dBlpW9jwxgDhg8d9wKInAVVU0vHLhE +1PFqQJFcf9uWjkLN+/+lSOqTc41ozAeJCdZI8zUEfN0ygj8AqHwGq0Qx5EcRT+1w +eMI7OArUJE6wRut/n2KoqIbuWwDqHmhQUUNl8Oo8PP0L5CB/0vm1AFzFUFG7mGsm +9JSuCqGcSaIiEKY3d6uMqlSUEcb35ZxhJMIg1/GDLFfYv00+YzwOAw1eEhj2s00B +dXf3GVmRgupZLnByvoSbFMKLiTeZ1eN60cWrkr3giEuClYFVWQGdh5NzRGquUAX2 +S4Rq4l25DJLyy9lacpJVydKZ3gadws0Tsrusny5QEjAhcTjXRFLvAokvKS6Tthc2 +wqiEQnEWgkVU3qOw54CmnBIbaZJYGtLLo8jdHHTsBCzs5OYA2Nw= +=sZYq +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6900be81109f868cc772ceec5580e11cf96dd70ff735736e64a96c39acc7c564237641fa74e9a31fd19d72d5fdfe6656fec37329eca4d2d690de5f084e78426b ./x64-windows-static/include/pulsar/ProducerCryptoFailureAction.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,35 @@ +/** + * 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 <google/protobuf/descriptor.h> +#include <pulsar/Schema.h> + +namespace pulsar { + +/** + * Create a protobuf native schema using a descriptor. + * + * @param descriptor the Descriptor object of the target class + * @return the protobuf native schema + * @throw std::invalid_argument if descriptor is nullptr + */ +PULSAR_PUBLIC SchemaInfo createProtobufNativeSchema(const google::protobuf::Descriptor* descriptor); + +} // namespace pulsar Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZoACgkQT0AbyNP5 ++1UHgRAApNCqfmPxi9c5nKHACXZHRkydQJjT8+rgyCMXYgli6XKs/gja1Wrhkuis +gY07K1VmXNNkd0ymxELLX8x1q4zfDOsgyRYWv6RGwz29SYlHJX5iu0+EU5QgK3My +RGLR1oc4z1ZYrNwO4hZJjhKGKDf3dEj8uhSLr83JbeKQQtJtRwDkNE2CSzekeUhX +93GHHDYKMyWXqCeZWmTq20RR6+EEmRL+jabnMgqVMsL/3nd5yf0YceGgBOJkC2Bc +HMbuMmsRSj/tZmeo19aekgz2Tqw8/t6vL8MrDlQhEf/fdiOkxewm0EyNxcpb5MhZ +1Tq2Lx7JksjByls+DjTgeeEZBs5R/NnTqNb1ya2tuz1CZxm6kjPpBy/nTgMsTskN +/kZ3DKRuWhMgq90s/DJZcrMddjcDtAgWTbcxnEF8ICBC0K8lpIWyS6SDJMwX+tsU +i/2qoAMv7Ln/m4ryXrJnj9aZOoXxJ7C6GOeSgMMelvtUV70lZ6u6V1cusFJ4Ni85 +/AcOj54FLX38NX8Wv2uCAnKtXwEmHpkfgol/WBg26GWcpV/pwfIb4647uVKg24yt +RzQloOt8rBXOgcQy88lnZe1c75t59l/6ZwEr5T7wll1lwytZRuigpbCzG7ktZRGn +6G9kN8bH+7irWk+30YP4MTPlWowfryEp45FHuGmqJtkkdCEYQsk= +=ZLyk +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x64-windows-static/include/pulsar/ProtobufNativeSchema.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +5b179edf2f83ad52f2689e236e5d7cc22d1fdc5d8308cf7390b4ce071aed2749e087cbb5c6a2685dbbabc9937f797549177cadc5a9e1f246488d2cf3b922a338 ./x64-windows-static/include/pulsar/ProtobufNativeSchema.h
