Changelog

0.2.2 (2025-12-07)

Fixed

  • yapw.clients.Async closes the RabbitMQ connection regardless of the manage_ioloop argument.

0.2.1 (2025-11-20)

Added

  • yapw.clients.Async accepts a manage_ioloop argument, to control whether the client manages the event loop (run, stop, signal handlers).

0.2.0 (2025-11-19)

Changed

  • yapw.clients.Async no longer raises NotImplementedError if the exchange_ready method isn’t overridden.

0.1.5 (2025-11-19)

Added

  • yapw.clients.Async accepts a custom_ioloop argument, to pass to pika.adapters.asyncio_connection.AsyncioConnection.

  • yapw.clients.Async sets a ready attribute to True before calling exchange_ready(). Usage:

    import functools
    
    from yapw import methods
    from yapw.clients import Async
    
    
    class Extension:
        def __init__(self):
            self.client = Async()
    
        def open(self):
            self.client.start()
    
        def write(self, message):
            cb = functools.partial(self.when_ready, self.client.publish, {"message": message}, "my_routing_key")
            methods.add_callback_threadsafe(self.client.connection, cb)
    
        def when_ready(self, callback, *args):
            if self.client.ready:
                callback(*args)
            else:
                self.client.connection.ioloop.call_soon(self.when_ready, callback, *args)
    

    In this example, the Extension class implements an imaginary framework’s extension API: open() and write(). It’s possible that open() is called (which begins a series of callbacks to declare an exchange), and then write() is called before the exchange is declared. So, the when_ready method checks whether the exchange is declared using the client’s ready attribute; if not, it reschedules the callback at the next iteration of the event loop.

0.1.4 (2024-01-24)

Changed

  • Remove log message for declaring exchange.

  • Remove yapw.clients.Base.__getsafe__.

Fixed

  • If the client attempts to close the connection while it is opening, do not retry opening the connection.

  • Reset the client’s state, before scheduling the reconnection, rather than immediately before reconnecting.

0.1.3 (2023-07-03)

Changed

0.1.2 (2023-07-02)

Added

  • Restore Python 3.10 support.

0.1.1 (2023-07-02)

Fixed

  • Fix logging of exchange type.

0.1.0 (2023-07-02)

Added

Changed

BREAKING CHANGES:

  • Use subclasses instead of mixins, to share logic between synchronous and asynchronous clients with less code.

  • Move __init__ arguments from other classes to the Base class.

  • Move the publish method from the Blocking class to the Base class.

  • Move and rename install_signal_handlers from yapw.ossignal to yapw.clients.Base.add_signal_handlers class.

  • Move the default_decode method from the yapw.decorators module to the yapw.util module.

  • Rename the callback positional argument for the consumer callback to on_message_callback, to avoid ambiguity.

  • Rename the yapw.methods.blocking module to the yapw.methods module.

  • Merge the Publisher and Threaded classes into the Blocking class.

  • Merge the Durable and Transient classes into the Blocking class, as a durable keyword argument.

Non-breaking changes:

  • Pending futures are cancelled during graceful shutdown.

  • Use callbacks to communicate with the main thread from other threads, instead of sending SIGUSR1 or SIGUSR2 signals.

  • The signal handlers for the Blocking class are installed before the consumer starts, instead of during initialization.

  • Don’t attempt to catch the pika.exceptions.ConnectionClosedByBroker exception in the yapw.clients.Blocking.consume() method (can’t be caught).

  • Drop Python 3.7, 3.8, 3.9, 3.10 support.

0.0.13 (2022-01-28)

Fixed

  • Make thread management thread-safe in yapw.clients.Threaded.

0.0.12 (2022-01-27)

Fixed

  • Eliminate a memory leak in yapw.clients.Threaded.

0.0.11 (2022-01-27)

Added

  • yapw.clients.Publisher.declare_queue and yapw.clients.Threaded.consume() accept an arguments keyword argument.

0.0.10 (2022-01-24)

Fixed

  • yapw.clients.Threaded.consume() cleans up threads and closes the connection (regression in 0.0.9).

0.0.9 (2022-01-24)

Fixed

  • yapw.clients.Threaded.consume() no longer attempts to close a closed connection.

0.0.8 (2022-01-19)

Added

0.0.7 (2022-01-18)

Added

0.0.6 (2022-01-17)

Added

  • yapw.clients.Publisher.declare_queue and yapw.clients.Consumer.consume(): Rename the routing_key argument to queue, and add a routing_keys optional argument.

Changed

  • Log a debug message when consuming each message.

0.0.5 (2021-11-22)

Added

  • yapw.clients.Threaded accepts a decode keyword argument.

  • All yapw.decorators functions pass decoded messages to consumer callbacks.

Changed

0.0.4 (2021-11-19)

Added

  • yapw.clients.Publisher (and children) accepts encoder and content_type keyword arguments.

Changed

  • Use the SIGUSR1 signal to kill the process from a thread.

  • Add the channel number to the debug message for publish().

0.0.3 (2021-11-19)

Added

Changed

  • Rename yapw.decorators.rescue() to discard().

0.0.2 (2021-11-19)

Added

Changed

  • Pass a state object with a connection attribute to the consumer callback, instead of a connection object. Mixins can set a __safe__ class attribute to list attributes that can be used safely in the consumer callback. These attributes are added to the state object.

  • Log debug messages when publishing, consuming and acknowledging messages.

0.0.1 (2021-11-19)

First release.