This is an automated email from the ASF dual-hosted git repository.
BewareMyPower pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new aedb925 [fix][client-cpp] Fix TypedMessageTest to use receiveAsync<T>
template overload with decoder (#580)
aedb925 is described below
commit aedb9255748ceffd4720a56d44f316be30b080fc
Author: zhou zhuohan <[email protected]>
AuthorDate: Tue May 26 20:28:46 2026 +0800
[fix][client-cpp] Fix TypedMessageTest to use receiveAsync<T> template
overload with decoder (#580)
---
tests/TypedMessageTest.cc | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/TypedMessageTest.cc b/tests/TypedMessageTest.cc
index 9a61bfe..4e416b8 100644
--- a/tests/TypedMessageTest.cc
+++ b/tests/TypedMessageTest.cc
@@ -65,15 +65,16 @@ TEST(TypedMessageTest, testReceive) {
ASSERT_EQ(ResultOk, consumer.receive(msg, 3000, intDecoder));
} else {
Latch latch{1};
- consumer.receiveAsync(
+ std::function<void(Result result, const TypedMessage<int>&)>
callback =
[&latch, &msg, &msgMutex](Result result, const
TypedMessage<int>& receivedMsg) {
ASSERT_EQ(ResultOk, result);
{
std::lock_guard<std::mutex> lock{msgMutex};
- msg = TypedMessage<int>{receivedMsg, intDecoder};
+ msg = receivedMsg;
}
latch.countdown();
- });
+ };
+ consumer.receiveAsync<int>(callback, intDecoder);
ASSERT_TRUE(latch.wait(std::chrono::seconds(1)));
}