Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative acknowledge on a message ID does not work #180

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/consumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void Consumer_negative_acknowledge(Consumer& consumer, const Message& msg) {
}

void Consumer_negative_acknowledge_message_id(Consumer& consumer, const MessageId& msgId) {
waitForAsyncResult([&](ResultCallback callback) { consumer.acknowledgeAsync(msgId, callback); });
Py_BEGIN_ALLOW_THREADS consumer.negativeAcknowledge(msgId);
Py_END_ALLOW_THREADS
}

void Consumer_acknowledge_cumulative(Consumer& consumer, const Message& msg) {
Expand Down
5 changes: 4 additions & 1 deletion tests/pulsar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ def test_redelivery_count(self):
for i in range(4):
msg = consumer.receive(TM)
print("Received message %s" % msg.data())
consumer.negative_acknowledge(msg)
if i % 2 == 0:
consumer.negative_acknowledge(msg)
else:
consumer.negative_acknowledge(msg.message_id())
redelivery_count = msg.redelivery_count()

self.assertTrue(msg)
Expand Down