RabbitMQ 消息传递 - 初始化消费者 [英] RabbitMQ messaging - initializing consumer

查看:40
本文介绍了RabbitMQ 消息传递 - 初始化消费者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 RabbitMQ 将对象的状态持续广播给可能正在监听的任何消费者.我想设置它以便当消费者订阅时它会选择最后一个可用状态......这可能吗?

I want to use RabbitMQ to broadcast the state of an object continuously to any consumers which maybe listening. I want to set it up so when a consumer subscribes it will pick up the last available state... Is this possible?

推荐答案

使用自定义的最后一个值缓存交换:例如https://github.com/squaremo/rabbitmq-lvc-plugin

Use a custom last value cache exchange: e.g. https://github.com/squaremo/rabbitmq-lvc-plugin

上次值缓存交换:

这是使用 RabbitMQ 的可插入交换类型功能的最后一个值缓存的一个非常简单的实现.

This is a pretty simple implementation of a last value cache using RabbitMQ's pluggable exchange types feature.

最后一个值缓存旨在解决如下问题:假设我正在使用消息传递向客户端发送一些更改值的通知;现在,当一个新客户端连接时,它不会知道值直到它发生变化.

The last value cache is intended to solve problems like the following: say I am using messaging to send notifications of some changing values to clients; now, when a new client connects, it won't know the value until it changes.

最后的价值交换就像直接交换一样(绑定密钥与路由密钥进行比较);但是,它还跟踪与每个路由键一起发布的最后一个值,并且当队列被绑定时,它会自动将绑定键的最后一个值入队.

The last value exchange acts like a direct exchange (binding keys are compared for equality with routing keys); but, it also keeps track of the last value that was published with each routing key, and when a queue is bound, it automatically enqueues the last value for the binding key.

这篇关于RabbitMQ 消息传递 - 初始化消费者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