pulsar-client-cpp
Classes | Typedefs | Enumerations | Functions
pulsar Namespace Reference

Classes

class  AuthAthenz
 
class  AuthBasic
 
class  Authentication
 
class  AuthenticationDataProvider
 
class  AuthFactory
 
class  AuthOauth2
 
class  AuthTls
 
class  AuthToken
 
class  BatchReceivePolicy
 
class  BrokerConsumerStats
 
class  CachedToken
 
class  Client
 
class  ClientConfiguration
 
class  ConsoleLoggerFactory
 
class  Consumer
 
class  ConsumerConfiguration
 
class  ConsumerEventListener
 
class  ConsumerInterceptor
 
class  CryptoKeyReader
 
class  DeadLetterPolicy
 
class  DeadLetterPolicyBuilder
 
class  DefaultCryptoKeyReader
 
class  DeprecatedException
 
class  EncryptionKeyInfo
 
class  FileLoggerFactory
 
class  KeySharedPolicy
 
class  KeyValue
 
class  Logger
 
class  LoggerFactory
 
class  Message
 
class  MessageBatch
 
class  MessageBuilder
 
class  MessageId
 
class  MessageIdBuilder
 
class  MessageRoutingPolicy
 
class  Oauth2Flow
 
class  Oauth2TokenResult
 
class  Producer
 
class  ProducerConfiguration
 
class  ProducerInterceptor
 
class  Reader
 
class  ReaderConfiguration
 
class  SchemaInfo
 
class  TableView
 
struct  TableViewConfiguration
 
class  TopicMetadata
 
class  TypedMessage
 
class  TypedMessageBuilder
 
class  TypedMessageBuilder< std::string >
 

Typedefs

typedef std::shared_ptr< AuthenticationDataProviderAuthenticationDataPtr
 
typedef std::shared_ptr< AuthenticationAuthenticationPtr
 
typedef std::map< std::string, std::string > ParamMap
 
typedef std::function< std::string()> TokenSupplier
 
typedef std::shared_ptr< Oauth2TokenResultOauth2TokenResultPtr
 
typedef std::shared_ptr< Oauth2FlowFlowPtr
 
typedef std::shared_ptr< CachedTokenCachedTokenPtr
 
typedef std::function< void(Result result, BrokerConsumerStats brokerConsumerStats)> BrokerConsumerStatsCallback
 
typedef std::function< void(Result, Producer)> CreateProducerCallback
 
typedef std::function< void(Result, Consumer)> SubscribeCallback
 
typedef std::function< void(Result, Reader)> ReaderCallback
 
typedef std::function< void(Result, TableView)> TableViewCallback
 
typedef std::function< void(Result, const std::vector< std::string > &)> GetPartitionsCallback
 
typedef std::function< void(Result)> CloseCallback
 
typedef std::shared_ptr< ConsumerImplBase > ConsumerImplBasePtr
 
typedef std::vector< MessageMessages
 Callback definition for non-data operation.
 
typedef std::function< void(Result result)> ResultCallback
 Callback definition for non-data operation.
 
typedef std::function< void(Result, const Message &msg)> ReceiveCallback
 
typedef std::function< void(Result, const Messages &msgs)> BatchReceiveCallback
 
typedef std::function< void(Result result, MessageId messageId)> GetLastMessageIdCallback
 
typedef std::function< void(Consumer &consumer, const Message &msg)> MessageListener
 Callback definition for MessageListener.
 
typedef std::shared_ptr< ConsumerEventListenerConsumerEventListenerPtr
 
typedef std::shared_ptr< ConsumerInterceptorConsumerInterceptorPtr
 
typedef std::shared_ptr< CryptoKeyReaderCryptoKeyReaderPtr
 
typedef std::shared_ptr< EncryptionKeyInfoImpl > EncryptionKeyInfoImplPtr
 
typedef std::pair< int, int > StickyRange
 
typedef std::vector< StickyRange > StickyRanges
 
typedef std::vector< MessageIdMessageIdList
 
typedef std::shared_ptr< MessageRoutingPolicyMessageRoutingPolicyPtr
 
typedef std::function< void(Result)> FlushCallback
 
typedef std::shared_ptr< ProducerImplBase > ProducerImplBasePtr
 
typedef std::function< void(Result, const MessageId &messageId)> SendCallback
 
typedef std::shared_ptr< ProducerInterceptorProducerInterceptorPtr
 
typedef std::function< void(Result result, bool hasMessageAvailable)> HasMessageAvailableCallback
 
typedef std::function< void(Result result, const Message &message)> ReadNextCallback
 
typedef std::function< void(Reader reader, const Message &msg)> ReaderListener
 Callback definition for MessageListener.
 
