Last active
August 29, 2015 14:19
-
-
Save maiha/66731ab1088751b12cb1 to your computer and use it in GitHub Desktop.
RabbitMQ: delayed_message_exchange plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # enable plugin | |
| % rabbitmq-plugins enable rabbitmq_delayed_message_exchange | |
| # declare exchange | |
| % rabbitmqadmin declare exchange name=delayed type=x-delayed-message arguments='{"x-delayed-type":"direct"}' | |
| # declare queue | |
| % rabbitmqadmin declare queue name=q1 | |
| # binding | |
| % rabbitmqadmin declare binding source=delayed destination=q1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # publish a message with 10 sec delayed | |
| % rabbitmqadmin publish routing_key='' exchange=delayed payload=hello properties='{"headers":{"x-delay":10000}}' | |
| Message published but NOT routed | |
| % rabbitmqadmin list queues | |
| +------+----------+ | |
| | name | messages | | |
| +------+----------+ | |
| | q1 | 0 | | |
| +------+----------+ | |
| # 10 sec after | |
| % rabbitmqadmin list queues | |
| +------+----------+ | |
| | name | messages | | |
| +------+----------+ | |
| | q1 | 1 | | |
| +------+----------+ | |
| % rabbitmqadmin get queue=q1 | |
| +-------------+----------+---------------+---------+---------------+------------------+-------------+ | |
| | routing_key | exchange | message_count | payload | payload_bytes | payload_encoding | redelivered | | |
| +-------------+----------+---------------+---------+---------------+------------------+-------------+ | |
| | | delayed | 0 | hello | 5 | string | False | | |
| +-------------+----------+---------------+---------+---------------+------------------+-------------+ | |
| # w00t!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment