Changelog¶
All notable changes to this project will be documented in this file.
Unreleased¶
2.0.0 – 2025-11-18¶
Breaking Changes¶
Major Breaking Changes¶
These are breaking changes we believe are most likely to effect your project.
The
fail_fastargument toStubBroker.joinnow defaults to True. This means that callingStubBroker.join, will by default, re-raise any Exceptions that caused messages to get dead-lettered (i.e. any uncaught Exceptions in your actor functions). You may need to explicitly catch these exception in your tests (e.g. withunittest.TestCase.assertRaises()orpytest.raises()).Alternatively, you can revert to the old behavior by passing
fail_fast_default=FalsetoStubBroker.However, we think the new default behavior is best, because it makes exceptions happening in your actor functions obvious in your tests. Previsouly, exceptions in your actor functions could pass silently, and potentially unnoticed unless you checked the side-effects of the actor. (#739, #758, @LincolnPuzey)
The
Prometheusmiddleware is no longer in the default middleware list. To keep exporting the Prometheus statistics, you must now install theprometheusextra (e.g.pip install 'dramatiq[prometheus]') and add thePrometheusmiddleware (see Customizing Middleware). If you are not using the Promotheus statistics, no action is needed. (#95, #345, #688, @azmeuk)The
backendargument to theResultsmiddleware is now required. Previously, not supplying this argument would result in a non-functionalResultsmiddleware. (#728, @LincolnPuzey)
Minor Breaking Changes¶
These are changes that while technically breaking, we believe are unlikely to effect your project.
Removed
URLRabbitmqBroker. This has been deprecated since version 1.1.0. UseRabbitmqBrokerwithurlas a keyword argument instead. (#786, @LincolnPuzey)Removed the
devinstallable extra from the project metadata. Instead the development dependencies are defined in a PEP-735[dependency-groups]table inpyproject.toml. These can be installed in development environments withpip install --group dev. (#766, @LincolnPuzey)The
keysargument toRateLimiterBackend.incr_and_summust now be a callable that returns a list of keys. This is only relevant if you have written custom code (such as a custom Rate Limiter) that uses aRateLimiterBackend. (#741, #772, @mikeroll)The deprecated
requeue_deadlineandrequeue_intervalarguments ofRedisBrokerhave been removed. These have been deprecated and have had no effect since version 1.2.0. (#782, @mikeroll)RedisBroker: The code for compatibility with pre-v1.2.0 acks has been removed. If you are using theRedisBroker, you must first upgrade Dramatiq to a version >=1.2.0, <2.0.0, and run it for some time, before upgrading to a version >=2.0.0. This is to allow Dramatiq to migrate the pre-v1.2.0 ack data structures in redis to the v1.2.0+ versions. This migration code is what has been removed in version 2.0.0. (#771, @mikeroll)
Fixed¶
Fixed the way that backoff time is calculated for retries so that the first backoff is not less than
min_backoff. This means that each retry backoff is now, on average, twice as long. To avoid this effect, you can halve yourmin_backoff(which should now be correctly observed). (#651, #721, @LincolnPuzey)Fixed the RabbitMQ broker making 1 more retry than configured when declaring queues or enqueueing messages fail due to connection errors. 1 fewer retries are now made. This fixes a regression introduced by #669 released in
1.18.0. (#734, @LincolnPuzey)When adding middleware to a Broker that already has actors declared, call the
after_declare_actormiddleware hook with the correct argument. (#743, @jenstroeger)Made dramatiq robust against non-numeric values for the
etaoption. This should only be necessary when manually enqueuing messages. (#759, #761, @gurelkaynak)Fixed edge case where the
StubBroker.joinwould try to raiseNoneas an exception. (#763, @LincolnPuzey)
Added¶
Add Python 3.14 to test matrix and project classifiers. (#751, @LincolnPuzey) Things to be aware of when upgrading to Python 3.14:
Python 3.14 changes the default multiprocessing start method to forkserver on some platforms. Dramatiq Workers use multiprocessing and will be effected by this change.
forkservershould be less bug-prone than the old defaultfork. However, if you run into weird issues, using the existing--use-spawnflag when starting Dramatiq to set the start method tospawn, might solve them.The free-threaded build of Python is now officially supported by Python. Dramatiq is not yet unit-tested with free-threaded Python, but we hope to do so soon. In the meantime, if you have any success or problems running Dramatiq with free-threaded Python, we would love to hear about it.
Added type annotations for the external API of the
WorkerandBrokerclasses. (#727, #731, #744, @jenstroeger)Added type annotations for the external API of the
Middlewareclass and its subclasses. (#521, #735, @jenstroeger)Added
message_datetimeproperty to theMessageclass to retrievemessage_timestampas an awaredatetime.datetimeinstance. (#736, @karolinepauls)Added
dramatiq_worker_timeoutenvironment variable. (#773, @ksoviero-zengrc)
Changed¶
Promoted
ConsumerThreadandWorkerThreadclasses to public names, since they are used in theMiddlewareinterface type hints. The previous names_ConsumerThreadand_WorkerThreadare still available for backwards compatibility. (#760, @synweap15)Increased the minimum
redis-pylibrary version to4.0.0. (#738, #764, @LincolnPuzey)
Removed¶
Removed support for Python 3.9. (#784, @LincolnPuzey)
Packaging¶
The project now defines a PEP-518 build backend in the
pyproject.tomlfile. (#750, @LincolnPuzey)
Documentation¶
Improved documentation relating to middleware. (#718, @LincolnPuzey, #723, @karolinepauls)
Add documentation section about asyncio support. (#595, #719, @LincolnPuzey)
Improved documentation about prioritizing messages with the
priorityargument of anactor. (#724, #725, @LincolnPuzey)Add documentation section about environment variables. (#720, @LincolnPuzey)
Improve documentation for
before_enqueueandafter_enqueueMiddlewarehooks. (#753, @karolinepauls)
1.18.0 – 2025-05-29¶
Fixed¶
Make sure RabbitMQ Broker enqueue() attempts the correct number of preset retries. (#668, #669, @jenstoeger)
Fix
MessageResult type variable to be covariant. (#685, @alecbarber)Fixed unexpected restarts when using
--watchoption. (#654, #696, @LincolnPuzey)Fixed using actor decorator in the interactive shell. (#694, #695, @bartvanandel)
Fix
join_queue(andStubBroker) compatibility with gevent 25.4.1. (#699, @synweap15)Close write_pipe after forking to fix hangs on Worker shutdown. (#693, #707, @dansimko)
Added¶
Add repr to
MessageProxyclass. (#690, @karolinepauls)Add
--worker-fork-timeoutcommand-line argument to configure time to wait for the worker processes to come online after forking. (#706, @guedesfelipe)Log a warning when added a duplicate middleware class, since this can lead to unexpected behavior. (#709, @synweap15)
Changed¶
Removed¶
Documentation¶
1.17.1 – 2024-10-26¶
Fixed¶
Added¶
Changed¶
The actor decorator now checks for duplicate actor names. (#640, #641, @z0z0r4)
The Retries middleware now tracks when a message was last requeued on retry. (#629, @kuba-lilz)
1.17.0 – 2024-05-09¶
Added¶
Middleware hooks for after consumer & worker thread boot. (#619, @kamalmarhubi)
Changed¶
The =watch= extras now require Watchdog version 4.0+.
Fixed¶
The
python_requiresversion insetup.py. (#606, @niccodemus)The result middleware now takes message options into account. (#612, @huwylphimet)
1.16.0 – 2024-01-25¶
Fixed¶
The
CurrentMessagemiddleware now works under AsyncIO. (#586, #593, @pahrohfit)Improved logging behavior under different buffer modes. (#596, @5tefan)
Added¶
1.15.0 – 2023-10-23¶
Fixed¶
The
global_brokervariable is now type hinted. (@jenstroeger)Pipeline result retrieval works with non-default brokers. (#563, #564, @DiegoPomares)
Added¶
Asyncio support. (#536, @caspervdw)
Changed¶
1.14.2 – 2023-03-25¶
Fixed¶
Restored
namedtupleinstance methods onMessage. (#538)
1.14.1 – 2023-02-25¶
Fixed¶
Added missing
py.typedfile to distributions. (#531)
1.14.0 – 2023-02-05¶
Removed¶
Dropped Python 3.6 support as it reached end-of-life
Changed¶
1.13.0 – 2022-04-02¶
Fixed¶
Changed¶
Typing support has been improved. (#482, @staticdev)
The default broker now falls back to Redis if the RabbitMQ extras are not installed, in an attempt to make the getting started process easier. (#483, #486, @kurtmckee)
1.12.3 – 2022-01-16¶
Fixed¶
An issue where signals remained blocked after worker process boot. (#465, #466, @FinnLidbetter)
1.12.2 – 2022-01-14¶
Fixed¶
An issue where stopping the process too quickly after boot could lead to an
AttributeError. (#463, #464, @FinnLidbetter)
1.12.1 – 2021-12-19¶
Fixed¶
Actors and messages can now specify 0 backoff. (@FinnLidbetter, #438)
An issue where Redis message ids could be put back onto the queue after ack/nack. (#442, #444)
Removed¶
Dropped Python 3.5 support as it reached end-of-life
1.12.0 – 2021-10-23¶
Added¶
RabbitMQ messages now have a
redeliveredflag. (#405, @nffdiogosilva)Time limits now work under gevent. (#408, @FinnLidbetter)
Shutdown notifications now work under gevent. (#426, @FinnLidbetter)
Changed¶
The
watchdoglibrary is no longer being pinned to a specific version. (#428)The redis broker now limits unpacks to half the size of the Lua stack. (#433, #434, @ethervoid)
Fixed¶
Async exceptions now correctly set the thread id on Python 3.7 and up. (#419, #420, @FinnLidbetter)
1.11.0 – 2021-05-22¶
Added¶
decodenow raises a new error,DecodeError, on exception. (#375, @thomazthz)
Changed¶
The RabbitMQ broker moves messages that fail to decode to the DLQ. (#375, @thomazthz)
Fixed¶
The Redis broker is now more defensive in how it handles re-enqueueing messages. This should fix a potential race condition where a worker could hit its heartbeat timeout but still end up re-enqueueing messages (thus ending up with the same message id enqueued multiple times). (#266, #395)
A code path that could lead to an unbound variable error has now been fixed. (#382)
Deleting the connection off of a
RabbitMQbroker now correctly closes it and its associated channel (if any) before removing it from the broker. (#381, #384)
1.10.0 – 2020-12-21¶
Added¶
The RabbitMQ broker dead message TTL can now be configured via the
dramatiq_dead_message_ttlenvironment variable. (#354, @evstratbg)The CLI now supports referencing a callable to set up the broker on worker startup. (#350)
Changed¶
Fixed¶
The CLI now returns code
1when one of the workers is killed by an unhandled signal. (#334, @omegacoleman)The results middleware now gracefully handles actor-not-found errors during nack. (#336, #337, @AndreCimander)
A memory bloat issue with tasks that raise exceptions. (#351)
1.9.0 – 2020-06-08¶
Added¶
A custom Redis connection can now be passed to the Redis broker via the new
clientkeyword argument. (#274, @davidt99)Message priority can now be changed in
before_enqueuehooks. (#313, @thomazthz)Support for storing actor exceptions. (#156)
Support for expected exceptions via the
throwsactor option. (#303, @takhs91)Support for changing the consumer class in the RabbitMQ and Redis brokers. (#316, @AndreCimander)
Changed¶
Fixed¶
1.8.1 – 2020-02-02¶
Fixed¶
An issue where an
IndexErrorwould be raised when multiple middlewre containing fork functions were defined. (#271)
1.8.0 – 2020-02-02¶
Added¶
Support for forking and running arbitrary functions (so-called “fork functions”). (#127, #230)
The
--fork-functionflag.The
--skip-loggingflag. (#263, @whalesalad)
Fixed¶
An issue where the
max_ageparameter toAgeLimitwas being ignored. (#240, @evstratbg)An issue with delaying pipelines. (#264, @synweap15)
An issue where the master process would sometimes hang when stopped. (#260, @asavoy)
An issue where the
RedisBrokercould sometimes prefetch more messages than it was configured to. (#262, @benekastah)The
StubBrokernow flushes its dead letter queue when itsflush_allmethod is called. (#247, @CapedHero)The
RedisBrokernow takes the max lua stack size into account. This should fix certain heisenbugs that folks have encountered with that broker. (#259, @benekastah)
Changed¶
The
RabbitmqBrokernow creates its queues lazily. (#163, #270, @timdrijvers)The
Prometheusmiddleware no longer depends on file locking to start its exposition server. Instead, it uses the new fork functions functionality to start the server in a separate, unique process. The middleware no longer takes any parameters. While this would normally be a breaking change, it appears those parameters were previously ignored anyway. (#127, #230)
1.7.0 – 2019-09-22¶
Added¶
Generic actors can now be passed custom actor registires. (#223, @jonathanlintott)
--use-spawncommand line argument. (#227, #228, @jrusso1020)
Changed¶
1.6.1 – 2019-07-24¶
Added¶
RabbitmqBrokernow supports multiple connection uris to be passed in via itsurlparameter. (#216, @wsantos)
Changed¶
1.6.0 – 2019-05-02¶
Added¶
dramatiq_queue_prefetch environment variable to control the number of messages to prefetch per worker process. (#183, #184, @xelhark)
The RabbitMQ broker now retries the queue declaration process if an error occurs. (#179, @davidt99)
Support for accessing nested broker instances from the CLI. (#191, @bersace)
Support for eagerly raising actor exceptions in the joining thread with the
StubBroker. (#195, #203)Support for accessing the current message from an actor via
CurrentMessage. (#208)
Changed¶
Pinned pika version >1.0,<2.0. (#202)
Fixed¶
An issue where workers would fail and never recover after the connection to Redis was severed. (#207)
pipe_ignorehas been fixed to apply to the next message in line within a pipeline. (#194, @metheoryt)
1.5.0 – 2019-02-18¶
Added¶
The RabbitMQ broker now supports native message priorities. (#157, @davidt99)
Support for specifying the actor class to
actor. (#169, @gilbsgilbs)
Changed¶
Pika 0.13 is now required.
Fixed¶
1.4.3 – 2019-01-08¶
Fixed¶
Changed license classifier to the correct license. This is why you shouldn’t publish changed before you’ve had coffee, folks!
1.4.2 – 2019-01-08¶
Fixed¶
License classifier in PyPI package. There were no source code changes for this release.
1.4.1 – 2018-12-30¶
Added¶
Support for redis-py 3.x. (#142, @maerteijn)
Fixed¶
1.4.0 – 2018-11-25¶
Added¶
Changed¶
cli.mainnow takes an optional argument namespace so that users may define their own entrypoints. (#140, @maerteijn)Actor “message received” and “completed in x ms” log messages are now logged with the
DEBUGlevel instead ofINFOlevel. This improves throughput and makes logging much less verbose.The
TimeLimitmiddleware no longer uses signals to trigger time limit handling. Instead it uses a background thread per worker process.Dramatiq now shuts itself down if any of the workers die unexpectedly (for example, if one of them is killed by the OOM killer).
Windows is now supported (with some caveats)! (#119, @ryansm1)
Fixed¶
1.3.0 – 2018-07-05¶
Changed¶
Fixed¶
1.2.0 – 2018-05-24¶
Added¶
Support for worker heartbeats to
RedisBroker.maintenance_chanceandheartbeat_timeoutparameters toRedisBroker.Interruptbase class for thread-interrupting exceptions. (@rpkilby)ShutdownNotificationsmiddleware. (@rpkilby)
Changed¶
TimeLimitExceededis now a subclass ofInterrupt.
Fixed¶
StubBroker.joinandWorker.joinare now more reliable.Module import path is now prepended to search path rather than appended. This fixes an issue where importing modules with the same name as modules from site-packages would end up importing the modules from site-packages. (#88)
Prometheusmiddleware no longer wipes the prometheus data directory on startup. This fixes an issue with exporting application metrics along with worker metrics.
Deprecated¶
requeue_{deadline,interval}parameters toRedisBroker. These two parameters no longer have any effect.
1.1.0 – 2018-04-17¶
Added¶
confirm_deliveryparameter toRabbitmqBroker.dead_message_ttl,requeue_deadlineandrequeue_intervalparameters toRedisBroker.urlparameter toRedisrate limiter backend.urlparameter toRedisresult backend.timeoutparameter to all the brokers’joinmethods. (#57)flushandflush_allmethods toRedisBroker. (#62)flushandflush_allmethods toRabbitmqBroker. (#62)
Changed¶
Cleaned up command line argument descriptions.
Deprecated¶
URLRabbitmqBrokeris deprecated. TheRabbitmqBrokertakes aurlparameter so use that instead.URLRabbitmqBrokerwill be removed in version 2.0.
Fixed¶
rabbitmqandwatchextra dependencies are only installed when they are explicitly required now. (#60, @rpkilby)signal handling from the master process on FreeBSD 10.3. (#66)
reloading now uses
sys.executablewhen exec’ing workers that were started withpython -m dramatiq.an issue that caused logging to fail when non-utf-8 characters were printed to stdout/err. (#63)
an issue with potentially drifting keys in the
WindowRateLimiter. (#69, @gdvalle)
1.0.0 – 2018-03-31¶
Added¶
--log-filecommand line argument. (#43, @najamansari)--pid-filecommand line argument. (#43, @najamansari)
Changed¶
Dramatiq is now licensed under the LGPL.
Fixed¶
Passing
time_limitinsend_with_options. (#44)
0.20.0 – 2018-03-17¶
Added¶
--queuesCLI argument. (#35)
Changed¶
Unhandled errors within workers now print the full stack trace. (#42)
0.19.1 – 2018-03-08¶
Fixed¶
0.19.0 – 2018-01-17¶
Added¶
Changed¶
RateLimitExceedederrors no longer log the full stack trace when raised within workers.Consumer connection errors no longer dump a stack trace.
Consumers now wait exactly 3 seconds between retries after a connection error, rather than using exponential backoff.
0.18.0 – 2018-01-06¶
Added¶
pip install dramatiq[all]installs all deps.--pathcommand line argument. (#27)
Changed¶
pip install dramatiqnow installs RabbitMQ and watch deps.
0.17.0 – 2017-12-30¶
Added¶
Fixed¶
Pinned pika version 0.11 to avoid an issue where passing
heartbeattoRabbitmqBrokeringet_brokerwould raise aTypeError. (#23, @chen2aaron)
0.16.0 – 2017-12-25¶
Added¶
long_runningexample.schedulingexample.ResultBackendsnow support pluggableEncoders.
Changed¶
Redisresult backend is now considerably more resource-efficient (it no longer polls).sys.std{err,out}are now redirected to stderr and line-buffered.
Fixed¶
TimeLimitmiddleware now uses a monotonic clock.
0.15.1 – 2017-12-08¶
Fixed¶
Autoreload now works under gevent.
0.15.0 – 2017-11-24¶
Added¶
Fixed¶
Fixed bad file descriptor issue during RMQ broker shutdown under gevent.
0.14.0 – 2017-11-21¶
Added¶
Logging statements before and after an actor is called.
Fixed¶
class-based actorsbehave more like normal Python classes now. (#15)
0.13.1 – 2017-11-17¶
Changed¶
Connection and import errors that occur during process boot now log stack traces (@rakanalh).
Added support for Python 3.5 (#7 by @jssuzanne).
0.13.0 – 2017-11-15¶
Added¶
Support for
class-based actors(#9).
0.12.1 – 2017-11-15¶
Fixed¶
An
AssertionErrorafter starting the consumer if RabbitMQ is not running (#10).
0.12.0 – 2017-11-14¶
Added¶
urlparameter toRedisBroker.
Fixed¶
Pending interrupt messages are now removed from pika’s queue before cancel is called. This fixes an issue where an
AtrributeErrorwas sometimes raised on worker shutdown.Pika connection reset logs from the main thread are now hidden.
Distribution of
dramatiq-gevent(#2).
0.11.0 – 2017-11-09¶
Added¶
SkipMessagemiddleware error.after_skip_messagemiddleware hook.joinnow takes optionalmin_successesandidle_timeparameters.
Changed¶
Consumer reconnect backoff factor has been lowered from 10s to 100ms.
URLRabbitmqBrokeris now a factory function that creates instances ofRabbitmqBroker.
Fixed¶
Worker processes no longer use a spinlock to consume messages.
Consumers now use the same idle timeout as workers.
StubBrokerno longer declares dead letter queues.
0.10.2 – 2017-11-06¶
Changed¶
pikais now pinned to>=0.10,<0.12.
0.10.1 – 2017-11-04¶
Added¶
More benchmarks.
Fixed¶
StubBroker.flush_allnow flushes delay queues.
0.10.0 – 2017-10-30¶
Added¶
URLRabbitmqbroker(@whalesalad).StubBroker
StubBroker.flushandStubBroker.flush_all.before_consumer_thread_shutdownmiddleware hook.before_worker_thread_shutdownmiddleware hook.
Changed¶
Implementation of the window rate limiter has been streamlined.
Redis requeue is now more efficient.
RabbitMQ enqueue is now resilient to disconnects.
Fixed¶
dramatiq-geventpackaging (@bendemaree).
0.9.0 – 2017-10-20¶
Changed¶
Messages are no longer assigned new ids when they are re-enqueued. This makes tracking messages using middleware significantly easier.
The RedisBroker now assigns its own internal message ids.
0.8.0 – 2017-10-19¶
Changed¶
RabbitmqBroker no longer takes a ConnectionParameters param as input. Instead, it builds one based on kwargs.
execis now used to reload the main process on source code changes when the--watchflag is enabled.
0.7.1 – 2017-10-08¶
Fixed¶
Lua files are now properly distributed with the package.
0.7.0 – 2017-09-13¶
Changed¶
Reworked scheduled messages to improve fairness. Messages are now re-enqueued on the broker once they hit their eta.
prometheus-clienthas been pinned to version0.0.20.
0.6.1 – 2017-07-20¶
Fixed¶
A race condition with calls to
casin the memcached rate limiter backend.
0.6.0 – 2017-07-09¶
Added¶
beforeandafterarguments toadd_middleware.Support for
RateLimiters.
0.5.2 – 2017-06-29¶
Changed¶
Changed the default max retries value from
Noneto20, meaning tasks are now retried for up to about 30 days before they’re dead-lettered by default.
0.5.1 – 2017-06-28¶
Removed¶
Dropped RabbitMQ heartbeat to avoid spurious disconnects.
0.5.0 – 2017-06-27¶
Added¶
Added
dramatiq-geventscript.
Changed¶
Capped prefetch counts to 65k.
Franz — Desktop Client for Apache Kafka
Podcatcher — iOS Podcast Player