pulsar-client-cpp
Loading...
Searching...
No Matches
consumer.h
1
19#pragma once
20
21#include <pulsar/defines.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <pulsar/c/message.h>
28#include <pulsar/c/messages.h>
29#include <pulsar/c/result.h>
30#include <stdint.h>
31
32typedef struct _pulsar_consumer pulsar_consumer_t;
33
34typedef void (*pulsar_result_callback)(pulsar_result, void *);
35
36typedef void (*pulsar_receive_callback)(pulsar_result result, pulsar_message_t *msg, void *ctx);
37
38typedef void (*pulsar_batch_receive_callback)(pulsar_result result, pulsar_messages_t *msgs, void *ctx);
39
43PULSAR_PUBLIC const char *pulsar_consumer_get_topic(pulsar_consumer_t *consumer);
44
48PULSAR_PUBLIC const char *pulsar_consumer_get_subscription_name(pulsar_consumer_t *consumer);
49
63PULSAR_PUBLIC pulsar_result pulsar_consumer_unsubscribe(pulsar_consumer_t *consumer);
64
76PULSAR_PUBLIC void pulsar_consumer_unsubscribe_async(pulsar_consumer_t *consumer,
77 pulsar_result_callback callback, void *ctx);
78
89PULSAR_PUBLIC pulsar_result pulsar_consumer_receive(pulsar_consumer_t *consumer, pulsar_message_t **msg);
90
99PULSAR_PUBLIC pulsar_result pulsar_consumer_receive_with_timeout(pulsar_consumer_t *consumer,
100 pulsar_message_t **msg, int timeoutMs);
101
110PULSAR_PUBLIC void pulsar_consumer_receive_async(pulsar_consumer_t *consumer,
111 pulsar_receive_callback callback, void *ctx);
112
121PULSAR_PUBLIC pulsar_result pulsar_consumer_batch_receive(pulsar_consumer_t *consumer,
122 pulsar_messages_t **msgs);
123
132PULSAR_PUBLIC void pulsar_consumer_batch_receive_async(pulsar_consumer_t *consumer,
133 pulsar_batch_receive_callback callback, void *ctx);
134
146PULSAR_PUBLIC pulsar_result pulsar_consumer_acknowledge(pulsar_consumer_t *consumer,
147 pulsar_message_t *message);
148
149PULSAR_PUBLIC pulsar_result pulsar_consumer_acknowledge_id(pulsar_consumer_t *consumer,
150 pulsar_message_id_t *messageId);
151
161PULSAR_PUBLIC void pulsar_consumer_acknowledge_async(pulsar_consumer_t *consumer, pulsar_message_t *message,
162 pulsar_result_callback callback, void *ctx);
163
164PULSAR_PUBLIC void pulsar_consumer_acknowledge_async_id(pulsar_consumer_t *consumer,
165 pulsar_message_id_t *messageId,
166 pulsar_result_callback callback, void *ctx);
167
185PULSAR_PUBLIC pulsar_result pulsar_consumer_acknowledge_cumulative(pulsar_consumer_t *consumer,
186 pulsar_message_t *message);
187
188PULSAR_PUBLIC pulsar_result pulsar_consumer_acknowledge_cumulative_id(pulsar_consumer_t *consumer,
189 pulsar_message_id_t *messageId);
190
201PULSAR_PUBLIC void pulsar_consumer_acknowledge_cumulative_async(pulsar_consumer_t *consumer,
202 pulsar_message_t *message,
203 pulsar_result_callback callback, void *ctx);
204
205PULSAR_PUBLIC void pulsar_consumer_acknowledge_cumulative_async_id(pulsar_consumer_t *consumer,
206 pulsar_message_id_t *messageId,
207 pulsar_result_callback callback,
208 void *ctx);
209
222PULSAR_PUBLIC void pulsar_consumer_negative_acknowledge(pulsar_consumer_t *consumer,
223 pulsar_message_t *message);
224
237PULSAR_PUBLIC void pulsar_consumer_negative_acknowledge_id(pulsar_consumer_t *consumer,
238 pulsar_message_id_t *messageId);
239
240PULSAR_PUBLIC pulsar_result pulsar_consumer_close(pulsar_consumer_t *consumer);
241
242PULSAR_PUBLIC void pulsar_consumer_close_async(pulsar_consumer_t *consumer, pulsar_result_callback callback,
243 void *ctx);
244
245PULSAR_PUBLIC void pulsar_consumer_free(pulsar_consumer_t *consumer);
246
247/*
248 * Pause receiving messages via the messageListener, till resumeMessageListener() is called.
249 */
250PULSAR_PUBLIC pulsar_result pulsar_consumer_pause_message_listener(pulsar_consumer_t *consumer);
251
252/*
253 * Resume receiving the messages via the messageListener.
254 * Asynchronously receive all the messages enqueued from time pauseMessageListener() was called.
255 */
256PULSAR_PUBLIC pulsar_result resume_message_listener(pulsar_consumer_t *consumer);
257
267PULSAR_PUBLIC void pulsar_consumer_redeliver_unacknowledged_messages(pulsar_consumer_t *consumer);
268
278PULSAR_PUBLIC void pulsar_consumer_seek_async(pulsar_consumer_t *consumer, pulsar_message_id_t *messageId,
279 pulsar_result_callback callback, void *ctx);
280
289PULSAR_PUBLIC pulsar_result pulsar_consumer_seek(pulsar_consumer_t *consumer, pulsar_message_id_t *messageId);
290
300PULSAR_PUBLIC void pulsar_consumer_seek_by_timestamp_async(pulsar_consumer_t *consumer, uint64_t timestamp,
301 pulsar_result_callback callback, void *ctx);
302
311PULSAR_PUBLIC pulsar_result pulsar_consumer_seek_by_timestamp(pulsar_consumer_t *consumer,
312 uint64_t timestamp);
313
314PULSAR_PUBLIC int pulsar_consumer_is_connected(pulsar_consumer_t *consumer);
315
316PULSAR_PUBLIC pulsar_result pulsar_consumer_get_last_message_id(pulsar_consumer_t *consumer,
317 pulsar_message_id_t *messageId);
318
319#ifdef __cplusplus
320}
321#endif