@@ -83,7 +83,7 @@ class PULSAR_PUBLIC Consumer {
8383 *
8484 * @param callback the callback to get notified when the operation is complete
8585 */
86- void unsubscribeAsync (ResultCallback callback);
86+ void unsubscribeAsync (const ResultCallback& callback);
8787
8888 /* *
8989 * Receive a single message.
@@ -134,10 +134,10 @@ class PULSAR_PUBLIC Consumer {
134134 * </p>
135135 * @param ReceiveCallback will be completed when message is available
136136 */
137- void receiveAsync (ReceiveCallback callback);
137+ void receiveAsync (const ReceiveCallback& callback);
138138
139139 template <typename T>
140- void receiveAsync (std::function<void (Result result, const TypedMessage<T>&)> callback,
140+ void receiveAsync (const std::function<void (Result result, const TypedMessage<T>&)>& callback,
141141 typename TypedMessage<T>::Decoder decoder) {
142142 receiveAsync ([callback, decoder](Result result, const Message& msg) {
143143 callback (result, TypedMessage<T>{msg, decoder});
@@ -167,7 +167,7 @@ class PULSAR_PUBLIC Consumer {
167167 * </p>
168168 * @param BatchReceiveCallback will be completed when messages are available.
169169 */
170- void batchReceiveAsync (BatchReceiveCallback callback);
170+ void batchReceiveAsync (const BatchReceiveCallback& callback);
171171
172172 /* *
173173 * Acknowledge the reception of a single message.
@@ -209,7 +209,7 @@ class PULSAR_PUBLIC Consumer {
209209 * @param message the message to acknowledge
210210 * @param callback callback that will be triggered when the message has been acknowledged
211211 */
212- void acknowledgeAsync (const Message& message, ResultCallback callback);
212+ void acknowledgeAsync (const Message& message, const ResultCallback& callback);
213213
214214 /* *
215215 * Asynchronously acknowledge the reception of a single message.
@@ -220,15 +220,15 @@ class PULSAR_PUBLIC Consumer {
220220 * @param messageId the messageId to acknowledge
221221 * @param callback the callback that is triggered when the message has been acknowledged or not
222222 */
223- void acknowledgeAsync (const MessageId& messageId, ResultCallback callback);
223+ void acknowledgeAsync (const MessageId& messageId, const ResultCallback& callback);
224224
225225 /* *
226226 * Asynchronously acknowledge the consumption of a list of message.
227227 * @param messageIdList
228228 * @param callback the callback that is triggered when the message has been acknowledged or not
229229 * @return
230230 */
231- void acknowledgeAsync (const MessageIdList& messageIdList, ResultCallback callback);
231+ void acknowledgeAsync (const MessageIdList& messageIdList, const ResultCallback& callback);
232232
233233 /* *
234234 * Acknowledge the reception of all the messages in the stream up to (and including)
@@ -239,7 +239,7 @@ class PULSAR_PUBLIC Consumer {
239239 *
240240 * Cumulative acknowledge cannot be used when the consumer type is set to ConsumerShared.
241241 *
242- * It's equivalent to calling asyncAcknowledgeCumulative(const Message&, ResultCallback) and
242+ * It's equivalent to calling asyncAcknowledgeCumulative(const Message&, const ResultCallback& ) and
243243 * waiting for the callback to be triggered.
244244 *
245245 * @param message the last message in the stream to acknowledge
@@ -258,8 +258,8 @@ class PULSAR_PUBLIC Consumer {
258258 *
259259 * Cumulative acknowledge cannot be used when the consumer type is set to ConsumerShared.
260260 *
261- * It is equivalent to calling the asyncAcknowledgeCumulative(const Message&, ResultCallback) method and
262- * waiting for the callback to be triggered.
261+ * It is equivalent to calling the asyncAcknowledgeCumulative(const Message&, const ResultCallback&)
262+ * method and waiting for the callback to be triggered.
263263 *
264264 * @param messageId the last messageId in the stream to acknowledge
265265 * @return ResultOk if the message is successfully acknowledged. All previously delivered messages for
@@ -277,7 +277,7 @@ class PULSAR_PUBLIC Consumer {
277277 * @param message the message to acknowledge
278278 * @param callback callback that will be triggered when the message has been acknowledged
279279 */
280- void acknowledgeCumulativeAsync (const Message& message, ResultCallback callback);
280+ void acknowledgeCumulativeAsync (const Message& message, const ResultCallback& callback);
281281
282282 /* *
283283 * Asynchronously acknowledge the reception of all the messages in the stream up to (and
@@ -289,7 +289,7 @@ class PULSAR_PUBLIC Consumer {
289289 * @param messageId the messageId to acknowledge
290290 * @param callback the callback that is triggered when the message has been acknowledged or not
291291 */
292- void acknowledgeCumulativeAsync (const MessageId& messageId, ResultCallback callback);
292+ void acknowledgeCumulativeAsync (const MessageId& messageId, const ResultCallback& callback);
293293
294294 /* *
295295 * Acknowledge the failure to process a single message.
@@ -364,7 +364,7 @@ class PULSAR_PUBLIC Consumer {
364364 * Asynchronously close the consumer and stop the broker to push more messages
365365 *
366366 */
367- void closeAsync (ResultCallback callback);
367+ void closeAsync (const ResultCallback& callback);
368368
369369 /* *
370370 * Pause receiving messages via the messageListener, till resumeMessageListener() is called.
@@ -413,7 +413,7 @@ class PULSAR_PUBLIC Consumer {
413413 * @param callback - callback function to get the brokerConsumerStats,
414414 * if result is ResultOk then the brokerConsumerStats will be populated
415415 */
416- void getBrokerConsumerStatsAsync (BrokerConsumerStatsCallback callback);
416+ void getBrokerConsumerStatsAsync (const BrokerConsumerStatsCallback& callback);
417417
418418 /* *
419419 * Reset the subscription associated with this consumer to a specific message id.
@@ -445,15 +445,15 @@ class PULSAR_PUBLIC Consumer {
445445 * @param messageId
446446 * the message id where to reposition the subscription
447447 */
448- virtual void seekAsync (const MessageId& messageId, ResultCallback callback);
448+ virtual void seekAsync (const MessageId& messageId, const ResultCallback& callback);
449449
450450 /* *
451451 * Asynchronously reset the subscription associated with this consumer to a specific message publish time.
452452 *
453453 * @param timestamp
454454 * the message publish time where to reposition the subscription
455455 */
456- virtual void seekAsync (uint64_t timestamp, ResultCallback callback);
456+ virtual void seekAsync (uint64_t timestamp, const ResultCallback& callback);
457457
458458 /* *
459459 * @return Whether the consumer is currently connected to the broker
@@ -464,7 +464,7 @@ class PULSAR_PUBLIC Consumer {
464464 * Asynchronously get an ID of the last available message or a message ID with -1 as an entryId if the
465465 * topic is empty.
466466 */
467- void getLastMessageIdAsync (GetLastMessageIdCallback callback);
467+ void getLastMessageIdAsync (const GetLastMessageIdCallback& callback);
468468
469469 /* *
470470 * Get an ID of the last available message or a message ID with -1 as an entryId if the topic is empty.
0 commit comments