Repository navigation
PikaTransport: Re-enable publisher confirms - #220
Merged
Merged
Conversation
ndevenish
force-pushed
the
pika-publisher-confirms
branch
from
November 6, 2026 16:38
e70522a to
79224d6
Compare
Non-transactional sends now go through a dedicated channel in publisher-confirms mode, so basic_publish blocks until the broker acknowledges the message, and raises UnroutableError/NackError if it is rejected. Confirm and transaction modes are mutually exclusive on a channel, so the shared channel is kept in plain mode for transactions not tied to a subscription. Broker rejections are now delivered to the caller's future only, rather than also being raised into the connection runloop, which would otherwise terminate the thread without reconnecting. Since PikaTransport.send uses mandatory=True, sending to a queue that does not exist now raises instead of silently dropping the message. Fixes #96
ndevenish
force-pushed
the
pika-publisher-confirms
branch
from
November 6, 2026 16:52
79224d6 to
19e1efb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Non-transactional sends now go through a dedicated channel in publisher-confirms mode, so basic_publish blocks until the broker acknowledges the message, and raises UnroutableError/NackError if it is rejected. Confirm and transaction modes are mutually exclusive on a channel, so the shared channel is kept in plain mode for transactions not tied to a subscription.
Broker rejections are now delivered to the caller's future only, rather than also being raised into the connection runloop, which would otherwise terminate the thread without reconnecting.
Since PikaTransport.send uses mandatory=True, sending to a queue that does not exist now raises instead of silently dropping the message.
Note on testing
This also fixes a race in
test_pikathread_send_named_exchange. Without confirms,send().result()returns as soon as the message is written to the socket, so the test's immediatebasic_geton a separate connection can run before the broker has routed the message. Against a real broker the test fails reliably when run on its own (15/15 runs onmain, 0/15 with this change).This has never been caught because CI provides no RabbitMQ, so every test that needs a broker is skipped (
14 skippedin this PR's CI run too). #221, stacked on this PR, adds a broker to CI and a local fixture that starts one in a container. With both applied the suite passes with nothing skipped:183 passed, 3 xfailed.Fixes #96