typedef std::map< std::string, std::string > StringMap
 
typedef std::function< void(const std::string &key, const std::string &value)> TableViewAction
 
using BytesMessageBuilder = TypedMessageBuilder< std::string >
 

Enumerations

enum  CompressionType {
  CompressionNone = 0, CompressionLZ4 = 1, CompressionZLib = 2, CompressionZSTD = 3,
  CompressionSNAPPY = 4
}
 
enum  ConsumerCryptoFailureAction { FAIL, DISCARD, CONSUME }
 
enum  ConsumerType { ConsumerExclusive, ConsumerShared, ConsumerFailover, ConsumerKeyShared }
 
enum  InitialPosition { InitialPositionLatest, InitialPositionEarliest }
 
enum  KeySharedMode { AUTO_SPLIT = 0, STICKY = 1 }
 
enum  ProducerCryptoFailureAction { FAIL, SEND }
 
enum  RegexSubscriptionMode { PersistentOnly = 0, NonPersistentOnly = 1, AllTopics = 2 }
 
enum  Result {
  ResultRetryable = -1, ResultOk = 0, ResultUnknownError, ResultInvalidConfiguration,
  ResultTimeout, ResultLookupError, ResultConnectError, ResultReadError,
  ResultAuthenticationError, ResultAuthorizationError, ResultErrorGettingAuthenticationData, ResultBrokerMetadataError,
  ResultBrokerPersistenceError, ResultChecksumError, ResultConsumerBusy, ResultNotConnected,
  ResultAlreadyClosed, ResultInvalidMessage, ResultConsumerNotInitialized, ResultProducerNotInitialized,
  ResultProducerBusy, ResultTooManyLookupRequestException, ResultInvalidTopicName, ResultInvalidUrl,
  ResultServiceUnitNotReady, ResultOperationNotSupported, ResultProducerBlockedQuotaExceededError, ResultProducerBlockedQuotaExceededException,
  ResultProducerQueueIsFull, ResultMessageTooBig, ResultTopicNotFound, ResultSubscriptionNotFound,
  ResultConsumerNotFound, ResultUnsupportedVersionError, ResultTopicTerminated, ResultCryptoError,
  ResultIncompatibleSchema, ResultConsumerAssignError, ResultCumulativeAcknowledgementNotAllowedError, ResultTransactionCoordinatorNotFoundError,
  ResultInvalidTxnStatusError, ResultNotAllowedError, ResultTransactionConflict, ResultTransactionNotFound,
  ResultProducerFenced, ResultMemoryBufferIsFull, ResultInterrupted, ResultDisconnected
}
 
enum  KeyValueEncodingType { KeyValueEncodingType::SEPARATED, KeyValueEncodingType::INLINE }
 
enum  SchemaType {
  NONE = 0, STRING = 1, JSON = 2, PROTOBUF = 3,
  AVRO = 4, INT8 = 6, INT16 = 7, INT32 = 8,
  INT64 = 9, FLOAT = 10, DOUBLE = 11, KEY_VALUE = 15,
  PROTOBUF_NATIVE = 20, BYTES = -1, AUTO_CONSUME = -3, AUTO_PUBLISH = -4
}
 

Functions

PULSAR_PUBLIC SchemaInfo createProtobufNativeSchema (const google::protobuf::Descriptor *descriptor)
 
const PULSAR_PUBLIC char * strResult (Result result)
 
PULSAR_PUBLIC std::ostream & operator<< (std::ostream &s, pulsar::Result result)
 
const PULSAR_PUBLIC char * strEncodingType (pulsar::KeyValueEncodingType encodingType)
 
PULSAR_PUBLIC KeyValueEncodingType enumEncodingType (std::string encodingTypeStr)
 
const PULSAR_PUBLIC char * strSchemaType (SchemaType schemaType)
 
PULSAR_PUBLIC SchemaType enumSchemaType (std::string schemaTypeStr)
 

Detailed Description

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.

Enumeration Type Documentation

◆ ConsumerType

Enumerator
ConsumerExclusive 

There can be only 1 consumer on the same topic with the same consumerName

ConsumerShared 

Multiple consumers will be able to use the same consumerName and the messages will be dispatched according to a round-robin rotation between the connected consumers

ConsumerFailover 

Only one consumer is active on the subscription; Subscription can have N consumers connected one of which will get promoted to master if the current master becomes inactive

ConsumerKeyShared 

Multiple consumer will be able to use the same subscription and all messages with the same key will be dispatched to only one consumer

◆ KeySharedMode

KeyShared mode of KeyShared subscription.

Enumerator
AUTO_SPLIT 

Auto split while new consumer connected.

STICKY 

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.

◆ KeyValueEncodingType

