BewareMyPower commented on code in PR #254:
URL: https://github.com/apache/pulsar-client-cpp/pull/254#discussion_r1170752356
##########
include/pulsar/c/consumer.h:
##########
@@ -119,6 +121,17 @@ PULSAR_PUBLIC void
pulsar_consumer_receive_async(pulsar_consumer_t *consumer,
PULSAR_PUBLIC pulsar_result pulsar_consumer_batch_receive(pulsar_consumer_t
*consumer,
pulsar_messages_t
**msgs);
+/**
+ * Async batch receiving messages.
+ *
+ * @param callback
+ * 1. When it's callback call result is `ResultOk`, `*msg` will point to the
memory that
+ * is allocated internally. You have to call `pulsar_messages_free` to free it.
+ * 2. If callback call result is not `ResultOk`, `*msg` will is nullptr.
Review Comment:
No. Let's review the basic knowledge of C first. Given the pointer `int* p`,
`*p` is the `int` object that `p` points to, while `p` is the pointer that
points to an `int`.
Then, see the synchronous batch receive method:
```c
PULSAR_PUBLIC pulsar_result pulsar_consumer_batch_receive(pulsar_consumer_t
*consumer,
pulsar_messages_t
**msgs);
```
- `msgs` is a pointer that points to `pulsar_messages_t*`, which is a
pointer that points to a `pulsar_messages_t` object.
- `*msgs` is a pointer that `msgs` points to, i.e. `*msgs` is the pointer
that points to a `pulsar_messages_t` object.
Let's see the callback in this PR.
```c
typedef void (*pulsar_batch_receive_callback)(pulsar_result result,
pulsar_messages_t *msg, void *ctx);
```
- `msg` is a pointer that points to a `pulsar_messages_t` object.
- `*msg` is the `pulsar_messages_t` object that `msg` points to.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]