57 #ifdef LIBRDKAFKA_STATICLIB
60 #ifdef LIBRDKAFKACPP_EXPORTS
61 #define RD_EXPORT __declspec(dllexport)
63 #define RD_EXPORT __declspec(dllimport)
94 #define RD_KAFKA_VERSION 0x000b00ff
108 std::string version_str();
115 std::string get_debug_contexts();
127 int wait_destroyed(
int timeout_ms);
159 ERR__BAD_COMPRESSION = -198,
165 ERR__TRANSPORT = -195,
167 ERR__CRIT_SYS_RESOURCE = -194,
171 ERR__MSG_TIMED_OUT = -192,
174 ERR__PARTITION_EOF = -191,
176 ERR__UNKNOWN_PARTITION = -190,
180 ERR__UNKNOWN_TOPIC = -188,
182 ERR__ALL_BROKERS_DOWN = -187,
184 ERR__INVALID_ARG = -186,
186 ERR__TIMED_OUT = -185,
188 ERR__QUEUE_FULL = -184,
190 ERR__ISR_INSUFF = -183,
192 ERR__NODE_UPDATE = -182,
196 ERR__WAIT_COORD = -180,
198 ERR__UNKNOWN_GROUP = -179,
200 ERR__IN_PROGRESS = -178,
202 ERR__PREV_IN_PROGRESS = -177,
204 ERR__EXISTING_SUBSCRIPTION = -176,
206 ERR__ASSIGN_PARTITIONS = -175,
208 ERR__REVOKE_PARTITIONS = -174,
210 ERR__CONFLICT = -173,
214 ERR__UNKNOWN_PROTOCOL = -171,
216 ERR__NOT_IMPLEMENTED = -170,
218 ERR__AUTHENTICATION = -169,
220 ERR__NO_OFFSET = -168,
222 ERR__OUTDATED = -167,
224 ERR__TIMED_OUT_QUEUE = -166,
226 ERR__UNSUPPORTED_FEATURE = -165,
228 ERR__WAIT_CACHE = -164,
232 ERR__KEY_SERIALIZATION = -162,
234 ERR__VALUE_SERIALIZATION = -161,
236 ERR__KEY_DESERIALIZATION = -160,
238 ERR__VALUE_DESERIALIZATION = -159,
248 ERR_OFFSET_OUT_OF_RANGE = 1,
252 ERR_UNKNOWN_TOPIC_OR_PART = 3,
254 ERR_INVALID_MSG_SIZE = 4,
256 ERR_LEADER_NOT_AVAILABLE = 5,
258 ERR_NOT_LEADER_FOR_PARTITION = 6,
260 ERR_REQUEST_TIMED_OUT = 7,
262 ERR_BROKER_NOT_AVAILABLE = 8,
264 ERR_REPLICA_NOT_AVAILABLE = 9,
266 ERR_MSG_SIZE_TOO_LARGE = 10,
268 ERR_STALE_CTRL_EPOCH = 11,
270 ERR_OFFSET_METADATA_TOO_LARGE = 12,
272 ERR_NETWORK_EXCEPTION = 13,
274 ERR_GROUP_LOAD_IN_PROGRESS = 14,
276 ERR_GROUP_COORDINATOR_NOT_AVAILABLE = 15,
278 ERR_NOT_COORDINATOR_FOR_GROUP = 16,
280 ERR_TOPIC_EXCEPTION = 17,
282 ERR_RECORD_LIST_TOO_LARGE = 18,
284 ERR_NOT_ENOUGH_REPLICAS = 19,
286 ERR_NOT_ENOUGH_REPLICAS_AFTER_APPEND = 20,
288 ERR_INVALID_REQUIRED_ACKS = 21,
290 ERR_ILLEGAL_GENERATION = 22,
292 ERR_INCONSISTENT_GROUP_PROTOCOL = 23,
294 ERR_INVALID_GROUP_ID = 24,
296 ERR_UNKNOWN_MEMBER_ID = 25,
298 ERR_INVALID_SESSION_TIMEOUT = 26,
300 ERR_REBALANCE_IN_PROGRESS = 27,
302 ERR_INVALID_COMMIT_OFFSET_SIZE = 28,
304 ERR_TOPIC_AUTHORIZATION_FAILED = 29,
306 ERR_GROUP_AUTHORIZATION_FAILED = 30,
308 ERR_CLUSTER_AUTHORIZATION_FAILED = 31,
310 ERR_INVALID_TIMESTAMP = 32,
312 ERR_UNSUPPORTED_SASL_MECHANISM = 33,
314 ERR_ILLEGAL_SASL_STATE = 34,
316 ERR_UNSUPPORTED_VERSION = 35,
318 ERR_TOPIC_ALREADY_EXISTS = 36,
320 ERR_INVALID_PARTITIONS = 37,
322 ERR_INVALID_REPLICATION_FACTOR = 38,
324 ERR_INVALID_REPLICA_ASSIGNMENT = 39,
326 ERR_INVALID_CONFIG = 40,
328 ERR_NOT_CONTROLLER = 41,
330 ERR_INVALID_REQUEST = 42,
332 ERR_UNSUPPORTED_FOR_MESSAGE_FORMAT = 43,
334 ERR_POLICY_VIOLATION = 44,
336 ERR_OUT_OF_ORDER_SEQUENCE_NUMBER = 45,
338 ERR_DUPLICATE_SEQUENCE_NUMBER = 46,
340 ERR_INVALID_PRODUCER_EPOCH = 47,
342 ERR_INVALID_TXN_STATE = 48,
345 ERR_INVALID_PRODUCER_ID_MAPPING = 49,
348 ERR_INVALID_TRANSACTION_TIMEOUT = 50,
351 ERR_CONCURRENT_TRANSACTIONS = 51,
355 ERR_TRANSACTION_COORDINATOR_FENCED = 52,
357 ERR_TRANSACTIONAL_ID_AUTHORIZATION_FAILED = 53,
359 ERR_SECURITY_DISABLED = 54,
361 ERR_OPERATION_NOT_ATTEMPTED = 55
369 std::string err2str(RdKafka::ErrorCode err);
383 class TopicPartition;
422 virtual void dr_cb (
Message &message) = 0;
453 virtual int32_t partitioner_cb (
const Topic *topic,
454 const std::string *key,
455 int32_t partition_cnt,
456 void *msg_opaque) = 0;
478 int32_t partition_cnt,
479 void *msg_opaque) = 0;
501 virtual void event_cb (
Event &event) = 0;
522 EVENT_SEVERITY_EMERG = 0,
523 EVENT_SEVERITY_ALERT = 1,
524 EVENT_SEVERITY_CRITICAL = 2,
525 EVENT_SEVERITY_ERROR = 3,
526 EVENT_SEVERITY_WARNING = 4,
527 EVENT_SEVERITY_NOTICE = 5,
528 EVENT_SEVERITY_INFO = 6,
529 EVENT_SEVERITY_DEBUG = 7
532 virtual ~
Event () { }
542 virtual Type type ()
const = 0;
548 virtual ErrorCode err ()
const = 0;
554 virtual Severity severity ()
const = 0;
560 virtual std::string fac ()
const = 0;
570 virtual std::string str ()
const = 0;
576 virtual int throttle_time ()
const = 0;
582 virtual std::string broker_name ()
const = 0;
588 virtual int broker_id ()
const = 0;
605 virtual void consume_cb (
Message &message,
void *opaque) = 0;
666 RdKafka::ErrorCode err,
667 std::vector<TopicPartition*>&partitions) = 0;
693 virtual void offset_commit_cb(RdKafka::ErrorCode err,
694 std::vector<TopicPartition*>&offsets) = 0;
720 virtual int socket_cb (
int domain,
int type,
int protocol) = 0;
743 virtual int open_cb (
const std::string &path,
int flags,
int mode) = 0;
792 static Conf *create (ConfType type);
810 const std::string &value,
811 std::string &errstr) = 0;
815 DeliveryReportCb *dr_cb,
816 std::string &errstr) = 0;
821 std::string &errstr) = 0;
831 const Conf *topic_conf,
832 std::string &errstr) = 0;
836 PartitionerCb *partitioner_cb,
837 std::string &errstr) = 0;
841 PartitionerKeyPointerCb *partitioner_kp_cb,
842 std::string &errstr) = 0;
846 std::string &errstr) = 0;
850 std::string &errstr) = 0;
854 RebalanceCb *rebalance_cb,
855 std::string &errstr) = 0;
859 OffsetCommitCb *offset_commit_cb,
860 std::string &errstr) = 0;
874 std::string &value)
const = 0;
894 virtual Conf::ConfResult get(PartitionerKeyPointerCb *&partitioner_kp_cb)
const = 0;
918 virtual std::list<std::string> *dump () = 0;
921 virtual Conf::ConfResult set (
const std::string &name, ConsumeCb *consume_cb,
922 std::string &errstr) = 0;
942 virtual const std::string name ()
const = 0;
952 virtual const std::string memberid ()
const = 0;
977 virtual int poll (
int timeout_ms) = 0;
985 virtual int outq_len () = 0;
1002 virtual ErrorCode metadata (
bool all_topics,
const Topic *only_rkt,
1003 Metadata **metadatap,
int timeout_ms) = 0;
1015 virtual ErrorCode pause (std::vector<TopicPartition*> &partitions) = 0;
1027 virtual ErrorCode resume (std::vector<TopicPartition*> &partitions) = 0;
1038 virtual ErrorCode query_watermark_offsets (
const std::string &topic,
1040 int64_t *low, int64_t *high,
1041 int timeout_ms) = 0;
1060 virtual ErrorCode get_watermark_offsets (
const std::string &topic,
1062 int64_t *low, int64_t *high) = 0;
1084 virtual ErrorCode offsetsForTimes (std::vector<TopicPartition*> &offsets,
1085 int timeout_ms) = 0;
1114 virtual ErrorCode set_log_queue (
Queue *queue) = 0;
1127 virtual void yield () = 0;
1143 virtual const std::string clusterid (
int timeout_ms) = 0;
1173 static TopicPartition *create (
const std::string &topic,
int partition);
1174 static TopicPartition *create (
const std::string &topic,
int partition,
1183 static void destroy (std::vector<TopicPartition*> &partitions);
1186 virtual const std::string &topic ()
const = 0;
1189 virtual int partition ()
const = 0;
1192 virtual int64_t offset ()
const = 0;
1195 virtual void set_offset (int64_t offset) = 0;
1198 virtual ErrorCode err ()
const = 0;
1233 static Topic *create (
Handle *base,
const std::string &topic_str,
1234 Conf *conf, std::string &errstr);
1236 virtual ~
Topic () = 0;
1240 virtual const std::string name ()
const = 0;
1247 virtual bool partition_available (int32_t partition)
const = 0;
1259 virtual ErrorCode offset_store (int32_t partition, int64_t offset) = 0;
1289 MSG_TIMESTAMP_LOG_APPEND_TIME
1318 virtual std::string errstr()
const = 0;
1321 virtual ErrorCode err ()
const = 0;
1327 virtual Topic *topic ()
const = 0;
1330 virtual std::string topic_name ()
const = 0;
1333 virtual int32_t partition ()
const = 0;
1336 virtual void *payload ()
const = 0 ;
1339 virtual size_t len ()
const = 0;
1342 virtual const std::string *key ()
const = 0;
1345 virtual const void *key_pointer ()
const = 0 ;
1348 virtual size_t key_len ()
const = 0;
1351 virtual int64_t offset ()
const = 0;
1357 virtual void *msg_opaque ()
const = 0;
1363 virtual int64_t latency ()
const = 0;
1406 virtual ErrorCode forward (
Queue *dst) = 0;
1420 virtual Message *consume (
int timeout_ms) = 0;
1429 virtual int poll (
int timeout_ms) = 0;
1431 virtual ~
Queue () = 0;
1472 virtual ErrorCode assignment (std::vector<RdKafka::TopicPartition*> &partitions) = 0;
1476 virtual ErrorCode subscription (std::vector<std::string> &topics) = 0;
1502 virtual ErrorCode subscribe (
const std::vector<std::string> &topics) = 0;
1505 virtual ErrorCode unsubscribe () = 0;
1513 virtual ErrorCode assign (
const std::vector<TopicPartition*> &partitions) = 0;
1518 virtual ErrorCode unassign () = 0;
1544 virtual Message *consume (
int timeout_ms) = 0;
1559 virtual ErrorCode commitSync () = 0;
1566 virtual ErrorCode commitAsync () = 0;
1575 virtual ErrorCode commitSync (
Message *message) = 0;
1584 virtual ErrorCode commitAsync (
Message *message) = 0;
1591 virtual ErrorCode commitSync (std::vector<TopicPartition*> &offsets) = 0;
1598 virtual ErrorCode commitAsync (
const std::vector<TopicPartition*> &offsets) = 0;
1610 virtual ErrorCode commitSync (
OffsetCommitCb *offset_commit_cb) = 0;
1622 virtual ErrorCode commitSync (std::vector<TopicPartition*> &offsets,
1636 virtual ErrorCode committed (std::vector<TopicPartition*> &partitions,
1637 int timeout_ms) = 0;
1647 virtual ErrorCode position (std::vector<TopicPartition*> &partitions) = 0;
1672 virtual ErrorCode close () = 0;
1692 virtual ErrorCode seek (
const TopicPartition &partition,
int timeout_ms) = 0;
1706 virtual ErrorCode offsets_store (std::vector<TopicPartition*> &offsets) = 0;
1736 static Consumer *create (
Conf *conf, std::string &errstr);
1760 virtual ErrorCode start (
Topic *topic, int32_t partition, int64_t offset) = 0;
1768 virtual ErrorCode start (
Topic *topic, int32_t partition, int64_t offset,
1780 virtual ErrorCode stop (
Topic *topic, int32_t partition) = 0;
1796 virtual ErrorCode seek (
Topic *topic, int32_t partition, int64_t offset,
1797 int timeout_ms) = 0;
1816 virtual Message *consume (
Topic *topic, int32_t partition,
1817 int timeout_ms) = 0;
1840 virtual Message *consume (
Queue *queue,
int timeout_ms) = 0;
1861 virtual int consume_callback (
Topic *topic, int32_t partition,
1872 virtual int consume_callback (
Queue *queue,
int timeout_ms,
1885 static int64_t OffsetTail(int64_t offset);
1913 static Producer *create (
Conf *conf, std::string &errstr);
1952 MSG_FREE = RK_MSG_FREE,
1953 MSG_COPY = RK_MSG_COPY
2012 virtual ErrorCode produce (
Topic *topic, int32_t partition,
2014 void *payload,
size_t len,
2015 const std::string *key,
2016 void *msg_opaque) = 0;
2022 virtual ErrorCode produce (
Topic *topic, int32_t partition,
2024 void *payload,
size_t len,
2025 const void *key,
size_t key_len,
2026 void *msg_opaque) = 0;
2034 virtual ErrorCode produce (
const std::string topic_name, int32_t partition,
2036 void *payload,
size_t len,
2037 const void *key,
size_t key_len,
2039 void *msg_opaque) = 0;
2046 virtual ErrorCode produce (
Topic *topic, int32_t partition,
2047 const std::vector<char> *payload,
2048 const std::vector<char> *key,
2049 void *msg_opaque) = 0;
2063 virtual ErrorCode flush (
int timeout_ms) = 0;
2082 virtual int32_t
id()
const = 0;
2085 virtual const std::string
host()
const = 0;
2088 virtual int port()
const = 0;
2112 virtual int32_t
id()
const = 0;
2115 virtual ErrorCode
err()
const = 0;
2118 virtual int32_t
leader()
const = 0;
2121 virtual const std::vector<int32_t> *
replicas()
const = 0;
2126 virtual const std::vector<int32_t> *
isrs()
const = 0;
2144 virtual const std::string
topic()
const = 0;
2147 virtual const PartitionMetadataVector *
partitions()
const = 0;
2150 virtual ErrorCode
err()
const = 0;
2173 virtual const BrokerMetadataVector *
brokers()
const = 0;
2176 virtual const TopicMetadataVector *
topics()
const = 0;
virtual int32_t partitioner_cb(const Topic *topic, const void *key, size_t key_len, int32_t partition_cnt, void *msg_opaque)=0
Variant partitioner callback that gets key as pointer and length instead of as a const std::string *...
High-level KafkaConsumer (for brokers 0.9 and later)
Definition: rdkafkacpp.h:1452
Definition: rdkafkacpp.h:1288
static const int64_t OFFSET_BEGINNING
Special offsets.
Definition: rdkafkacpp.h:1218
ConfType
Configuration object type.
Definition: rdkafkacpp.h:774
Partitioner callback class.
Definition: rdkafkacpp.h:435
Type
Event type.
Definition: rdkafkacpp.h:513
static const int32_t PARTITION_UA
Unassigned partition.
Definition: rdkafkacpp.h:1215
Message object.
Definition: rdkafkacpp.h:1309
Severity
EVENT_LOG severities (conforms to syslog(3) severities)
Definition: rdkafkacpp.h:521
Event callback class.
Definition: rdkafkacpp.h:494
KafkaConsunmer: Rebalance callback class
Definition: rdkafkacpp.h:614
int64_t timestamp
Definition: rdkafkacpp.h:1293
Variant partitioner with key pointer.
Definition: rdkafkacpp.h:465
Definition: rdkafkacpp.h:516
static const int64_t OFFSET_INVALID
Definition: rdkafkacpp.h:1221
Definition: rdkafkacpp.h:1287
Topic handle.
Definition: rdkafkacpp.h:1207
Producer.
Definition: rdkafkacpp.h:1901
Definition: rdkafkacpp.h:775
Definition: rdkafkacpp.h:514
ConfResult
RdKafka::Conf::Set() result code.
Definition: rdkafkacpp.h:782
Definition: rdkafkacpp.h:72
Queue interface.
Definition: rdkafkacpp.h:1389
MessageTimestampType type
Definition: rdkafkacpp.h:1292
Message timestamp object.
Definition: rdkafkacpp.h:1284
static const int64_t OFFSET_END
Definition: rdkafkacpp.h:1219
Portability: OpenCb callback class
Definition: rdkafkacpp.h:730
Definition: rdkafkacpp.h:515
static const int64_t OFFSET_STORED
Definition: rdkafkacpp.h:1220
Configuration interface.
Definition: rdkafkacpp.h:769
Offset Commit callback class.
Definition: rdkafkacpp.h:676
Base handle, super class for specific clients.
Definition: rdkafkacpp.h:937
Topic+Partition.
Definition: rdkafkacpp.h:1165
Consume callback class.
Definition: rdkafkacpp.h:596
Simple Consumer (legacy)
Definition: rdkafkacpp.h:1724
MessageTimestampType
Definition: rdkafkacpp.h:1286
Event object class as passed to the EventCb callback.
Definition: rdkafkacpp.h:510
Portability: SocketCb callback class
Definition: rdkafkacpp.h:705
Delivery Report callback class.
Definition: rdkafkacpp.h:417