我想使用micronaut-rabbitmq通过主题在服务之间发送消息。因此,我在ChannelInitializer中创建了一个交换、队列和绑定,如下所示:
channel.exchangeDeclare("registration", BuiltinExchangeType.TOPIC, true)
channel.queueDeclare("user_new", true, false, false, null)
channel.queueBind("user_new", "registration", "user.new.#")
channel.queueDeclare("user_all", true, false, false, null)
channel.queueBind("user_all", "registration", "user.#")当我尝试向路由键"user.new“发送消息时,它不会被发送到任何队列。
@Binding("user.new")
override fun userCreated(event: UserCreatedEvent)我希望,由于主题路由键的原因,它会被发送到两个队列。
如果我将"user_new“队列重命名为"user.new”,则消息将发送到此队列。但是,因为我想让消息同时出现在两个队列中,所以这是没有选择的。
任何帮助都将不胜感激!
谢谢
发布于 2020-10-08 15:38:05
我的问题是,我没有在@RabbitClient上声明交换
将@RabbitClient更改为@RabbitClient("registration")后,一切工作正常。
https://stackoverflow.com/questions/63772292
复制相似问题