Source code for dramatiq.middleware.middleware

[docs]class Middleware: """Base class for broker middleware. The default implementations for all hooks are no-ops and subclasses may implement whatever subset of hooks they like. """ @property def actor_options(self): """The set of options that may be configured on each actor. """ return set()
[docs] def before_ack(self, broker, message): """Called before a message is acknowledged. """
[docs] def after_ack(self, broker, message): """Called after a message has been acknowledged. """
[docs] def before_nack(self, broker, message): """Called before a message is rejected. """
[docs] def after_nack(self, broker, message): """Called after a message has been rejected. """
[docs] def before_declare_actor(self, broker, actor): """Called before an actor is declared. """
[docs] def after_declare_actor(self, broker, actor): """Called after an actor has been declared. """
[docs] def before_declare_queue(self, broker, queue_name): """Called before a queue is declared. """
[docs] def after_declare_queue(self, broker, queue_name): """Called after a queue has been declared. """
[docs] def after_declare_delay_queue(self, broker, queue_name): """Called after a delay queue has been declared. """
[docs] def before_enqueue(self, broker, message, delay): """Called before a message is enqueued. """
[docs] def after_enqueue(self, broker, message, delay): """Called after a message has been enqueued. """
[docs] def before_delay_message(self, broker, message): """Called before a message has been delayed in worker memory. """
[docs] def before_process_message(self, broker, message): """Called before a message is processed. """
[docs] def after_process_message(self, broker, message, *, result=None, exception=None): """Called after a message has been processed. """
[docs] def after_process_boot(self, broker): """Called immediately after subprocess start up. """
[docs] def before_worker_boot(self, broker, worker): """Called before the worker processes starts up. """
[docs] def after_worker_boot(self, broker, worker): """Called after the worker process has started up. """
[docs] def before_worker_shutdown(self, broker, worker): """Called before the worker process shuts down. """
[docs] def after_worker_shutdown(self, broker, worker): """Called after the worker process shuts down. """