Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h Wed Nov 23 09:18:55 2022 @@ -0,0 +1,109 @@ +/** + * 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 <utility> +#include <vector> + +namespace pulsar { + +/** + * KeyShared mode of KeyShared subscription. + */ +enum KeySharedMode +{ + + /** + * Auto split while new consumer connected. + */ + AUTO_SPLIT = 0, + + /** + * New consumer with fixed hash range to attach the topic, if new consumer use conflict hash range with + * exits consumers, new consumer will be rejected. + */ + STICKY = 1 +}; + +struct KeySharedPolicyImpl; + +typedef std::pair<int, int> StickyRange; +typedef std::vector<StickyRange> StickyRanges; + +class PULSAR_PUBLIC KeySharedPolicy { + public: + KeySharedPolicy(); + ~KeySharedPolicy(); + + KeySharedPolicy(const KeySharedPolicy&); + KeySharedPolicy& operator=(const KeySharedPolicy&); + + /** + * Create a new instance of KeySharedPolicy with the same + * initial settings as the current one. + */ + KeySharedPolicy clone() const; + + /** + * Configure the KeyShared mode of KeyShared subscription + * + * @param KeyShared mode + * @see {@link #KeySharedMode} + */ + KeySharedPolicy& setKeySharedMode(KeySharedMode keySharedMode); + + /** + * @return the KeySharedMode of KeyShared subscription + */ + KeySharedMode getKeySharedMode() const; + + /** + * If it is enabled, it relaxes the ordering requirement and allows the broker to send out-of-order + * messages in case of failures. This makes it faster for new consumers to join without being stalled by + * an existing slow consumer. + * + * In this case, a single consumer still receives all keys, but they may come in different orders. + * + * @param allowOutOfOrderDelivery + * whether to allow for out of order delivery + */ + KeySharedPolicy& setAllowOutOfOrderDelivery(bool allowOutOfOrderDelivery); + + /** + * @return true if out of order delivery is enabled + */ + bool isAllowOutOfOrderDelivery() const; + + /** + * @param ranges used with sticky mode + */ + KeySharedPolicy& setStickyRanges(std::initializer_list<StickyRange> ranges); + + /** + * @return ranges used with sticky mode + */ + StickyRanges getStickyRanges() const; + + private: + std::shared_ptr<KeySharedPolicyImpl> impl_; +}; +} // namespace pulsar
Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZIACgkQT0AbyNP5 ++1VuLRAAoUquJ/7gdjJoahXAs8p45vjoIDPI9DFUrcnA0szbbvj1o3j+ZiKUz/Eo +VS655jJKH0dbinHirBfuONTAPHBm1zZs8xoJ52Qib3NkVMGPNTGFv3F3io09tTP0 +Fe7n/m2rTZnOrLi0w3TKW0QVCq2VBWn/MZ5gHkbLaRbLTJtevTvd7CRPXQTNMu++ +hIK7tNWvs974vyDIQL29Y1z/5HKkh3bnklPR+Hay4LKX08kG0gkoiuPCN27lw6U2 +ZE84HLbWnZzCF+pMt5TSXEg2SglATYLgSR9ZcUwo54E9r0GA1gzqg22vsUN2W1ja +ey9jgsUBMS0QXIsCXxDo3lmu0ynFT4KtVHqrDihn9pLeW/eAv1EkskbmVIMHi8+4 +xrHQwed1LGZkHFx+gtwu7bbqD8QWG9sH0UUxjFQEM2K9ryAmvjqxEfXHUUwHSJdo +/Pbn00XPRcNWzaniTqvQCMqBYD+L+RjuKSvyHinqiepzPQ57jZ6jozqzeNYh62/D +FQtvZhMNuAEE6d5xaONKlP8H00aDtCGroLR+/QWEjRIU/N6M+MfjR9FMLeljJuPF +FoaoLcg9O0xdHPXUeM67+p0mRPu3bVqcN39leFQGEsBkm3d3ylIgErIkI59go32N +67G/SJHqPIcf+37S+wtwdhOFFdnwvV6z8vMB/ZlR2TD6lHrxhBs= +=LEPF +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeySharedPolicy.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +fafe096a436afc45f0fd5b25abf1f59aa1a55b6c9b7dbefc2666f1e156d0839c902661f8b301a49e0be3b2153aeb20fa9c803f3c15d1eb2650983ef6d1ef3ce1 ./x86-windows-static/include/pulsar/KeySharedPolicy.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/KeyValue.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYgACgkQT0AbyNP5 ++1UqKQ/+M/2EQjmPyU7e+ZragdZEXPaMYJXtycrPChdIDu5Apd3YCPYN6JeESZUj +au3ba99by7MJlVghx8ERm9lSM1ujGDjKDJwo8FTzpA9Hzrwh4nA0UIjUB9ELUwW8 +N2sUIrKzWdDLWyQW1fmtHoLFZiTmvivorjjlUwRobikgkok1sFecqpiM4MqzgsGF +tI3COdNT46UccE1Jxkm9wmBAeNqh7WXHGt5IGOxtWLqxvLMkMDGL+wbFzH9mJV+B +JrGj4vddn+sErCbbpfL1vZdjJrB6i3AMc2g8f4NHUUvDyYO/BkfhiWEcTbi/H1d+ +X8ZZd/RCDII+FARNj5Z2i7cnU7pnMGEnXqllYc2QGnzc3Sc9P1K7OcfrybvXhGid +FaC7bJSfCaTdx6Iy2GXs9uSOtFrZvk7Dg9mfMSatV/FID8wewo7sYBQMYQuho3qB +JxS7bmCIIY/9PgjTB4gwNOJ4enoURhCrWt2ZTL95tT2Yb+9hBvnygYnC0Ee/Epah +s97w9/0ny+czPraIkiB6zXUggNtqDfYC5NpHvL4STbZkrNxKUxDv8YUhThCtCwJu +obXcsrLwOYLNIHC/km1Aq76oML9tTA2Kx5IVpHxCcLuRdj5zkU8RJf/CiXEGXPIU +8wO5nCqvetBQh3LFi3UoExvxFEvvDGzjiRsR2XNHLpSxjNwTKEI= +=fPBa +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/KeyValue.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6586d55519400fd64482b0221b74fe361347018d64a3faef9243c274980edc9a39cbc57eaafc506e070607dcb52557c0e7e55930790bbe45678dbb33e7e3cc88 ./x86-windows-static/include/pulsar/KeyValue.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/Logger.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xY4ACgkQT0AbyNP5 ++1U13A//XnlbcJkUCJHRODk/mUlAqPXRTIUp2DU2Y9fiyiNHcRsHJY3jDv+4RtSR +sNzm66ona2Ka2a8hzUI3kq6TY7oomjqs2SJsS9ZgLHMITaiEn+HQaJVDeoE9aJeh +7N7CrWkP56AD+JKJRGZBEF5ooEPqeJhByiWkLZxudzoJ+ZoVy+ZRerPlxVeWwuaC +bSm89tM0lw8KlttxFJ2JkPWQqcWq0QRTRE0EfgnWg+WWPf0hr5tOCyVAUzHWoL5O +9xqCyVkNhsG6gL77jfX5s6yG608NQi9nCLXHoE2ziaQFBHYq75Ggl3T5BNQt+FEu +Nk4ik7boHGZxUVm3OdjUgmM4AxvvWAYZMgLmOzRkmzsLMw2BTS3PvKEebku5M0bk +aWaUpA8peUoVb6bMfo3A8849/Zpi89S6wv+T1NGJwKGyCFEJABvRCtdFujPkvPeU +mkskJFzval76QDnvktk5BSqJCH/ED3rIiZCm8NbzyufwCy7ScQRecGBVXazVBF9n +oq8JdAkVEYXs3so2E3iYc4tlI/zQMIRiJyFqIUAUWE1PnyuPOjFmQ50rqxuak2ms +tWK0+YBHQBxLRFX9CxRYbegu5Vnh9tLyKG+t4O9FO81eKwJevoIS5t3XG+BriHk9 +qcSBpQt2HTz2EkQxhrOs2BH9k8CrrWnCQrMLwjyNBRCUhFA33Ic= +=ZtWh +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Logger.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +50af93256fc4428b20d40565d706f4bc276948a7901c6c3c9e30651fe1dbbfed8ef18415d34a32f77397dc9fd5f979f4e7a680ebe89d69e6e9b1f3c4c845c70b ./x86-windows-static/include/pulsar/Logger.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/Message.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYsACgkQT0AbyNP5 ++1UFYQ//dGsAub+iiny0UB4sVP+e/12G2d5TytcKorXXWymSgVPu8rM1Qj1Qbcnf +oVxC8zy/PBRYdA7a6MWhTZsQj4vOLOC5NmFHquLt8pSMnO3a2pCpY5qbeYC4r9xP +GL+nouDlfWmAGWtT3IyPrUO6I6DS8xPcf8/l9ngy6stOKTSMm+pgTEWnmispEzYS +o3m8hazfbeUI6Y0umoHJ9dsDotzxAOaztvGZ7dwuJ2FKb9Jqz///t2YYEUsbiHLc +Lhx8/oYFYbb9BYlE1jNF/ULDQyMYMm4iOwrR05R6Rd2bzP6RNxVEmkuNjc7TnQfA +fpoLvshaqitSi4KqvdM8AYweyJGqc/gRUx2YrjGtg4e8gQGsfK0IBLwOHhQelgUX +9cYs4LNgwnCOaEpt1Avj6MIgHcQlpJj5sjFKxU07X6E1yXh0HZ72xEnW/frVhQam +mbgq4u35EXdrSzEBVrgHiCxY/y0ZQUMPBCmrdMqi+nUQTCMwfZHBImXnqUfB1a7A +sij0mhfwYPLqFNew5EH5uyjYfAdGSqbj2HlGyeJqgEo8WVf5Uf8hTUAtwQgZcFL4 +o1gI49auLSHo0zVq4ICkuCsGKq2togj3wBFx1EZrTYiGtkytL5tXgoI5MPeT0BCl +udbTOnZNrkPcG0vkKUV91XNODze43UcBEc+Zcwc8/eCIBDH3534= +=Quiw +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Message.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +9cf64692cd5565122df15dad9c7bc3acfbb091db78c4caefeb9648de20f972dc6404181967c584df2ede495b5f7d0c563c94bde7bef6aa65bd7498fcec22d07f ./x86-windows-static/include/pulsar/Message.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/MessageBatch.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYwACgkQT0AbyNP5 ++1WmwRAAjsB3noCDKW0kjjj42RbllgjJoMWI5yClhLgGj5I0RkdFZTORxj0jmmH4 +SRgKqMWiKLKqLrN0vHutsFSJIuP7NG2xUS6rXRJYpEdLn3TWtK64+Wim6UvOimMK +odR0kDkouymomAlQ1a/Q2su3H8wlCN2d+eF/3NIwkzebQiuJABQGHIG0DRO+NGid +h4M1EHKvHCK6kNvQMVTOaKeq+6NZsmfAigR6H+LubDpiELWtQAE7YdWtPO4lK0fL +KyNn9XxAlMpgHHPtEsxoLWf/az+MT5EW55IpzUE2JO+hpFiUplTRARaupENI10tj +r7YRCllRyrB+E074b3zaQ4xyCT/4HkuDyBo90mVpwFmdwFd+/kIjt3STCUXiwwWv +1G7liRInRJOU0YK4MkXhvERwQP2jjTaiFrhWbLUcBviDn5bzyoxzARiO66JWtwGV +PsBMsm8SOZ6EoB7BRF0uqOfs8wgIwhdn4kO/RqsbXxUDROjsoTZE3PCyjTnOQ0c1 +amT/Bd+2vaNUPgpTg1Q9P3rITkJUe1K6dQkY+5xSbAvH1yOAlAiQUpZUXU4nqWpF +rN78kQrfmjIFd+3NVG60tpBBZbq5KiB3+sChdqrKWLnPW7DIea0dCZRfVDpiJHLo +Z6i/roJUgzfR7aFxzWQXOgAY8Ue2zMtTtkH1p5kMjWzdCH9zM/Y= +=tm0W +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBatch.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6c1164a0f5d37a1d5b8a372d9dd85273e61d1ddd132d47d4e2b4a43d05d9140b8b3465174403348c5c5b01bae8888bfb6025ce4429b51ecaa030c8a8e04a554f ./x86-windows-static/include/pulsar/MessageBatch.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/MessageBuilder.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYsACgkQT0AbyNP5 ++1X+Xg//VkMdH4DxC5DBfKwtNkwVrI0MJQsIvM8SIMnR6DA/eDIaexr3PoU3RfQF +0MDmeoa8WKFcP/FlhrrN6cZjf+tQZH6yaGf2kXGYxLNtsjcTAU8X0jTZ9RKPHDUd +b1noHTi+cSorHtpkTqoNVVRw/KqivePfnqJn51Cy57XWU8iErDyQG29xYALZ8KgP +pUupp2U+5YI9ZqH8mY6ZPb2X1Oa3qTcvds6dpbObDX9hzw9Gbq076hFDm3UdkD2A +tiQY6DN6OsJEHxEl6KuEQkjGK6sb190L2c1n2i2iu9cwtoXS9bgPmtmO7tEMlUEL +4U2LmVFT5gItCIKo38DnpH6YYzq1URdXld9lHtUWvsA6Fxix4qG4/jiWh+d9v9Rk +Ctnd/ejwUCOdquelvtzGg9mfBy2fWwgJ+eTZISVms+Hhjw5HL1svendMLe3KYCZA +lbLdWy6FAwc/NsytQKDjhcKAC26LfMxBmRCoiBc1rx5Azzm9kpXiNwywxYzsTaEu +KyRExoljZ9ba8yFtdcvXOzUxd/mF1HJQ1mJI5M2aTokEQIElQ/jL3cDyeUMWtT+z +U3l57ELu0s9QHUCA+UL2PPPiqGNlL8lMKYM4zQgqCZ9ckHcAcj9XZJgj0FDcQ0/K +RjdCZE81idMRROvsaHICue1K7IU7XkzlQA+v66M6PKI4got4kYs= +=bXw2 +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageBuilder.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +f7a06413f310faae64943df25cf751fd2b1b3ee583fcb1253e6b3e97ab372f2930577301337a2767cfb0a6b6bccc460b2d9ebba5c6d29541bd0dce69d84508c5 ./x86-windows-static/include/pulsar/MessageBuilder.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/MessageId.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xY4ACgkQT0AbyNP5 ++1UkgxAAhsEtpXDjUfzg8METv10VluO/k2pZnXAl/NhgVtttwHflJlLVzvEMDMDW +mqFLUBcGOScKrUnHd9dOfATIJiYUKLXKcS7/FwQViUZOLAjZ9+uSeeUEA9VYUqcW +k+ZHv76mVPbaFc+XBZPqQouxSy3IwiW1o5P5cEjUI27PEUxPKUd4ngrnEkIlnQIF +6whTeSlcgQAZCjyoByWpXEnTN3/ZB7gUrtOQb6rp2lNYiGhgr++L1J0o6eoHCOqW +1BljxClKQT/lFmThiFb9aP5kyRzF7zkLphyFEW05u6RZtkPb8IU5LxG0WlY3L0DO +JaETUSc7B2wZh1+MxU+1qjTMGBP4U7F/zgoNIbSXfoxnCtgOyzQhMDM6IRAxqvUG +4pMk45vSWZspxTMSVD5CeenPmomOlQyfc+fwbruwQqvqVzdyKZFfFSH0wVQwPiN6 +JFTKZVNJw/Uy5ODyRxpzrJt+T7gZuo0as1eCM26RoEFznHoIKXLxu9xaArvyttxo +rVeaMGVygQLTxKfy0Su50bCajk4zaCRaFb+mDuauhfY38qgXIlreBm8C7xXPFlBE +5t8BXAcC8OGZQJmQ27DPEUTuUNQDhqKIpWg2L9mCMIgcbH89RJiGLWN5f15gi1u+ +EcUS7gG4W4/On6hSx433ABLndeYsLmAc61WStk2WpdLV4OQqeDQ= +=R0Y2 +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageId.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +c88b6b17f810131efc8917a88344ac8fbb4191e6999f753b2fb1a4e9e916bc73e8ccdea43d149d97343d6617e481fc06404971a81156ccb9b706d7f807449e5f ./x86-windows-static/include/pulsar/MessageId.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/MessageIdBuilder.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xY8ACgkQT0AbyNP5 ++1UDfw/9E96nS5zE7MpCmiElJdYBB8jmD4CIQtR2KjNb+a2rJp6qc+/5mojwG5UH +uxKPlLRCWzDcWDwRCGSfz60EdURf5b6FADR/tSExicnTtxrCyP5T/SOEsptfPjyN +mZFgEleHY6V4EJiY44AKcMfUsLHdBIVrCzAybB6cFCyKUcqB0Alo1jcdcWyn29fe +7BordghNzQtBk5MCgGnJcLH38Hm3mmKPKrw4mw9JCxE0CWG5twcRjOJwHXfMcj+b +7xJiFvDtv81f+L1l56fiFwzRbznwC9ELifYa82iJZmYlEdeWS68ZNFMr9+lBNqPF +nHC2sRVHa8y4NQRmJPeouquRhiPM+3fm4e4msNtMWrcviEw4DGyUooh0PeJEnRtO +rKWxn0Ka7iBXth0RaU+5r3eFWICCbpiVcLANCtHGSamQkiUUVbNAkl0ZZKLpciak +kMAqIHXAl5D+rurEft85xf2RXZARQhHS95leyxt8OSTPKS5LqvM/NkBOKA+gCwqz +/nkLju6C0dC3HjR0SHDdmPlfQwGjtrTGMosnX7vwLOkBYs2gFA1SPM8fYgh1Z/JO +d7mRRlc+YZyBFrQUdusCI5VgdvPotyV06pUgQkix9nT0rIwfsvxASEzFuLKXS4l9 +bGTSJvRm8kRv30HCvLmTs2uGXvAtCXEk/kB4XoKiAFlsaUqKI4s= +=oTVQ +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageIdBuilder.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +8a1f726bbd33759b4c773255038f10bedf86ba50dcd66993cbf20261d37a1545d07fdb9deeea7a93137b2d09ab01d18a13b09bd1fd0a7198d7eaf84c2f2171c3 ./x86-windows-static/include/pulsar/MessageIdBuilder.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYkACgkQT0AbyNP5 ++1WfTA//fvx8ma28eC17eI0wJmPnSZTOwX4EXt6o0E6AVm+9xHy8REkI4QMR7sED +kjl3ZMz4raCeiR/MdBOcli9Ik1Rj/4wmq6JHv+ZGb97ZM7CHFDXdslQIQXBWxNse +ot4BnfOkhcp9cPiTEt2hVWEDdBKMwDITZLzAyksNd6sSUpIGzCz6Poml4/655IAb +9XQSLtarlVIxeZzC2RB9IKGpcbqIns4MN3q0KySFuH8VYgoNHww9fC0umPfMfumt +WO5AhyjAotgctCUii7Uk2J5tDDUEYm1mnEY8qkCeSE/0FiPZol/GdfehmZmNGpjt +TX08I7teRMTA4Tl18csDbMgNXIR1Hdtx3YNxPz4rDl6sVorW3tt2MH/uGxLHOZtm +e0nqH8Pcw5geMPEDI0HEcRCHYSR9sTGmY6symf+x8Bbfl7+MuNN6liqW91MhVll8 +t8M8sK70vheEC8vaQgtVtoFfYoB5mnc8oxUqEAAkNg3gTMF8IsWX4lhBOVvrLJqm +CPevW47P8eTbIt4cFKBgt0FKJMze283Z6VZiMhxT9uk1yBb+mWPpyFbARtKMP2lc +mKp1pS7J0Sx51EGTHqj5guHRweM4zXeaepMFOZn9/H/cS5yBJsq6W9m3QQDybZSa +hgoOmMP7/VPj2q+6ow8w5JSdUsgFcg3kaevyvBwmqqU8zEy38a4= +=piz6 +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/MessageRoutingPolicy.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +6890205e620bc251913f782fc704486ddb0ef356d10e6b0a2370315dac928616828bb5758e3bf71cbbb8a724194165b625c844f0ff9162d57d75a0f7cc8c4f04 ./x86-windows-static/include/pulsar/MessageRoutingPolicy.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/Producer.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xY4ACgkQT0AbyNP5 ++1VvLw//QWYaoTv7HjkhIZ4+RpkH3bUIGp3a0QXRE1oRL6iKAS3GCcnaYu9Auuh5 +6Um0rwdbIBvJUce9a2i1Z2IRBAPYB0fBLjPyVT6jg9JwXDD9KmmG0CHSNWDa1u/d +vzqBjafRtvmRhEq4hHBcwdQIOpOGDf9dn0MDoXrs/apz4D/Xp6PsnjX2inUyS/JO +CQ5RDqxH2HMrcKHfvRn66bCY1RgAMGnPpgMfjf2xIIsII/vlc5AkHVGEKat580vr +ebrX/CByTDvIQu6XvFL5jN7zOLEgY5B3AiArDHb+rSKaQRD1lHEhlMro//wSC8ne ++7IIAB/N+YbeJy46VIWS6UkRbLPNUJN/M77a5NNdAcnzbNfJfXA5EtzZI0Xh65Nf +bmgr8CESXj/I/iJowF+mrctkXOfyK9Zi4/WigJ9Z4VWVWFly7O8F+nqHctwbupYA +YCeSWRDk29Btg7blV7NHD6UH6G0dtMCLEE7Vu514+KBS2ekYrd3SwI+L+RvSpavZ +vNNA3QFjMGpE7ONvw0KMQq6sPbOAG85guVlujhbYzPnOIOquW053asy/hfiiHyYE +J8jjwwkjqYOHHb6+kSzk8AwqiLmmMY7bqxB85R9zAeWRmkXlhrD0KZb4eQ4UDJ8B +iCNiyEegkZYJLMYspKoaCOENDYDx4/Y0KjiWXjpzMbLkZq8F3Os= +=Zy2T +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/Producer.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +18a796debc4ca8daf2a5159fccf0bb04706a56bfa7e9539689d5825084081151eb58d7407c1d14313ada78fc1a442a17750eb24ee8aa2ad12e42151b6ca7a50f ./x86-windows-static/include/pulsar/Producer.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/ProducerConfiguration.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xZIACgkQT0AbyNP5 ++1VElhAAhHxZIIuaDOlG6ihmWqsZt5ih3XkxTTeK8tPdTLI4xSXMpWYW1WiinKAG +rGS+PnxF6JID0oHnfk2kT3kTM6v7/nvPabhfvEHaPd79W1TDkcviJghcQQEesHgJ +heHzfI0mXwhClDLS40zCo2504EVNTCLFKOFAg6XbzOPR8f+tNdQw/hl+/jrx5Q0M +jdtuoMDzaqjkupQ24w9dqDZKvxCYRtyf5A85zgsopmCA8HTm0rHfJFvgpGc92iep +023Zv1nwhIQdBhUnz8w/UK4ITrMZznQ7k60TXiJMsEEu7Oduw3+PCz8rDoFSOIiN +YjWOro4/Wshr4RUfRIEX7SV1hgVMUSKUHujZ3MWJfOMIsMMwbrhtYdzRme1+nbPp +V4i4FeD1c/L/yIoi2QZuGYVkXRtOuFYjlylmtkZrx9oI+/p6e4aPDbdKQga5ESWD +L5ds6Us2BudcLl0Ci1WmHSz+ac97tEmSa7UBG2ZaMhAURRv/pUdSHH3Kd9kONb6X +s7OMR82BGC+XxXohIgQhcYlB7fQlU3+J0lgvGZUQP9mLnzEfdV7uXWetjIvP54iS +PiEKUpjAGlCEL6u4o4W/gzxlkHYYzTexdGM5nuop2UYmjsttvmd9LAAGD2OsFVDK +d7CB4bpuYYlyD49YDoC2djlvvo5tOGClHVAg0Hwcju7Pp4v85kI= +=Wkaj +-----END PGP SIGNATURE----- Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h.sha512 ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h.sha512 (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerConfiguration.h.sha512 Wed Nov 23 09:18:55 2022 @@ -0,0 +1 @@ +cb7dc450ff1bc8e7732aee60080cd07e5b505e69c135dc8fd1d48f639160c57928bf93de1f053044867cd1f9fe8917f68aea9e8cd283b9434ae27213a48a0ab6 ./x86-windows-static/include/pulsar/ProducerConfiguration.h Added: dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerCryptoFailureAction.h ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerCryptoFailureAction.h (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-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/x86-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc ============================================================================== --- dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc (added) +++ dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.1.0-candidate-1/x86-windows-static/include/pulsar/ProducerCryptoFailureAction.h.asc Wed Nov 23 09:18:55 2022 @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEE6ItqSN52cCOQDJEjT0AbyNP5+1UFAmN9xYoACgkQT0AbyNP5 ++1WJjg//bu2/qQtvEhWGdeqCsglUINrvoinB2G9LKJ7+dPlCE3wkZTSpqEiae7OF +S2uPANUdzBzyCTIH3Ufph1WpvrCZaupkO2yCg+Bf+uHvMlsd9qwYjQtTrvb0FD+6 +0snxeQbo4nBDOmlN55ysIA6qrEWKiGBYf9PRWRLDrdqGsdgVRraZTtR4Se0nnFCL +99pdzrIjdnLyPRcVTxw9qaizveuz5dr9bMZo1bK5EWNohAQqxX8dvFRy/Qxfi3Xz +PizGyvL3AygtO9P5EwY+qaK4ih4kGqnjY/aOAK8KzcHpxXxmXPPG5kJt7PbtWAIX +DAR/QxYZoAFlhYtcgGx+Ujm5dBg6SI3gxkvjrnkV6hmegOzSdDd2yM/owtqus0NZ +TBuZkAz30Jp5DiSpWIcaLAYa/y/pBDJ7u5L3qK4JZyalKdlUrnzRb2riMts4v7Fh +j4C/RIhFW5l9iMO5e4SZ+8hDYeUENEyDLdKq6bPYAY/YvknENfuOfzD/vHwUJtKy +WZGRzApnUvzKF6SAfNJcLimMZvsgpGNvdXMxkZ62v2rubvzogd1ehtKmnRy0XyvX +Pa7AXDLGEIn0yhnRc75sIX7YpaBH6gyZjQ02tbxzcvEDmKWBVPZo5knLrRH0/01J +5yhKrJ12MpISyKPajFttUynFJpJ9n6qFam2qcP74CYk5ZAMgMGg= +=cONh +-----END PGP SIGNATURE-----