Encoding types of supported KeyValueSchema for Pulsar messages.

Enumerator
SEPARATED 

Key is stored as message key, while value is stored as message payload.

INLINE 

Key and value are stored as message payload.

◆ RegexSubscriptionMode

Enumerator
PersistentOnly 

Only subscribe to persistent topics.

NonPersistentOnly 

Only subscribe to non-persistent topics.

AllTopics 

Subscribe to both persistent and non-persistent topics.

◆ Result

Collection of return codes

Enumerator
ResultOk 

An internal error code used for retry.

ResultUnknownError 

Operation successful.

ResultInvalidConfiguration 

Unknown error happened on broker.

ResultTimeout 

Invalid configuration.

ResultLookupError 

Operation timed out.

ResultConnectError 

Broker lookup failed.

ResultReadError 

Failed to connect to broker.

ResultAuthenticationError 

Failed to read from socket.

ResultAuthorizationError 

Authentication failed on broker.

ResultErrorGettingAuthenticationData 

Client is not authorized to create producer/consumer.

ResultBrokerMetadataError 

Client cannot find authorization data.

ResultBrokerPersistenceError 

Broker failed in updating metadata.

ResultChecksumError 

Broker failed to persist entry.

ResultConsumerBusy 

Corrupt message checksum failure.

ResultNotConnected 

Exclusive consumer is already connected.

ResultAlreadyClosed 

Producer/Consumer is not currently connected to broker.

ResultInvalidMessage 

Producer/Consumer is already closed and not accepting any operation.

ResultConsumerNotInitialized 

Error in publishing an already used message.

ResultProducerNotInitialized 

Consumer is not initialized.

ResultProducerBusy 

Producer is not initialized.

ResultTooManyLookupRequestException 

Producer with same name is already connected.

ResultInvalidTopicName 

Too Many concurrent LookupRequest.

ResultInvalidUrl 

Invalid topic name.

ResultServiceUnitNotReady 

Client Initialized with Invalid Broker Url (VIP Url passed to Client Constructor)

ResultOperationNotSupported 

Service Unit unloaded between client did lookup and producer/consumer got created

ResultProducerBlockedQuotaExceededException 

Producer is blocked.

ResultProducerQueueIsFull 

Producer is getting exception.

ResultMessageTooBig 

Producer queue is full.

ResultTopicNotFound 

Trying to send a messages exceeding the max size.

ResultSubscriptionNotFound 

Topic not found.

ResultConsumerNotFound 

Subscription not found.

ResultUnsupportedVersionError 

Consumer not found.

ResultTopicTerminated 

Error when an older client/version doesn't support a required feature.

ResultCryptoError 

Topic was already terminated.

ResultIncompatibleSchema 

Error when crypto operation fails.

ResultConsumerAssignError 

Specified schema is incompatible with the topic's schema.

ResultCumulativeAcknowledgementNotAllowedError 

Error when a new consumer connected but can't assign messages to this consumer

ResultTransactionCoordinatorNotFoundError 

Not allowed to call cumulativeAcknowledgement in Shared and Key_Shared subscription mode

ResultInvalidTxnStatusError 

Transaction coordinator not found.

ResultNotAllowedError 

Invalid txn status error.

ResultTransactionConflict 

Not allowed.

ResultTransactionNotFound 

Transaction ack conflict.

ResultProducerFenced 

Transaction not found.

ResultMemoryBufferIsFull 

Producer was fenced by broker.

ResultInterrupted 

Client-wide memory limit has been reached.

ResultDisconnected 

Interrupted while waiting to dequeue.

◆ SchemaType

Enumerator
NONE 

No schema defined

STRING 

Simple String encoding with UTF-8

JSON 

JSON object encoding and validation

PROTOBUF 

Protobuf message encoding and decoding

AVRO 

Serialize and deserialize via Avro

INT8 

A 8-byte integer.

INT16 

A 16-byte integer.

INT32 

A 32-byte integer.

INT64 

A 64-byte integer.

FLOAT 

A float number.

DOUBLE 

A double number

KEY_VALUE 

A Schema that contains Key Schema and Value Schema.

PROTOBUF_NATIVE 

Protobuf native schema based on Descriptor.

BYTES 

A bytes array.

AUTO_CONSUME 

Auto Consume Type.

AUTO_PUBLISH 

Auto Publish Type.

Function Documentation

◆ createProtobufNativeSchema()

PULSAR_PUBLIC SchemaInfo pulsar::createProtobufNativeSchema ( const google::protobuf::Descriptor *  descriptor)

Create a protobuf native schema using a descriptor.

Parameters
descriptorthe Descriptor object of the target class
Returns
the protobuf native schema
Exceptions
std::invalid_argumentif descriptor is nullptr