# Delayed consumption or delayed dispatching of a rabbitmq message

**URL:** <https://discourse.nameko.io/t/delayed-consumption-or-delayed-dispatching-of-a-rabbitmq-message/411>\
**Category:** Uncategorized\
**Created:** [March 19, 2019, 6:05am UTC](https://discourse.nameko.io/t/delayed-consumption-or-delayed-dispatching-of-a-rabbitmq-message/411 "2019-03-19T06:05:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrmoud](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/shrmoud/32/26_2.png) [@shrmoud](https://discourse.nameko.io/u/shrmoud)\
**Post date:** [March 19, 2019, 6:05am UTC](https://discourse.nameko.io/t/delayed-consumption-or-delayed-dispatching-of-a-rabbitmq-message/411/1 "2019-03-19T06:05:14Z")

</div>

rabbitmq-delayed-message-exchange

> **[rabbitmq/rabbitmq-delayed-message-exchange](https://github.com/rabbitmq/rabbitmq-delayed-message-exchange)**
>
> Delayed Messaging for RabbitMQ. Contribute to rabbitmq/rabbitmq-delayed-message-exchange development by creating an account on GitHub.

Is there any planning to support this rabbitmq feature? I tried looking in the [https://github.com/nameko/nameko/blob/master/nameko/messaging.py](https://github.com/nameko/nameko/blob/master/nameko/messaging.py) but couldn’t find anything that allows delayed consumption of a rabiitmq message.

---

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [March 19, 2019, 2:32pm UTC](https://discourse.nameko.io/t/delayed-consumption-or-delayed-dispatching-of-a-rabbitmq-message/411/2 "2019-03-19T14:32:46Z")

</div>

You can already use this plugin in conjunction with Nameko’s `Publisher` DependencyProvider.

First you’d declare an exchange as `type=x-delayed-message`, then use the `x-delay` header when publishing. Something like this:

```auto
from kombu.messaging import Exchange

exchange = Exchange(type="x-delayed-message")

class Service:
    name = "delayed_message"

    publish = Publisher(exchange=exchange, headers={"x-delay": 100}) # default delay

    def method(self, delay):
        self.publish("payload", ..., headers={"x-delay": delay}) # override delay

```

---

<div class="post-metadata">

**Author:** ![evansmwendwa](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/evansmwendwa/32/36_2.png) [@evansmwendwa](https://discourse.nameko.io/u/evansmwendwa)\
**Post date:** [December 8, 2019, 10:00am UTC](https://discourse.nameko.io/t/delayed-consumption-or-delayed-dispatching-of-a-rabbitmq-message/411/3 "2019-12-08T10:00:44Z")

</div>

Is this still valid and can it work with the default dispatcher and event\_handler?
