介绍
RabbitMQ的官方推出了一个插件,原生支持延迟消息功能。该插件的原理是设计了一种支持延迟消息功能的交换机。当消息投递到交换机后可以暂存一定时间,到期后再投递到队列。
查看版本号
docker exec rabbit名字 rabbitmqctl version
根据版本下载
插件下载地址
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
拷贝到容器
docker cp /etc/local/rabbitmq/rabbitmq_delayed_message_exchange-3.13.0.ez rabbit:/plugins/
进入容器
docker exec -it rabbit /bin/bash
启用插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
Enabling plugins on node rabbit@my-rabbit:
rabbitmq_delayed_message_exchange
The following plugins have been configured:
rabbitmq_delayed_message_exchange
rabbitmq_federation
rabbitmq_management
rabbitmq_management_agent
rabbitmq_prometheus
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@my-rabbit...
The following plugins have been enabled:
rabbitmq_delayed_message_exchange