NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #1092 most downloaded on PyPI
Pika Python AMQP Client Library
Latest stable
1.4.4
Last release 19 days ago
03 Nov 2026
Ships unpredictably
gaps range from 8 days to 3.0 years
Most releases are documented
notes for 29 of 34 stable releases
Nothing withdrawn
no release was ever pulled
16 years old
55 releases · first in 2010
Drag across the ruler to compare, or tap a release to open it.
If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
Eight changes are worth reading before you upgrade. Three can turn a passing build red, two change what a working application observes when it cancels a consumer or closes a channel, one refuses messages larger than 64 MiB, and one changes what the Twisted adapter reports when a connection closes.
pika.Connection is new, and is the connection to use1.5.0 introduces pika.Connection and its Channel, a connection that runs its own IOLoop on a background thread and offers a thread-safe blocking API that does not stall heartbeats while your code processes a message. There is nothing to migrate from: these classes are new in this release, and pika.Connection is the documented import.
from pika.adapters.thread_safe_connection import Connection also works, though the module moves in 2.0 (see #1681). Channel is not exported from pika, because channels come from Connection.channel().
If you are starting new code, use pika.Connection. If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
DeprecationWarning, which may fail your testsBlockingConnection, TornadoConnection, TwistedProtocolConnection and GeventConnection each warn from their constructor that they will be removed in Pika 2.0. They all still work.
The upgrade risk is that a DeprecationWarning raised from a constructor is a hard error for anyone running with warnings-as-errors, which is a common test configuration. It fires at construction, before any I/O, so it does not depend on reaching a broker:
E DeprecationWarning: BlockingConnection is deprecated and will be removed in Pika 2.0. ...
pika/adapters/blocking_connection.py:367: DeprecationWarning
The same happens under python -W error and warnings.simplefilter('error'). BlockingConnection is pika's most widely used entry point, so this is both likely and likely to be misread as pika being broken rather than as an intentional notice. Outside a test runner it is usually invisible, because Python's default filters hide DeprecationWarning unless it is triggered from __main__; pytest is what turns it back on.
Either filter it or migrate. The warning uses stacklevel=2, so it is reported against the line that constructs the connection rather than against pika, and a filter scoped to the pika module does not match. Match on the message instead:
# pyproject.toml, for pytest
filterwarnings = [
"ignore:.*will be removed in Pika 2\\.0:DeprecationWarning",
]python -W 'ignore:BlockingConnection is deprecated' your_app.pyThe two forms are not interchangeable. In filterwarnings the message is a regular expression, while -W on the command line, for python and for pytest alike, matches it as a literal prefix, so the pyproject.toml pattern given as a -W argument matches nothing and the warning still fails the run.
or migrate to Connection, which runs its own IOLoop on a background thread and provides a thread-safe blocking API that does not stall heartbeats on slow message processing.
A Basic.Cancel does not stop the broker immediately: the specification allows it to keep dispatching until it sends Basic.CancelOk, and pika used to reject every delivery that arrived in that window, or discard it outright for an auto_ack consumer. Discarding loses the message, because an auto_ack delivery has no copy left at the broker, and rejecting is a decision pika was making on your behalf that no other client makes. Measured on RabbitMQ 4.3.6, closing a channel with an auto_ack consumer half a second after its first delivery, 400 messages, work_queue_maxsize=50 and a 50 ms callback. At 8 KiB bodies with close(timeout=10): 339 of 400 lost before this change, 179 to 189 across five runs after it. close(timeout=None) loses none after the change, at either body size, and lost the same 339 before it, because that loss was the cancel window rather than the budget. At 64 bytes the deliveries still queued when a bounded close returns fit in the work queue, so the worker finishes them and nothing is lost; at 8 KiB they do not fit and the excess is discarded when the pool shuts. Quote the whole configuration with any figure from this area, because the message count, body size, queue size, callback cost and timeout all move it. utils/measure_close_loss.py in the repository reproduces each of them.
Those deliveries are now passed to your callback instead, which is what the Java client does, as long as the channel is still open.
One thing follows for existing code: a consumer callback can now run for a message that arrives after you called basic_cancel, so a callback that assumed cancellation was immediate may see further deliveries. BlockingChannel.basic_cancel still rejects them for an auto_ack=False consumer, so they return to the queue at once as before, and its return value is unchanged; the channel no longer does that rejecting, the wrapper does. The generator-style BlockingChannel.cancel discards them instead, which #1767 covers.
channel.close() on an asynchronous adapter still discards those deliveriesA channel that is closing discards them, because a callback could not acknowledge one anyway and the attempt would abort the connection; the Java client discards them at the same point. Channel.close cancels each consumer without waiting for the broker to confirm, so this is what a bare channel.close() does on SelectConnection, AsyncioConnection, TornadoConnection and GeventConnection. A discarded delivery is redelivered to the next consumer with auto_ack=False and lost with auto_ack=True. Pika now logs a warning naming the count as the channel closes.
pika.Connection and BlockingConnection are unaffected and keep every delivery across a close, since both cancel their consumers and wait for the broker to confirm before closing anything. To get the same guarantee from an asynchronous adapter, cancel each consumer with a callback and close the channel from the last Basic.CancelOk; the channel documentation has the pattern. Pika 2.0 removes these adapters, which leaves Connection and its Channel as the only close path and so retires the gap rather than fixing it.
pika now refuses an inbound message whose body is larger than max_inbound_message_body_size, 64 MiB by default, and a frame larger than that limit or 128 KiB, whichever is greater. Either closes the connection with MessageBodyTooLargeError or FrameTooLargeError, both subclasses of AMQPConnectionError. The Java and .NET clients use the same 64 MiB default. RabbitMQ refuses messages above its own max_message_size, 16 MiB by default, so the limit is reached only when the broker is configured to allow larger messages.
If you consume larger messages, raise the limit with ConnectionParameters(max_inbound_message_body_size=...) or ?max_inbound_message_body_size= in a URL, up to 512 MiB, RabbitMQ's own maximum. A refused message delivered without auto_ack is requeued, so a consumer that reconnects is closed again: raise the limit, or dead-letter or remove the message on the broker. With auto_ack the broker has already discarded it. Returned messages and basic_get replies are checked too, so a publisher can be closed by its own oversized mandatory message coming back.
TwistedProtocolConnection reports why it closed, not ConnectionDoneWhen pika closes a Twisted connection, the reason now reaches the closed deferred, the on_close_callback, and pending channel and queue deferreds, as on the other adapters, instead of twisted.internet.error.ConnectionDone: ConnectionClosedByClient after close(), which is also what yield connection.close() returns; ConnectionClosedByBroker when the broker closes it; AMQPHeartbeatTimeout; ConnectionBlockedTimeout; and the size errors above. Code that traps or tests for ConnectionDone must handle these instead. A peer that drops the connection without pika closing it still reports ConnectionDone.
pika.compat is goneThe module is removed. It held Python 2 compatibility shims and platform checks, was never documented as public API, and nothing in pika imports it any more. It had no leading underscore, though, so it has been importable for years and an upgrade turns import pika.compat into ModuleNotFoundError.
Twelve of its names moved to pika._utils: ON_LINUX, ON_OSX, ON_WINDOWS, LINUX_VERSION, SOCKET_ERROR, HAVE_SIGNAL, RE_NUM, time_now(), as_bytes(), to_digit(), get_linux_version() and nonblocking_socketpair(). That module is private, so it is not a migration target; copy what you need instead. The four that are gone were Python 2 artefacts, and the standard library covers each: byte() (a bytes literal), long (int), AbstractBase (abc.ABC), str_or_bytes ((str, bytes)). pika.spec.str, which was str = bytes, goes with them.
pika.spec is now annotated, which may fail your type checkerPika ships a py.typed marker, so a type checker reads pika's own annotations. pika.spec is generated code and was previously excluded from pika's mypy configuration, which left every field of a decoded frame typed as Any. Any silences all checking, so a downstream mypy run that was clean can go red on upgrade without any change on your end. The most common line in every pika tutorial is affected:
error: Argument "delivery_tag" to "basic_ack" of "BlockingChannel" has incompatible type "int | None"; expected "int" [arg-type]
error: Argument "routing_key" to "basic_publish" of "BlockingChannel" has incompatible type "str | bytes | None"; expected "str" [arg-type]
Two properties of the generated code account for it. Every generated constructor defaults its arguments to None, so fields are optional even though a frame off the wire always carries them. And AMQP shortstr has no declared encoding, so pika falls back to raw bytes on invalid UTF-8, making routing_key, exchange and consumer_tag all str | bytes | None.
The errors are accurate and the annotations are an improvement, so nothing here should be reverted. The FAQ covers the narrowing idioms: https://pika.github.io/pika/latest/faq/
pyright users see little change, since it reported most of these already.
The same notes are in the changelog, which also carries the full version history: https://pika.github.io/pika/latest/changelog/
TRY_IO_AGAIN_SOCK_ERROR_CODES once in pika._utils by @alonfaraj in #1810_remaining deadline helper in thread_safe_connection by @alonfaraj in #1811Full Changelog: 1.5.0rc3...1.5.0rc4
Your coding agent can read these notes before it upgrades. Set up the MCP server →
If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
Eight changes are worth reading before you upgrade. Three can turn a passing build red, two change what a working application observes when it cancels a consumer or closes a channel, one refuses messages larger than 64 MiB, and one changes what the Twisted adapter reports when a connection closes.
pika.Connection is new, and is the connection to use1.5.0 introduces pika.Connection and its Channel, a connection that runs its own IOLoop on a background thread and offers a thread-safe blocking API that does not stall heartbeats while your code processes a message. There is nothing to migrate from: these classes are new in this release, and pika.Connection is the documented import.
from pika.adapters.thread_safe_connection import Connection also works, though the module moves in 2.0 (see #1681). Channel is not exported from pika, because channels come from Connection.channel().
If you are starting new code, use pika.Connection. If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
DeprecationWarning, which may fail your testsBlockingConnection, TornadoConnection, TwistedProtocolConnection and GeventConnection each warn from their constructor that they will be removed in Pika 2.0. They all still work.
The upgrade risk is that a DeprecationWarning raised from a constructor is a hard error for anyone running with warnings-as-errors, which is a common test configuration. It fires at construction, before any I/O, so it does not depend on reaching a broker:
E DeprecationWarning: BlockingConnection is deprecated and will be removed in Pika 2.0. ...
pika/adapters/blocking_connection.py:367: DeprecationWarning
The same happens under python -W error and warnings.simplefilter('error'). BlockingConnection is pika's most widely used entry point, so this is both likely and likely to be misread as pika being broken rather than as an intentional notice. Outside a test runner it is usually invisible, because Python's default filters hide DeprecationWarning unless it is triggered from __main__; pytest is what turns it back on.
Either filter it or migrate. The warning uses stacklevel=2, so it is reported against the line that constructs the connection rather than against pika, and a filter scoped to the pika module does not match. Match on the message instead:
# pyproject.toml, for pytest
filterwarnings = [
"ignore:.*will be removed in Pika 2\\.0:DeprecationWarning",
]
python -W 'ignore:BlockingConnection is deprecated' your_app.py
The two forms are not interchangeable. In filterwarnings the message is a regular expression, while -W on the command line, for python and for pytest alike, matches it as a literal prefix, so the pyproject.toml pattern given as a -W argument matches nothing and the warning still fails the run.
or migrate to Connection, which runs its own IOLoop on a background thread and provides a thread-safe blocking API that does not stall heartbeats on slow message processing.
A Basic.Cancel does not stop the broker immediately: the specification allows it to keep dispatching until it sends Basic.CancelOk, and pika used to reject every delivery that arrived in that window, or discard it outright for an auto_ack consumer. Discarding loses the message, because an auto_ack delivery has no copy left at the broker, and rejecting is a decision pika was making on your behalf that no other client makes. Measured on RabbitMQ 4.3.6, closing a channel with an auto_ack consumer half a second after its first delivery, 400 messages, work_queue_maxsize=50 and a 50 ms callback. At 8 KiB bodies with close(timeout=10): 339 of 400 lost before this change, 179 to 189 across five runs after it. close(timeout=None) loses none after the change, at either body size, and lost the same 339 before it, because that loss was the cancel window rather than the budget. At 64 bytes the deliveries still queued when a bounded close returns fit in the work queue, so the worker finishes them and nothing is lost; at 8 KiB they do not fit and the excess is discarded when the pool shuts. Quote the whole configuration with any figure from this area, because the message count, body size, queue size, callback cost and timeout all move it. utils/measure_close_loss.py in the repository reproduces each of them.
Those deliveries are now passed to your callback instead, which is what the Java client does, as long as the channel is still open.
One thing follows for existing code: a consumer callback can now run for a message that arrives after you called basic_cancel, so a callback that assumed cancellation was immediate may see further deliveries. BlockingChannel.basic_cancel still rejects them for an auto_ack=False consumer, so they return to the queue at once as before, and its return value is unchanged; the channel no longer does that rejecting, the wrapper does. The generator-style BlockingChannel.cancel discards them instead, which #1767 covers.
channel.close() on an asynchronous adapter still discards those deliveriesA channel that is closing discards them, because a callback could not acknowledge one anyway and the attempt would abort the connection; the Java client discards them at the same point. Channel.close cancels each consumer without waiting for the broker to confirm, so this is what a bare channel.close() does on SelectConnection, AsyncioConnection, TornadoConnection and GeventConnection. A discarded delivery is redelivered to the next consumer with auto_ack=False and lost with auto_ack=True. Pika now logs a warning naming the count as the channel closes.
pika.Connection and BlockingConnection are unaffected and keep every delivery across a close, since both cancel their consumers and wait for the broker to confirm before closing anything. To get the same guarantee from an asynchronous adapter, cancel each consumer with a callback and close the channel from the last Basic.CancelOk; the channel documentation has the pattern. Pika 2.0 removes these adapters, which leaves Connection and its Channel as the only close path and so retires the gap rather than fixing it.
pika now refuses an inbound message whose body is larger than max_inbound_message_body_size, 64 MiB by default, and a frame larger than that limit or 128 KiB, whichever is greater. Either closes the connection with MessageBodyTooLargeError or FrameTooLargeError, both subclasses of AMQPConnectionError. The Java and .NET clients use the same 64 MiB default. RabbitMQ refuses messages above its own max_message_size, 16 MiB by default, so the limit is reached only when the broker is configured to allow larger messages.
If you consume larger messages, raise the limit with ConnectionParameters(max_inbound_message_body_size=...) or ?max_inbound_message_body_size= in a URL, up to 512 MiB, RabbitMQ's own maximum. A refused message delivered without auto_ack is requeued, so a consumer that reconnects is closed again: raise the limit, or dead-letter or remove the message on the broker. With auto_ack the broker has already discarded it. Returned messages and basic_get replies are checked too, so a publisher can be closed by its own oversized mandatory message coming back.
TwistedProtocolConnection reports why it closed, not ConnectionDoneWhen pika closes a Twisted connection, the reason now reaches the closed deferred, the on_close_callback, and pending channel and queue deferreds, as on the other adapters, instead of twisted.internet.error.ConnectionDone: ConnectionClosedByClient after close(), which is also what yield connection.close() returns; ConnectionClosedByBroker when the broker closes it; AMQPHeartbeatTimeout; ConnectionBlockedTimeout; and the size errors above. Code that traps or tests for ConnectionDone must handle these instead. A peer that drops the connection without pika closing it still reports ConnectionDone.
pika.compat is goneThe module is removed. It held Python 2 compatibility shims and platform checks, was never documented as public API, and nothing in pika imports it any more. It had no leading underscore, though, so it has been importable for years and an upgrade turns import pika.compat into ModuleNotFoundError.
Twelve of its names moved to pika._utils: ON_LINUX, ON_OSX, ON_WINDOWS, LINUX_VERSION, SOCKET_ERROR, HAVE_SIGNAL, RE_NUM, time_now(), as_bytes(), to_digit(), get_linux_version() and nonblocking_socketpair(). That module is private, so it is not a migration target; copy what you need instead. The four that are gone were Python 2 artefacts, and the standard library covers each: byte() (a bytes literal), long (int), AbstractBase (abc.ABC), str_or_bytes ((str, bytes)). pika.spec.str, which was str = bytes, goes with them.
pika.spec is now annotated, which may fail your type checkerPika ships a py.typed marker, so a type checker reads pika's own annotations. pika.spec is generated code and was previously excluded from pika's mypy configuration, which left every field of a decoded frame typed as Any. Any silences all checking, so a downstream mypy run that was clean can go red on upgrade without any change on your end. The most common line in every pika tutorial is affected:
error: Argument "delivery_tag" to "basic_ack" of "BlockingChannel" has incompatible type "int | None"; expected "int" [arg-type]
error: Argument "routing_key" to "basic_publish" of "BlockingChannel" has incompatible type "str | bytes | None"; expected "str" [arg-type]
Two properties of the generated code account for it. Every generated constructor defaults its arguments to None, so fields are optional even though a frame off the wire always carries them. And AMQP shortstr has no declared encoding, so pika falls back to raw bytes on invalid UTF-8, making routing_key, exchange and consumer_tag all str | bytes | None.
The errors are accurate and the annotations are an improvement, so nothing here should be reverted. The FAQ covers the narrowing idioms: https://pika.github.io/pika/latest/faq/
pyright users see little change, since it reported most of these already.
The same notes are in the changelog, which also carries the full version history: https://pika.github.io/pika/latest/changelog/
<!-- Release notes generated using configuration in .github/release.yml at 1.5.0rc3 -->
basic_cancel callback only on its own CancelOk by @alonfaraj in https://github.com/pika/pika/pull/1803Full Changelog: https://github.com/pika/pika/compare/1.5.0rc2...1.5.0rc3
If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
Eight changes are worth reading before you upgrade. Three can turn a passing build red, two change what a working application observes when it cancels a consumer or closes a channel, one refuses messages larger than 64 MiB, and one changes what the Twisted adapter reports when a connection closes.
pika.Connection is new, and is the connection to use1.5.0 introduces pika.Connection and its Channel, a connection that runs its own IOLoop on a background thread and offers a thread-safe blocking API that does not stall heartbeats while your code processes a message. There is nothing to migrate from: these classes are new in this release, and pika.Connection is the documented import.
from pika.adapters.thread_safe_connection import Connection also works, though the module moves in 2.0 (see #1681). Channel is not exported from pika, because channels come from Connection.channel().
If you are starting new code, use pika.Connection. If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
DeprecationWarning, which may fail your testsBlockingConnection, TornadoConnection, TwistedProtocolConnection and GeventConnection each warn from their constructor that they will be removed in Pika 2.0. They all still work.
The upgrade risk is that a DeprecationWarning raised from a constructor is a hard error for anyone running with warnings-as-errors, which is a common test configuration. It fires at construction, before any I/O, so it does not depend on reaching a broker:
E DeprecationWarning: BlockingConnection is deprecated and will be removed in Pika 2.0. ...
pika/adapters/blocking_connection.py:367: DeprecationWarning
The same happens under python -W error and warnings.simplefilter('error'). BlockingConnection is pika's most widely used entry point, so this is both likely and likely to be misread as pika being broken rather than as an intentional notice. Outside a test runner it is usually invisible, because Python's default filters hide DeprecationWarning unless it is triggered from __main__; pytest is what turns it back on.
Either filter it or migrate. The warning uses stacklevel=2, so it is reported against the line that constructs the connection rather than against pika, and a filter scoped to the pika module does not match. Match on the message instead:
# pyproject.toml, for pytest
filterwarnings = [
"ignore:.*will be removed in Pika 2\\.0:DeprecationWarning",
]python -W 'ignore:BlockingConnection is deprecated' your_app.pyThe two forms are not interchangeable. In filterwarnings the message is a regular expression, while -W on the command line, for python and for pytest alike, matches it as a literal prefix, so the pyproject.toml pattern given as a -W argument matches nothing and the warning still fails the run.
or migrate to Connection, which runs its own IOLoop on a background thread and provides a thread-safe blocking API that does not stall heartbeats on slow message processing.
A Basic.Cancel does not stop the broker immediately: the specification allows it to keep dispatching until it sends Basic.CancelOk, and pika used to reject every delivery that arrived in that window, or discard it outright for an auto_ack consumer. Discarding loses the message, because an auto_ack delivery has no copy left at the broker, and rejecting is a decision pika was making on your behalf that no other client makes. Measured on RabbitMQ 4.3.6, closing a channel with an auto_ack consumer half a second after its first delivery, 400 messages, work_queue_maxsize=50 and a 50 ms callback. At 8 KiB bodies with close(timeout=10): 339 of 400 lost before this change, 179 to 189 across five runs after it. close(timeout=None) loses none after the change, at either body size, and lost the same 339 before it, because that loss was the cancel window rather than the budget. At 64 bytes the deliveries still queued when a bounded close returns fit in the work queue, so the worker finishes them and nothing is lost; at 8 KiB they do not fit and the excess is discarded when the pool shuts. Quote the whole configuration with any figure from this area, because the message count, body size, queue size, callback cost and timeout all move it. utils/measure_close_loss.py in the repository reproduces each of them.
Those deliveries are now passed to your callback instead, which is what the Java client does, as long as the channel is still open.
One thing follows for existing code: a consumer callback can now run for a message that arrives after you called basic_cancel, so a callback that assumed cancellation was immediate may see further deliveries. BlockingChannel.basic_cancel still rejects them for an auto_ack=False consumer, so they return to the queue at once as before, and its return value is unchanged; the channel no longer does that rejecting, the wrapper does. The generator-style BlockingChannel.cancel discards them instead, which #1767 covers.
channel.close() on an asynchronous adapter still discards those deliveriesA channel that is closing discards them, because a callback could not acknowledge one anyway and the attempt would abort the connection; the Java client discards them at the same point. Channel.close cancels each consumer without waiting for the broker to confirm, so this is what a bare channel.close() does on SelectConnection, AsyncioConnection, TornadoConnection and GeventConnection. A discarded delivery is redelivered to the next consumer with auto_ack=False and lost with auto_ack=True. Pika now logs a warning naming the count as the channel closes.
pika.Connection and BlockingConnection are unaffected and keep every delivery across a close, since both cancel their consumers and wait for the broker to confirm before closing anything. To get the same guarantee from an asynchronous adapter, cancel each consumer with a callback and close the channel from the last Basic.CancelOk; the channel documentation has the pattern. Pika 2.0 removes these adapters, which leaves Connection and its Channel as the only close path and so retires the gap rather than fixing it.
pika now refuses an inbound message whose body is larger than max_inbound_message_body_size, 64 MiB by default, and a frame larger than that limit or 128 KiB, whichever is greater. Either closes the connection with MessageBodyTooLargeError or FrameTooLargeError, both subclasses of AMQPConnectionError. The Java and .NET clients use the same 64 MiB default. RabbitMQ refuses messages above its own max_message_size, 16 MiB by default, so the limit is reached only when the broker is configured to allow larger messages.
If you consume larger messages, raise the limit with ConnectionParameters(max_inbound_message_body_size=...) or ?max_inbound_message_body_size= in a URL, up to 512 MiB, RabbitMQ's own maximum. A refused message delivered without auto_ack is requeued, so a consumer that reconnects is closed again: raise the limit, or dead-letter or remove the message on the broker. With auto_ack the broker has already discarded it. Returned messages and basic_get replies are checked too, so a publisher can be closed by its own oversized mandatory message coming back.
TwistedProtocolConnection reports why it closed, not ConnectionDoneWhen pika closes a Twisted connection, the reason now reaches the closed deferred, the on_close_callback, and pending channel and queue deferreds, as on the other adapters, instead of twisted.internet.error.ConnectionDone: ConnectionClosedByClient after close(), which is also what yield connection.close() returns; ConnectionClosedByBroker when the broker closes it; AMQPHeartbeatTimeout; ConnectionBlockedTimeout; and the size errors above. Code that traps or tests for ConnectionDone must handle these instead. A peer that drops the connection without pika closing it still reports ConnectionDone.
pika.compat is goneThe module is removed. It held Python 2 compatibility shims and platform checks, was never documented as public API, and nothing in pika imports it any more. It had no leading underscore, though, so it has been importable for years and an upgrade turns import pika.compat into ModuleNotFoundError.
Twelve of its names moved to pika._utils: ON_LINUX, ON_OSX, ON_WINDOWS, LINUX_VERSION, SOCKET_ERROR, HAVE_SIGNAL, RE_NUM, time_now(), as_bytes(), to_digit(), get_linux_version() and nonblocking_socketpair(). That module is private, so it is not a migration target; copy what you need instead. The four that are gone were Python 2 artefacts, and the standard library covers each: byte() (a bytes literal), long (int), AbstractBase (abc.ABC), str_or_bytes ((str, bytes)). pika.spec.str, which was str = bytes, goes with them.
pika.spec is now annotated, which may fail your type checkerPika ships a py.typed marker, so a type checker reads pika's own annotations. pika.spec is generated code and was previously excluded from pika's mypy configuration, which left every field of a decoded frame typed as Any. Any silences all checking, so a downstream mypy run that was clean can go red on upgrade without any change on your end. The most common line in every pika tutorial is affected:
error: Argument "delivery_tag" to "basic_ack" of "BlockingChannel" has incompatible type "int | None"; expected "int" [arg-type]
error: Argument "routing_key" to "basic_publish" of "BlockingChannel" has incompatible type "str | bytes | None"; expected "str" [arg-type]
Two properties of the generated code account for it. Every generated constructor defaults its arguments to None, so fields are optional even though a frame off the wire always carries them. And AMQP shortstr has no declared encoding, so pika falls back to raw bytes on invalid UTF-8, making routing_key, exchange and consumer_tag all str | bytes | None.
The errors are accurate and the annotations are an improvement, so nothing here should be reverted. The FAQ covers the narrowing idioms: https://pika.github.io/pika/latest/faq/
pyright users see little change, since it reported most of these already.
The same notes are in the changelog, which also carries the full version history: https://pika.github.io/pika/latest/changelog/
--use-tls reach the xdist workers that run the tests by @lukebakken in #1784test_exchange durable in the publishing comparison by @lukebakken in #1785git helper when no root is given by @lukebakken in #1787ForwardServer subprocess with Process.kill() by @lukebakken in #1796Parameters by @lukebakken in #1797pika/spec.py from the docformatter recipes by @alonfaraj in #1793Full Changelog: 1.5.0rc1...1.5.0rc2
If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
Six changes are worth reading before you upgrade. Three can turn a passing build red, and two change what a working application observes when it cancels a consumer or closes a channel.
pika.Connection is new, and is the connection to use1.5.0 introduces pika.Connection and its Channel, a connection that runs its own IOLoop on a background thread and offers a thread-safe blocking API that does not stall heartbeats while your code processes a message. There is nothing to migrate from: these classes are new in this release, and pika.Connection is the documented import.
from pika.adapters.thread_safe_connection import Connection also works, though the module moves in 2.0 (see #1681). Channel is not exported from pika, because channels come from Connection.channel().
If you are starting new code, use pika.Connection. If you have existing code on one of the adapters below, it keeps working in 1.5.0 and the deprecation notice tells you where it is going.
DeprecationWarning, which may fail your testsBlockingConnection, TornadoConnection, TwistedProtocolConnection and GeventConnection each warn from their constructor that they will be removed in Pika 2.0. They all still work.
The upgrade risk is that a DeprecationWarning raised from a constructor is a hard error for anyone running with warnings-as-errors, which is a common test configuration. It fires at construction, before any I/O, so it does not depend on reaching a broker:
E DeprecationWarning: BlockingConnection is deprecated and will be removed in Pika 2.0. ...
pika/adapters/blocking_connection.py:367: DeprecationWarning
The same happens under python -W error and warnings.simplefilter('error'). BlockingConnection is pika's most widely used entry point, so this is both likely and likely to be misread as pika being broken rather than as an intentional notice. Outside a test runner it is usually invisible, because Python's default filters hide DeprecationWarning unless it is triggered from __main__; pytest is what turns it back on.
Either filter it or migrate. The warning uses stacklevel=2, so it is reported against the line that constructs the connection rather than against pika, and a filter scoped to the pika module does not match. Match on the message instead:
# pyproject.toml, for pytest
filterwarnings = [
"ignore:.*will be removed in Pika 2\\.0:DeprecationWarning",
]python -W 'ignore:BlockingConnection is deprecated' your_app.pyor migrate to Connection, which runs its own IOLoop on a background thread and provides a thread-safe blocking API that does not stall heartbeats on slow message processing.
A Basic.Cancel does not stop the broker immediately: the specification allows it to keep dispatching until it sends Basic.CancelOk, and pika used to reject every delivery that arrived in that window, or discard it outright for an auto_ack consumer. Discarding loses the message, because an auto_ack delivery has no copy left at the broker, and rejecting is a decision pika was making on your behalf that no other client makes. Measured on RabbitMQ 4.3.6, closing a channel with an auto_ack consumer half a second after its first delivery, 400 messages, work_queue_maxsize=50 and a 50 ms callback. At 8 KiB bodies with close(timeout=10): 339 of 400 lost before this change, 179 to 189 across five runs after it. close(timeout=None) loses none after the change, at either body size, and lost the same 339 before it, because that loss was the cancel window rather than the budget. At 64 bytes the deliveries still queued when a bounded close returns fit in the work queue, so the worker finishes them and nothing is lost; at 8 KiB they do not fit and the excess is discarded when the pool shuts. Quote the whole configuration with any figure from this area, because the message count, body size, queue size, callback cost and timeout all move it. utils/measure_close_loss.py in the repository reproduces each of them.
Those deliveries are now passed to your callback instead, which is what the Java client does, as long as the channel is still open.
One thing follows for existing code: a consumer callback can now run for a message that arrives after you called basic_cancel, so a callback that assumed cancellation was immediate may see further deliveries. BlockingChannel.basic_cancel still rejects them for an auto_ack=False consumer, so they return to the queue at once as before, and its return value is unchanged; the channel no longer does that rejecting, the wrapper does. The generator-style BlockingChannel.cancel discards them instead, which #1767 covers.
channel.close() on an asynchronous adapter still discards those deliveriesA channel that is closing discards them, because a callback could not acknowledge one anyway and the attempt would abort the connection; the Java client discards them at the same point. Channel.close cancels each consumer without waiting for the broker to confirm, so this is what a bare channel.close() does on SelectConnection, AsyncioConnection, TornadoConnection and GeventConnection. A discarded delivery is redelivered to the next consumer with auto_ack=False and lost with auto_ack=True. Pika now logs a warning naming the count as the channel closes.
pika.Connection and BlockingConnection are unaffected and keep every delivery across a close, since both cancel their consumers and wait for the broker to confirm before closing anything. To get the same guarantee from an asynchronous adapter, cancel each consumer with a callback and close the channel from the last Basic.CancelOk; the channel documentation has the pattern. Pika 2.0 removes these adapters, which leaves Connection and its Channel as the only close path and so retires the gap rather than fixing it.
pika.compat is goneThe module is removed. It held Python 2 compatibility shims and platform checks, was never documented as public API, and nothing in pika imports it any more. It had no leading underscore, though, so it has been importable for years and an upgrade turns import pika.compat into ModuleNotFoundError.
Twelve of its names moved to pika._utils: ON_LINUX, ON_OSX, ON_WINDOWS, LINUX_VERSION, SOCKET_ERROR, HAVE_SIGNAL, RE_NUM, time_now(), as_bytes(), to_digit(), get_linux_version() and nonblocking_socketpair(). That module is private, so it is not a migration target; copy what you need instead. The four that are gone were Python 2 artefacts, and the standard library covers each: byte() (a bytes literal), long (int), AbstractBase (abc.ABC), str_or_bytes ((str, bytes)). pika.spec.str, which was str = bytes, goes with them.
pika.spec is now annotated, which may fail your type checkerPika ships a py.typed marker, so a type checker reads pika's own annotations. pika.spec is generated code and was previously excluded from pika's mypy configuration, which left every field of a decoded frame typed as Any. Any silences all checking, so a downstream mypy run that was clean can go red on upgrade without any change on your end. The most common line in every pika tutorial is affected:
error: Argument "delivery_tag" to "basic_ack" of "BlockingChannel" has incompatible type "int | None"; expected "int" [arg-type]
error: Argument "routing_key" to "basic_publish" of "BlockingChannel" has incompatible type "str | bytes | None"; expected "str" [arg-type]
Two properties of the generated code account for it. Every generated constructor defaults its arguments to None, so fields are optional even though a frame off the wire always carries them. And AMQP shortstr has no declared encoding, so pika falls back to raw bytes on invalid UTF-8, making routing_key, exchange and consumer_tag all str | bytes | None.
The errors are accurate and the annotations are an improvement, so nothing here should be reverted. The FAQ covers the narrowing idioms: https://pika.github.io/pika/latest/faq/
pyright users see little change, since it reported most of these already.
The same notes are in the changelog, which also carries the full version history: https://pika.github.io/pika/latest/changelog/
pika/spec.py against codegen.py output in CI by @alonfaraj in #1695Basic.CancelOk to brokers that accept it by @suchitd in #1722main by @lukebakken in #1729CallbackManager.remove honor its remove-all docstring by @lukebakken in #1693_BoundedWorkPool work item raises by @lukebakken in #1756is_open and is_closed by @lukebakken in #1745AGENTS.md by @alonfaraj in #1665pika.compat by @lukebakken in #1776RELEASE.md the procedure, and move the reasoning out by @lukebakken in #1778DeliveryMode and enhance ExchangeType and exceptions by @alonfaraj in #1593Channel.close() for channels with multiple consumers by @gbenson in #1596DeliveryMode to inherit from IntEnum by @lukebakken in #1604rtype by @alonfaraj in #1626rtype removal lost in #1625 merge by @alonfaraj in #1629Channel.confirm_delivery: append ack/nack callback instead replace by @alonfaraj in #1630FA ruff rule and apply fixes by @alonfaraj in #1643RUF036 and ISC004 violations by @lukebakken in #1659Q) by @alonfaraj in #1662ThreadSafe* adapters. by @jholaj in #1651maxAge parameter from downloads badge by @alonfaraj in #1668type: ignore comments from three adapters by @lukebakken in #1670type: ignore comments by @lukebakken in #1672spec.py and drop its mypy exemption by @alonfaraj in #1674AbstractSelectorIOLoop a structural Protocol by @lukebakken in #1671callLater typing by passing keyword arguments" by @jeremycline in #1678float values as the AMQP d field type by @dylanpulver in Note truncated.
https://pypi.org/project/pika/1.4.4/ | GitHub milestone
https://pypi.org/project/pika/1.4.4/ | GitHub milestone
Merged pull requests:
https://pypi.org/project/pika/1.4.2/ | GitHub milestone
https://pypi.org/project/pika/1.4.2/ | GitHub milestone
Closed issues:
Merged pull requests:
https://pypi.org/project/pika/1.4.1/ | GitHub milestone
Fixing pika v1.0.0 breaking change (order of parameters) for the `cha… by @mprinc in https://github.com/pika/pika/pull/1393
https://pypi.org/project/pika/1.4.0/ | GitHub milestone
github.event.release.prerelease by @lukebakken in https://github.com/pika/pika/pull/1477basic_consumer_threaded example by @leogallot in https://github.com/pika/pika/pull/1507__all__ by @augustelalande in https://github.com/pika/pika/pull/1476ruff lint check to CI (GH-1371) by @lukebakken in https://github.com/pika/pika/pull/1551BlockingIOError from _read_interrupt on Windows (GH-1314) by @lukebakken in https://github.com/pika/pika/pull/1554PIKA_TEST_TLS env with pytest flag by @alonfaraj in https://github.com/pika/pika/pull/1572yapf formatter enforcement by @alonfaraj in https://github.com/pika/pika/pull/1573typing_extensions import by @lukebakken in https://github.com/pika/pika/pull/1574Full Changelog: https://github.com/pika/pika/compare/1.3.2...1.4.0
Implemented enhancements:
Closed issues:
exchange_exchange_bindings client capability #1530pytest #1469ruff and fix all findings #1371Merged pull requests:
typing_extensions import #1574 (lukebakken)yapf formatter enforcement #1573 (alonfaraj)PIKA_TEST_TLS env with pytest flag #1572 (alonfaraj)BlockingIOError from _read_interrupt on Windows (GH-1314) #1554 (lukebakken)ruff lint check to CI (GH-1371) #1551 (lukebakken)basic_consumer_threaded example #1507 (leogallot)__all__ #1476 (augustelalande)https://pypi.org/project/pika/1.3.2/ | GitHub milestone
https://pypi.org/project/pika/1.3.2/ | GitHub milestone
https://pypi.org/project/pika/1.3.1/ | GitHub milestone
https://pypi.org/project/pika/1.3.1/ | GitHub milestone
Closed issues:
Merged pull requests:
[pika]{.title-ref} uses [Semantic Versioning](https://semver.org)
https://pypi.org/project/pika/1.3.0/ | GitHub milestone
https://pypi.org/project/pika/1.3.0/ | GitHub milestone
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
https://pypi.org/project/pika/ GitHub milestone
https://pypi.org/project/pika/
GitHub Milestone
GitHub Milestone
GitHub milestone
Please refer to the `CHANGELOG`
Please refer to the CHANGELOG
AsyncioConnection, TornadoConnection and
TwistedProtocolConnection are no longer auto-imported
(PR)BlockingConnection.consume now returns (None, None, None) when
inactivity timeout is reached
(PR)all_channels parameter of the Channel.basic_qos method renamed
to global_qosglobal_ parameter of the Basic.Qos spec class renamed to
global_qosheartbeat_interval is removed, use heartbeat instead.basic_publish method is removed, and
publish renamed to basic_publishIMPORTANT: The signature of the following methods has changed from Pika 0.13.0. In general, the callback parameter that indicates completion of the method has been moved to the end of the parameter list to be consistent with other parts of Pika's API and with other libraries in general.
basic_cancelbasic_consumebasic_getbasic_qosbasic_recoverconfirm_deliveryexchange_bindexchange_declareexchange_deleteexchange_unbindflowqueue_bindqueue_declarequeue_deletequeue_purgequeue_unbindIMPORTANT: When specifying TLS / SSL options, the SSLOptions class
must be used, and a dict is no longer supported.
NOTE: beta release for version 1.0.0. This version has many API changes, please read the `CHANGELOG` and test your code thoroughly before using in pro
NOTE: beta release for version 1.0.0. This version has many API changes, please read the CHANGELOG and test your code thoroughly before using in production.
Nothing published for this version
Please refer to the `CHANGELOG`
Please refer to the CHANGELOG
Nothing published for this version
Please refer to the `CHANGELOG`
Please refer to the CHANGELOG
Please refer to the `CHANGELOG`
Please refer to the CHANGELOG
Please refer to the `CHANGELOG`
Please refer to the CHANGELOG
This is an interim release prior to version 1.0.0. It
includes the following backported pull requests and commits from the
master branch:
Commits:
Travis CI fail fast - 3f0e739
New features:
BlockingConnection.consume now returns (None, None, None) when
inactivity timeout is reached
(PR)
BlockingConnection now supports the add_callback_threadsafe method
which allows a function to be executed correctly on the IO loop thread.
The main use-case for this is as follows:
BlockingConnection and calls
basic_consume on itconnection.add_callback_threadsafe to call the basic_ack method
on the channel instance.Please see examples/basic_consumer_threaded.py for an example. As
always, SelectConnection and a fully async consumer/publisher is the
preferred method of using Pika.
Heartbeats are now sent at an interval equal to 1/2 of the negotiated idle connection timeout. RabbitMQ's default timeout value is 60 seconds, so heartbeats will be sent at a 30 second interval. In addition, Pika's check for an idle connection will be done at an interval equal to the timeout value plus 5 seconds to allow for delays. This results in an interval of 65 seconds by default.
Please refer to the changelog.
Please refer to the changelog.
Please refer to the changelog.
Please refer to the changelog.
This is an interim release prior to version 1.0.0. It includes the following backported pull requests and commits from the master branch:
This is an interim release prior to version 1.0.0. It includes the following backported pull requests and commits from the master branch:
Commits:
Travis CI fail fast - 3f0e739
Remove + character from platform releases string (PR)
+ character from platform releases string (PR)Fix BlockingConnection to ensure event loop exits (PR)
Deprecated the heartbeat_interval arg in pika.ConnectionParameters in favor of the heartbeat arg for consistency with the other connection parameters…
See GitHub milestone for the complete list of issues and pull requests in this release.
asyncio connection adapter for Python 3.4 and newer.Channel.basic_reject fixed to allow delivery_tag to be of type long
as well as int. (by quantum5)pika.connection.Connection. This feature is available to all pika adapters.
See pika.connection.ConnectionParameters docstring to learn more about
blocked_connection_timeout configuration.heartbeat_interval arg in pika.ConnectionParameters in
favor of the heartbeat arg for consistency with the other connection
parameters classes pika.connection.Parameters and pika.URLParameters.port arg is not set explicitly in ConnectionParameters
constructor, but the ssl arg is set explicitly, then set the port value to
to the default AMQP SSL port if SSL is enabled, otherwise to the default
AMQP plaintext port.URLParameters will raise ValueError if a non-empty URL scheme other than
{amqp | amqps | http | https} is specified.InvalidMinimumFrameSize and InvalidMaximumFrameSize exceptions are
deprecated. pika.connection.Parameters.frame_max property setter now raises
the standard ValueError exception when the value is out of bounds.type in Channel.exchange_declare and
BlockingChannel.exchnage_declare in favor of the exchange_type arg that
doesn't overshadow the builtin type keyword.ChannelAlreadyClosing; used to
raise ChannelClosed.ConnectionClosed if connection is not in OPEN
state.Channel.Close from broker
arrives while waiting for CloseOk, don't release the channel number until
CloseOk arrives to avoid race condition that may lead to a new channel
receiving the CloseOk that was destined for the closing channel.backpressure_detection option of ConnectionParameters and
URLParameters property is DEPRECATED in favor of Connection.Blocked and
Connection.Unblocked. See Connection.add_on_connection_blocked_callback.
- Simplify Travis CI configuration for OS X.
- Add [asyncio]{.title-ref} connection adapter for Python 3.4 and newer.
- Connection failures that occur after the socket is opened and before the AMQP connection is ready to go are now reported by calling the connection error callback. Previously these were not consistently reported.
- In BaseConnection.close, call _handle_ioloop_stop only if the connection is already closed to allow the asynchronous close operation to complete gracefully.
- Pass error information from failed socket connection to user callbacks on_open_error_callback and on_close_callback with result_code=-1.
- ValueError is raised when a completion callback is passed to an asynchronous (nowait) Channel operation. It's an application error to pass a non-None completion callback with an asynchronous request, because this callback can never be serviced in the asynchronous scenario.
- [Channel.basic_reject]{.title-ref} fixed to allow [delivery_tag]{.title-ref} to be of type [long]{.title-ref} as well as [int]{.title-ref}. (by quantum5)
- Implemented support for blocked connection timeouts in [pika.connection.Connection]{.title-ref}. This feature is available to all pika adapters. See [pika.connection.ConnectionParameters]{.title-ref} docstring to learn more about [blocked_connection_timeout]{.title-ref} configuration.
- Deprecated the [heartbeat_interval]{.title-ref} arg in [pika.ConnectionParameters]{.title-ref} in favor of the [heartbeat]{.title-ref} arg for consistency with the other connection parameters classes [pika.connection.Parameters]{.title-ref} and [pika.URLParameters]{.title-ref}.
- When the [port]{.title-ref} arg is not set explicitly in [ConnectionParameters]{.title-ref} constructor, but the [ssl]{.title-ref} arg is set explicitly, then set the port value to to the default AMQP SSL port if SSL is enabled, otherwise to the default AMQP plaintext port.
- [URLParameters]{.title-ref} will raise ValueError if a non-empty URL scheme other than {amqp | amqps | http | https} is specified.
- [InvalidMinimumFrameSize]{.title-ref} and [InvalidMaximumFrameSize]{.title-ref} exceptions are deprecated. pika.connection.Parameters.frame_max property setter now raises the standard [ValueError]{.title-ref} exception when the value is out of bounds.
- Removed deprecated parameter [type]{.title-ref} in [Channel.exchange_declare]{.title-ref} and [BlockingChannel.exchange_declare]{.title-ref} in favor of the [exchange_type]{.title-ref} arg that doesn't overshadow the builtin [type]{.title-ref} keyword.
- Channel.close() on OPENING channel transitions it to CLOSING instead of raising ChannelClosed.
- Channel.close() on CLOSING channel raises [ChannelAlreadyClosing]{.title-ref}; used to raise [ChannelClosed]{.title-ref}.
- Connection.channel() raises [ConnectionClosed]{.title-ref} if connection is not in OPEN state.
- When performing graceful close on a channel and [Channel.Close]{.title-ref} from broker arrives while waiting for CloseOk, don't release the channel number until CloseOk arrives to avoid race condition that may lead to a new channel receiving the CloseOk that was destined for the closing channel.
- The [backpressure_detection]{.title-ref} option of [ConnectionParameters]{.title-ref} and [URLParameters]{.title-ref} property is DEPRECATED in favor of [Connection.Blocked]{.title-ref} and [Connection.Unblocked]{.title-ref}. See [Connection.add_on_connection_blocked_callback]{.title-ref}.
Nothing published for this version
Over 150 commits from 22 contributors!
Notable changes:
- a9bf96d - LibevConnection: Fixed dict chgd size during iteration (Michael Laing)
- 388c55d - SelectConnection: Fixed KeyError exceptions in IOLoop timeout executions (Shinji Suzuki)
- 4780de3 - BlockingConnection: Add support to make BlockingConnection a Context Manager (@reddec)
f72b58f - Fixed failure to purge _ConsumerCancellationEvt from BlockingChannel._pending_events during basic_cancel. (Vitaly Kruglikov)
f72b58f - Fixed failure to purge _ConsumerCancellationEvt from BlockingChannel._pending_events during basic_cancel. (Vitaly Kruglikov)
Over 150 commits from 19 contributors
Notable changes:
BlockingConnection
adapter.Channel.add_on_return_callback callback's
signature.AsynchoreConnection adapter was retiredHigh-level summary of notable changes:
BlockingConnection adapter.Channel.add_on_return_callback callback's signature.AsyncoreConnection adapter was retiredDetails
Python 3.x: this release introduces python 3.x support. Tested on Python 3.3 and 3.4.
`AsyncoreConnection`: Retired this legacy adapter to reduce
maintenance burden; the recommended replacement is the
SelectConnection adapter.
`SelectConnection`: ioloop was refactored for compatibility with other ioloops.
`Channel.add_on_return_callback`: The callback is now passed the individual parameters channel, method, properties, and body instead of a tuple of those values for congruence with other similar callbacks.
`BlockingConnection`: This adapter underwent a makeover under the hood
and gained significant performance improvements as well as enhanced
timer resolution. It is now implemented as a client of the
SelectConnection adapter.
Below is an overview of the BlockingConnection and
BlockingChannel API changes:
Recursion: the new implementation eliminates callback recursion that sometimes blew out the stack in the legacy implementation (e.g., publish -> consumer_callback -> publish -> consumer_callback, etc.). While
BlockingConnection.process_data_eventsandBlockingConnection.sleepmay still be called from the scope of the blocking adapter's callbacks in order to process pending I/O, additional callbacks will be suppressed wheneverBlockingConnection.process_data_eventsandBlockingConnection.sleepare nested in any combination; in that case, the callback information will be bufferred and dispatched once nesting unwinds and control returns to the level-zero dispatcher.`BlockingConnection.connect`: this method was removed in favor of the constructor as the only way to establish connections; this reduces maintenance burden, while improving reliability of the adapter.
`BlockingConnection.process_data_events`: added the optional parameter
time_limit.`BlockingConnection.add_on_close_callback`: removed; legacy raised
NotImplementedError.`BlockingConnection.add_on_open_callback`: removed; legacy raised
NotImplementedError.`BlockingConnection.add_on_open_error_callback`: removed; legacy raised
NotImplementedError.`BlockingConnection.add_backpressure_callback`: not supported
`BlockingConnection.set_backpressure_multiplier`: not supported
`BlockingChannel.add_on_flow_callback`: not supported; per docstring in channel.py: "Note that newer versions of RabbitMQ will not issue this but instead use TCP backpressure".
`BlockingChannel.flow`: not supported
`BlockingChannel.force_data_events`: removed as it is no longer necessary following redesign of the adapter.
Removed the
nowaitparameter fromBlockingChannelmethods, forcingnowait=False(former API default) in the implementation; this is more suitable for the blocking nature of the adapter and its error-reporting strategy; this concerns the following methods:basic_cancel,confirm_delivery,exchange_bind,exchange_declare,exchange_delete,exchange_unbind,queue_bind,queue_declare,queue_delete, andqueue_purge.`BlockingChannel.basic_cancel`: returns a sequence instead of None; for a
no_ack=Trueconsumer,basic_cancelreturns a sequence of pending messages that arrived before broker confirmed the cancellation.`BlockingChannel.consume`: added new optional kwargs
argumentsandinactivity_timeout. Also, raises ValueError if the consumer creation parameters don't match those used to create the existing queue consumer generator, if any; this happens when you break out of the consume loop, then callBlockingChannel.consumeagain with different consumer-creation args without first cancelling the previous queue consumer generator viaBlockingChannel.cancel. The legacy implementation would silently resume consuming from the existing queue consumer generator even if the subsequentBlockingChannel.consumewas invoked with a different queue name, etc.`BlockingChannel.cancel`: returns 0; the legacy implementation tried to return the number of requeued messages, but this number was not accurate as it didn't include the messages returned by the Channel class; this count is not generally useful, so returning 0 is a reasonable replacement.
`BlockingChannel.open`: removed in favor of having a single mechanism for creating a channel (
BlockingConnection.channel); this reduces maintenance burden, while improving reliability of the adapter.`BlockingChannel.confirm_delivery`: raises UnroutableError when unroutable messages that were sent prior to this call are returned before we receive Confirm.Select-ok.
BlockingChannel.basic_publish: always returns True when delivery confirmation is not enabled (publisher-acks = off); the legacy implementation returned a bool in this case ifmandatory=Trueto indicate whether the message was delivered; however, this was non-deterministic, because Basic.Return is asynchronous and there is no way to know how long to wait for it or its absence. The legacy implementation returned None when publishing with publisher-acks = off andmandatory=False. The new implementation always returns True when publishing while publisher-acks = off.\`BlockingChannel.publish\`: a new alternate method (vs. `basic_publish`) for : publishing a message with more detailed error reporting via UnroutableError and NackError exceptions.
`BlockingChannel.start_consuming`: raises pika.exceptions.RecursionError if called from the scope of a
BlockingConnectionorBlockingChannelcallback.`BlockingChannel.get_waiting_message_count`: new method; returns the number of messages that may be retrieved from the current queue consumer generator via
BasicChannel.consumewithout blocking.
Commits
- 5aaa753 - Fixed SSL import and removed no_ack=True in favor of explicit AMQP message handling based on deferreds (skftn)
- 7f222c2 - Add checkignore for codeclimate (Gavin M. Roy)
- 4dec370 - Implemented BlockingChannel.flow; Implemented BlockingConnection.add_on_connection_blocked_callback; Implemented BlockingConnection.add_on_connection_unblocked_callback. (Vitaly Kruglikov)
- 4804200 - Implemented blocking adapter acceptance test for exchange-to-exchange binding. Added rudimentary validation of BasicProperties passthru in blocking adapter publish tests. Updated CHANGELOG. (Vitaly Kruglikov)
- 4ec07fd - Fixed sending of data in TwistedProtocolConnection (Vitaly Kruglikov)
- a747fb3 - Remove my copyright from forward_server.py test utility. (Vitaly Kruglikov)
- 94246d2 - Return True from basic_publish when pubacks is off. Implemented more blocking adapter accceptance tests. (Vitaly Kruglikov)
- 3ce013d - PIKA-609 Wait for broker to dispatch all messages to client before cancelling consumer in TestBasicCancelWithNonAckableConsumer and TestBasicCancelWithAckableConsumer (Vitaly Kruglikov)
- 293f778 - Created CHANGELOG entry for release 0.10.0. Fixed up callback documentation for basic_get, basic_consume, and add_on_return_callback. (Vitaly Kruglikov)
- 16d360a - Removed the legacy AsyncoreConnection adapter in favor of the recommended SelectConnection adapter. (Vitaly Kruglikov)
- 240a82c - Defer creation of poller's event loop interrupt socket pair until start is called, because some SelectConnection users (e.g., BlockingConnection adapter) don't use the event loop, and these sockets would just get reported as resource leaks. (Vitaly Kruglikov)
- aed5cae - Added EINTR loops in select_connection pollers. Addressed some pylint findings, including an error or two. Wrap socket.send and socket.recv calls in EINTR loops Use the correct exception for socket.error and select.error and get errno depending on python version. (Vitaly Kruglikov)
- 498f1be - Allow passing exchange, queue and routing_key as text, handle short strings as text in python3 (saarni)
- 9f7f243 - Restored basic_consume, basic_cancel, and add_on_cancel_callback (Vitaly Kruglikov)
- 18c9909 - Reintroduced BlockingConnection.process_data_events. (Vitaly Kruglikov)
- 4b25cb6 - Fixed BlockingConnection/BlockingChannel acceptance and unit tests (Vitaly Kruglikov)
- bfa932f - Facilitate proper connection state after BasicConnection._adapter_disconnect (Vitaly Kruglikov)
- 9a09268 - Fixed BlockingConnection test that was failing with ConnectionClosed error. (Vitaly Kruglikov)
- 5a36934 - Copied synchronous_connection.py from pika-synchronous branch Fixed pylint findings Integrated SynchronousConnection with the new ioloop in SelectConnection Defined dedicated message classes PolledMessage and ConsumerMessage and moved from BlockingChannel to module-global scope. Got rid of nowait args from BlockingChannel public API methods Signal unroutable messages via UnroutableError exception. Signal Nack'ed messages via NackError exception. These expose more information about the failure than legacy basic_publich API. Removed set_timeout and backpressure callback methods Restored legacy
is_open, etc. property names (Vitaly Kruglikov)- 6226dc0 - Remove deprecated --use-mirrors (Gavin M. Roy)
- 1a7112f - Raise ConnectionClosed when sending a frame with no connection (#439) (Gavin M. Roy)
- 9040a14 - Make delivery_tag non-optional (#498) (Gavin M. Roy)
- 86aabc2 - Bump version (Gavin M. Roy)
- 562075a - Update a few testing things (Gavin M. Roy)
- 4954d38 - use unicode_type in blocking_connection.py (Antti Haapala)
- 133d6bc - Let Travis install ordereddict for Python 2.6, and ttest 3.3, 3.4 too. (Antti Haapala)
- 0d2287d - Pika Python 3 support (Antti Haapala)
- 3125c79 - SSLWantRead is not supported before python 2.7.9 and 3.3 (Will)
- 9a9c46c - Fixed TestDisconnectDuringConnectionStart: it turns out that depending on callback order, it might get either ProbableAuthenticationError or ProbableAccessDeniedError. (Vitaly Kruglikov)
- cd8c9b0 - A fix the write starvation problem that we see with tornado and pika (Will)
- 8654fbc - SelectConnection - make interrupt socketpair non-blocking (Will)
- 4f3666d - Added copyright in forward_server.py and fixed NameError bug (Vitaly Kruglikov)
- f8ebbbc - ignore docs (Gavin M. Roy)
- a344f78 - Updated codeclimate config (Gavin M. Roy)
- 373c970 - Try and fix pathing issues in codeclimate (Gavin M. Roy)
- 228340d - Ignore codegen (Gavin M. Roy)
- 4db0740 - Add a codeclimate config (Gavin M. Roy)
- 7e989f9 - Slight code re-org, usage comment and better naming of test file. (Will)
- 287be36 - Set up _kqueue member of KQueuePoller before calling super constructor to avoid exception due to missing _kqueue member. Call
self._map_event(event)instead ofself._map_event(event.filter), becauseKQueuePoller._map_event()assumes it's getting an event, not an event filter. (Vitaly Kruglikov)- 62810fb - Fix issue #412: reset BlockingConnection._read_poller in BlockingConnection._adapter_disconnect() to guard against accidental access to old file descriptor. (Vitaly Kruglikov)
- 03400ce - Rationalise adapter acceptance tests (Will)
- 9414153 - Fix bug selecting non epoll poller (Will)
- 4f063df - Use user heartbeat setting if server proposes none (Pau Gargallo)
- 9d04d6e - Deactivate heartbeats when heartbeat_interval is 0 (Pau Gargallo)
- a52a608 - Bug fix and review comments. (Will)
- e3ebb6f - Fix incorrect x-expires argument in acceptance tests (Will)
- 294904e - Get BlockingConnection into consistent state upon loss of TCP/IP connection with broker and implement acceptance tests for those cases. (Vitaly Kruglikov)
- 7f91a68 - Make SelectConnection behave like an ioloop (Will)
- dc9db2b - Perhaps 5 seconds is too agressive for travis (Gavin M. Roy)
- c23e532 - Lower the stuck test timeout (Gavin M. Roy)
- 1053ebc - Late night bug (Gavin M. Roy)
- cd6c1bf - More BaseConnection._handle_error cleanup (Gavin M. Roy)
- a0ff21c - Fix the test to work with Python 2.6 (Gavin M. Roy)
- 748e8aa - Remove pypy for now (Gavin M. Roy)
- 1c921c1 - Socket close/shutdown cleanup (Gavin M. Roy)
- 5289125 - Formatting update from PR (Gavin M. Roy)
- d235989 - Be more specific when calling getaddrinfo (Gavin M. Roy)
- b5d1b31 - Reflect the method name change in pika.callback (Gavin M. Roy)
- df7d3b7 - Cleanup BlockingConnection in a few places (Gavin M. Roy)
- cd99e1c - Rename method due to use in BlockingConnection (Gavin M. Roy)
- 7e0d1b3 - Use google style with yapf instead of pep8 (Gavin M. Roy)
- 7dc9bab - Refactor socket writing to not use sendall #481 (Gavin M. Roy)
- 4838789 - Dont log the fd #521 (Gavin M. Roy)
- 765107d - Add Connection.Blocked callback registration methods #476 (Gavin M. Roy)
- c15b5c1 - Fix _blocking typo pointed out in #513 (Gavin M. Roy)
- 759ac2c - yapf of codegen (Gavin M. Roy)
- 9dadd77 - yapf cleanup of codegen and spec (Gavin M. Roy)
- ddba7ce - Do not reject consumers with no_ack=True #486 #530 (Gavin M. Roy)
- 4528a1a - yapf reformatting of tests (Gavin M. Roy)
- e7b6d73 - Remove catching AttributError (#531) (Gavin M. Roy)
- 41ea5ea - Update README badges [skip ci] (Gavin M. Roy)
- 6af987b - Add note on contributing (Gavin M. Roy)
- 161fc0d - yapf formatting cleanup (Gavin M. Roy)
- edcb619 - Add PYPY to travis testing (Gavin M. Roy)
- 2225771 - Change the coverage badge (Gavin M. Roy)
- 8f7d451 - Move to codecov from coveralls (Gavin M. Roy)
- b80407e - Add confirm_delivery to example (Andrew Smith)
- 6637212 - Update base_connection.py (bstemshorn)
- 1583537 - #544 get_waiting_message_count() (markcf)
- 0c9be99 - Fix #535: pass expected reply_code and reply_text from method frame to Connection._on_disconnect from Connection._on_connection_closed (Vitaly Kruglikov)
- d11e73f - Propagate ConnectionClosed exception out of BlockingChannel._send_method() and log ConnectionClosed in BlockingConnection._on_connection_closed() (Vitaly Kruglikov)
- 63d2951 - Fix #541 - make sure connection state is properly reset when BlockingConnection._check_state_on_disconnect raises ConnectionClosed. This supplements the previously-merged PR #450 by getting the connection into consistent state. (Vitaly Kruglikov)
- 71bc0eb - Remove unused self.fd attribute from BaseConnection (Vitaly Kruglikov)
- 8c08f93 - PIKA-532 Removed unnecessary params (Vitaly Kruglikov)
- 6052ecf - PIKA-532 Fix bug in BlockingConnection._handle_timeout that was preventing _on_connection_closed from being called when not closing. (Vitaly Kruglikov)
- 562aa15 - pika: callback: Display exception message when callback fails. (Stuart Longland)
- 452995c - Typo fix in connection.py (Andrew)
- 361c0ad - Added some missing yields (Robert Weidlich)
- 0ab5a60 - Added complete example for python twisted service (Robert Weidlich)
- 4429110 - Add deployment and webhooks (Gavin M. Roy)
- 7e50302 - Fix has_content style in codegen (Andrew Grigorev)
- 28c2214 - Fix the trove categorization (Gavin M. Roy)
- de8b545 - Ensure frames can not be interspersed on send (Gavin M. Roy)
- 8fe6bdd - Fix heartbeat behaviour after connection failure. (Kyösti Herrala)
- c123472 - Updating BlockingChannel.basic_get doc (it does not receive a callback like the rest of the adapters) (Roberto Decurnex)
- b5f52fb - Fix number of arguments passed to _on_return callback (Axel Eirola)
- 765139e - Lower default TIMEOUT to 0.01 (bra-fsn)
- 6cc22a5 - Fix confirmation on reconnects (bra-fsn)
- f4faf0a - asynchronous publisher and subscriber examples refactored to follow the StepDown rule (Riccardo Cirimelli)
bb583bf - Remove the deprecated test (Gavin M. Roy)
Connection._connect method, which was an internal only method is now deprecated and will raise a DeprecationWarning. If you relied on this method, you…
Major Changes
Backwards Incompatible Changes
Bugfixes
Other
New timeout id hashing was not unique
Address inconsistent channel close callback documentation and add the signature change to the TwistedChannel class
Bugfixes
Fix timeout in twisted adapter (Submitted by cellscape)
Bugfixes
** Behavior changes **
Only remove the tornado_connection.TornadoConnection file descriptor from the IOLoop if it\'s still open (Issue #221)
Bugfixes
Channel.queue_declare/BlockingChannel.queue_declare not setting up callbacks property for empty queue name (Issue #218)
Bugfixes
Added the exchange \"type\" parameter back but issue a DeprecationWarning
New features
examples/blocking_consumer_generator{.interpreted-text role="doc"}
for example)Changes
Bugfixes
BlockingChannel.start_consuming() and BlockingChannel.stop_consuming()
New features
Major bugfix areas
Removals
Scope changes with adapter IOLoops and CallbackManager allowing for cleaner, multi-threaded operation
Changelog
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.