- new: add custom exchanges to rpc pattern #377 by @cloud-rocket
- Fix restore bug of RobustChannel #578 by @aozupek
- Fix bug with RPC when handling
on_close
with a RobustConnection #573 by @CodeCorrupt
- Fix reopen of robust channel after close #571 by @decaz. Fixes #570
- URL params passing to aiormq #569
Connection.KWARGS_TYPES
renamed toConnection.PARAMETERS
and rework it todataclass
Connection._parse_kwargs
renamed toConnection._parse_parameters
- AMQP URL parameters documentation article
- Fix race condition in RobustChannel in reopen/ready #566 by @isra17
- use fork friendly random robust queue generation way #560
- Ported publisher confirms tutorial by @MaPePeR #550
- Fixed errored response when
aio_pika.patterns.RPC
can not serialize the result #552
- Fix badges in docs
- Fix readthedocs build file
The bulk of the changes are related to how the library entities are now
interconnected. In previous versions of aio_pika.Channel
instances not
contains a link to the aio_pika.Connection
instances for now is contains it.
While I don't want custom code to work directly with the aiormq.Channel
instance, this was a public API and I should warn you about the change here.
The aio_pika.Channel.channel
property is deprecated. Use
aio_pika.Channel.get_underlay_chanel()
instead.
Now all library entities already use this method.
- Update aiormq version
- Amend Exchange.repr to include class name #527 Also switch to f-strings rather than %-formatting, modelled after Queue.repr.
- Update example code of rpc tutorial #530
- bugfix: kwargs not working in
aio_pika.connect_robust
#531 - Improve type hints for
queue.get()
#542
- Prevent 'Task exception was never retrieved' #524 If future.exception() is not called (even on cancelled futures), it seems Python will then log 'Task exception was never retrieved'. Rewriting this logic slightly should hopefully achieve the same functionality while preventing the Python errors.
- Avoid implicitly depending on setuptools #526
- fix README badge
- upgrade requirements
- RPCs: Show exceptions on Host (remote side) #503
- Fixed queue_name was set as channel_name for
patterns/master.py
#523
- Do not nack if consumer is no_ack in QueueIterator #521
- change classifiers in pyproject.toml
The main goal of this release is the migration to poetry
and stronger type
checking with mypy.
User code should remain compatible, just test it with mypy. The tests still work the same, without public API changes, this indicates that your code should work without changes, but does not prove it.
aio_pika.message.HeaderProxy
- removedaio_pika.message.header_converter
- removedaio_pika.message.format_headers
- removedaio_pika.message.Message.headers_raw
- prints deprecation warningaio_pika.abc.AbstractMessage.headers_raw
- removed
- Update
aiormq~=6.6.3
#512 - Fix getting futures exceptions #509
- Fix memory leaks around channel close callbacks #496
- Fastest way to reject all messages when queue iterator is closing #498
- Fix memory leak when callback collections is chaining #495
- Prevent "Task exception was never retrieved" on timeout #492
- Fix memory leaks on channel close #491
- allow passing ssl_context to the connection #474. A default parameter has been added to the public API, this does not break anything unless your code relies on the order of the arguments.
- Generated anonymous queue name may conflict #486
- improve typing in multiple library actors #478
- Bump
aiormq~=6.4.0
withconnection blocking
feature Connection.update_secret
method (#481)
- cannot use client_properties issue #469
- linter fixes in
aio_pika.rpc.__all__
- aio_pika.rpc fix for
TypeError: invalid exception object
for future
Release notes
In this release, there are many changes to the internal API and bug fixes related to sudden disconnection and correct recovery after reconnection.
Unfortunately, the behavior that was in version 7.x was slightly affected. It's the reason the major version has been updated.
The entire set of existing tests passes with minimal changes, therefore, except for some minor changes in behavior, the user code should work either without any modifications or with minimal changes, such as replacing removed deprecated functions with alternatives.
This release has been already tested in a working environment, and now it seems that we have completely resolved all the known issues related to recovery after network failures.
Changes:
- Added tests for unexpected network connection resets and fixed many related problems.
- Added
UnderlayChannel
andUnderlayConneciton
, this isNamedTuple
s contains all connection and channel related properties. Theaiormq.Connection
andaiormq.Channel
objects are now packaged in thisNamedTuple
s and can be atomically assigned toaio_pika.Connection
andaio_pika.Channel
objects. The main benefit is the not needed to add locks during the connection, in the best case, the container object is assigned to callee as usual, however, if something goes wrong during the connection, there is no need to clear something inaio_pika.RobustConnection
oraio_pika.RobustChannel
. - An
__init__
method is now a part of abstract classes for mostaio_pika
entities. - Removed explicit relations between
aio_pika.Channel
andaio_pika.Connection
. Now you can't get aaio_pika.Connection
instance from theaio_pika.Channel
instance. - Fixed a bug that caused the whole connection was closed when a timeout occurred in one of the channels, in case the channel was waiting for a response frame to an amqp-rpc call.
- Removed deprecated
add_close_callback
andremove_close_callback
methods inaio_pika.Channel
. Useaio_pika.Channel.close_callbacks.add(callback, ...)
andaio_pika.Channel.close_callbacks.remove(callback, ...)
instead. - Fixed a bug in
aio_pika.RobustChannel
that causeddefault_exchane
broken after reconnecting. - The
publisher_confirms
property ofaio_pika.Channel
is public now. - Function
get_exchange_name
is public now. - Fixed an error in which the queue iterator could enter a deadlock state, with a sudden disconnection.
- The new entity
OneShotCallback
helps, for example, to call all the closing callbacks at the channel if theConnection
was unexpectedly closed, and the channel closing frame did not come explicitly.
- Make
aio_pika.patterns.rpc
more extendable.
- Fixes in documentation
This release brings support for a new version of aiormq
, which is used as
a low-level driver for working with AMQP.
The release contains a huge number of changes in the internal structure of the library, mainly related to type inheritance and abstract types, as well as typehints checking via mypy.
The biggest change to the user API is the violation of the inheritance order, due to the introduction of abstract types, so this release is a major one.
- There are a lot of changes in the structure of the library, due to the widespread use of typing.
aio_pika.abc
module now contains all types and abstract class prototypes.- Modern
aiormq~=6.1.1
used. - Complete type checks coverage via mypy.
- The interface of
aio_pika
's classes has undergone minimal changes, but you should double-check your code before migrating, at least because almost all types are now inaio_pika.abc
. Moduleaio_pika.types
still exists, but will produce aDeprecationWarning
. - Default value for argument
weak
is changed toFalse
inCallbackCollection.add(func, weak=False)
.
-
pamqp.specification
module didn't exist inpamqp==3.0.1
so you have to change it:pamqp.commands
for AMPQ-RPC–relates classespamqp.base
forFrame
classpamqp.body
forContentBody
classpamqp.commands
forBasic
,Channel
,Confirm
,Exchange
,Queue
,Tx
classes.pamqp.common
forFieldArray
,FieldTable
,FieldValue
classespamqp.constants
for constants likeREPLY_SUCCESS
.pamqp.header
forContentHeader
class.pamqp.heartbeat
forHeartbeat
class.
-
Type definitions related to imports from
aio_pika
might throw warnings like'SomeType' is not declared in __all__
. This is a normal situation, since now it is necessary to import types fromaio_pika.abc
. In this release, these are just warnings, but in the next major release, this will stop working, so you should take care of changes in your code.Just use
aio_pika.abc
in your imports.The list of deprecated imports:
from aio_pika.message import ReturnCallback
from aio_pika.patterns.rpc import RPCMessageType
- renamed toRPCMessageTypes
import aio_pika.types
- module deprecated useaio_pika.abc
insteadfrom aio_pika.connection import ConnectionType
- explicit
Channel.is_user_closed
property - user-friendly exception when channel has been closed
- reopen channels which are closed from the broker side
- Fix flapping test test_robust_duplicate_queue #424
- Fixed callback on_close for rpc #424
- fix: master deserialize types #366
- fix: add missing type hint on exchange publish method #370
- Return self instead of select result in
__aenter__
#373 - fix: call remove_close_callback #374
- Fix breaking change in callback definition #344
- Reworked tests and finally applied PR #311
- Improve documentation examples and snippets #339
- Restore RobustChannel.default_exchange on reconnect #340
- Improve the docs a bit #335
- Add generics to Pool and PoolItemContextManager #321
- Fix Docs for
DeliveryError
#322
- message.reject called inside ProcessContext.exit fails when channel is closed #302
- Add docs and github links to setup.py #304
- Type annotation fixes
- Add documentation
- Test fixes
- Add reopen method for channel #263
- Add get methods for exchange and queue #282
- fix type annotation and documentation for Connection.add_close_callback #290
- log channel close status
- add OSError to
CONNECTION_EXCEPTIONS
- [fix] heartbeat_last to heartbeat_last_received #274
- Fix memory leak #285
- Fix type hint #287
- Pass loop when connecting to aiormq #294
- RobustConnection cleanup fixes #273
- aiormq updates:
- Update tests for python 3.8
Pool.close()
method and allow to usePool
as a context manager #269- Fix stuck of
RobustConnection
when exclusive queues still locked on server-side #267 - Add
global_
parameter toChannel.set_qos
method #266 - Fix
Connection.drain()
isNone
Fix connection drain
- passing
client_properties
- Allow str as an exchange type #260
- Added typing on process method #252
- Documentation fixes
- Missed timeout parameter on
connect()
#245
- Unified
CallbackCollection
s for channels and connections - Make RobustConnection more robust
JsonRPC
andJsonMaster
adapters- Improve patterns documentation
- Extended ExchangeType #237. Added
x-modulus-hash
exchange type.
RobustConnection
logic changes (see #234). Thanks to @decaz for analysis and fixes.
- add more type annotations
- consistent setting headers for message #233
- Fixes: set header value on HeaderProxy #232
- Fixed #218. How to properly close RobustConnection?
- Fixed #216. Exception in Queue.consume callback isn't propagated properly.
- Allow to specify
requeue=
andreject_on_redelivered=
in Master pattern #212
- Fixed #209 int values for headers
- update aiormq version
- use
AMQPError
instead ofAMQPException
.AMQPException
is now alias forAMQPError
- Fix routing key handling (#206 @decaz)
- Fix URL building (#207 @decaz)
- Test suite for
connect
function
- Fix tests for
Pool
- no duplicate call message when exception
- add robust classes to apidoc
- use None instead of Elipsis for initial state (@chibby0ne)
Pool
: enable arguments for pool constructor (@chibby0ne)- Create py.typed (#176 @zarybnicky)
- Fix encode timestamp error on copy (#198 @tzoiker)
- Bump
aiormq
- Fix HeaderProxy bug (#195 @tzoiker)
- remove non-initialized channels when reconnect
- robust connection close only when unclosed
heartbeat_last
property
- Simple test suite for testing robust connection via tcp proxy
- robust connection initialization hotfix
- Connector is now
aiormq
and notpika
- Remove vendored
pika
- Compatibility changes:
- [HIGH] Exceptions hierarchy completely changed:
UnroutableError
removed. UseDeliveryError
instead.ConnectionRefusedError
is now standardConnectionError
- Each error code has separate exception type.
- [LOW]
Connection.close
method requires exception instead ofcode
reason
pair orNone
- [MEDIUM]
IncomingMessage.ack
IncomingMessage.nack
IncomingMessage.reject
returns coroutines. Old usage compatible but event loop might throw warnings. - [HIGH]
Message.timestamp
property is nowdatetime.datetime
- [LOW] Tracking of
publisher confirms
removed, using similar feature fromaiormq
instead. - [LOW] non async context manager
IncomingMessage.process()
is deprecated. Useasync with message.process():
instead.
- [HIGH] Exceptions hierarchy completely changed:
- Fix race condition on callback timeout #180
- Add abstract pool #174
- Fixed Deprecation Warnings in Python 3.7 #153
- Migrate from travis to drone.io
- Use pylava instead of pylama
- save passive flag on reconnect #170
- fixed inconsistent argument type for connection.connect #136
- fixed conditions for creating SSL connection. #135
- Fix UnboundLocalError exception #163
- RobustConnection fixes #162
- Fix code examples in the README.rst
- Close connection in examples
- Add content_type for all patterns
- Add special exceptions for Worker
- More extendable Master
- Fix #112
- Fix #155
- Add default params for RPC.cereate()
- Fix InvalidStateError when connection lost
- Fix: RPC stuck when response deserialization error
- Drop python 3.4 support
- prevent
set_results
on cancelled future #133 - Added asynchronous context manager support for channels #130
- BUGFIX: ChannelClosed exception was never retrieved
- BUGFIX: handle coroutine double wrapping for Python 3.4
- added example for URL which contains ssl required options.
ssl_options
for coonect and connect_robust- default ports for
amqp
andamqps
- python 3.4 fix
- Add
message_kwargs
for worker pattern
- Added
timeout
parameter forExchange.declare
- QueueEmpty exception public added to the module
__all__
- Ability to reconnect on Channel.Close
- Ability to reconnect on Channel.Cancel
- Rollback to pika==0.10 because new one had issues.
- Feature: abillity to use ExternalCredentials with blank login.
- Bugfix: _on_getempty should delete _on_getok_callback #110. (thank's to @dhontecillas)
- Fixes for pyflakes
- Rework transactions
- Use pika's asyncio adapter
- Rework robust connector
- Ability to disable robustness for single queue in
rubust_connect
mode. - Ability to pass exchage by name.
- Added
python_requires=">3.4.*, <4",
instead ofif sys.version_info
in thesetup.py
- Change
TimeoutError
to theasyncio.TimeoutError
- Allow to bind queue by exchange name
- Added
extras_require = {':python_version': 'typing >= 3.5.3',
to thesetup.py
aio_pika.patterns
submoduleaio_pika.patterns.RPC
- RPC patternaio_pika.patterns.Master
- Master/Worker pattern
passive
argument for excahnge
Channel.is_closed
propertyChannel.close
just returnNone
when channel already closedConnection
might be used inasync with
expressionQueue
might be used inasync with
and returnsQueueIterator
- Changing examples
Queue.iterator()
methodQueueIterator.close()
returnsasyncio.Future
instead ofasyncio.Task
- Ability to use
QueueIterator
inasync for
expression connect_robust
is acoroutine
instead of function which returns a coroutine (PyCharm type checking display warning instead)- add tests
- Improve documentation. Add examples for connection and channel
Conneciton.close
returnsasyncio.Task
instead coroutine.connect_robust
now is function instead ofpartial
.