简体   繁体   English

Spring Cloud Stream 是否支持从运行前未知的 Rabbit 队列读取?

[英]Does Spring Cloud Stream support reading from a Rabbit queue unknown until runtime?

I'm writing a Java application that uses Spring Cloud Stream to read messages from an input RabbitMQ queue, process the messages, and then write a new message to an output RabbitMQ exchange. I'm writing a Java application that uses Spring Cloud Stream to read messages from an input RabbitMQ queue, process the messages, and then write a new message to an output RabbitMQ exchange. This works great when the input queue name is known at compile-time.当输入队列名称在编译时已知时,这很有效。

I now have a new requirement that the application needs to support discovering new RabbitMQ queues at runtime, and then use those new queues for input (reading messages from the new queues).我现在有一个新要求,即应用程序需要支持在运行时发现新的 RabbitMQ 队列,然后使用这些新队列进行输入(从新队列中读取消息)。 Getting the list of queues is straightforward via the REST API in RabbitMQ, but I don't see a way to use a variable queue name for reading messages from those new input queues.通过 RabbitMQ 中的 REST API 获取队列列表很简单,但我看不到使用可变队列名称从这些新输入队列读取消息的方法。

I'm using Spring Cloud Stream v.3.0.3.我正在使用 Spring Cloud Stream v.3.0.3。 Does Spring Cloud Stream support this use case? Spring Cloud Stream 是否支持此用例?

No, sc-stream was never designed for cases like this.不,sc-stream 从来都不是为这样的情况而设计的。 Sure the API to register new bindings is there and one can certainly accomplish that, but sooner or later there will be a question of destination configuration as well as other fine-print-style details and those would need to be known in advance regardless.当然,注册新绑定的 API 是存在的,当然可以做到这一点,但迟早会出现目标配置问题以及其他精美样式的细节,无论如何这些都需要提前知道。 In all this would also IMHO contradict the fundamental ideas and ideals behind the concept of microservices - do only one thing, but do it well and in the simples way possible .在所有这些方面,恕我直言,这也与微服务概念背后的基本思想和理想相矛盾——只做一件事,但要以尽可能简单的方式做好 What you are describing doesn't seem to fit in that category您所描述的似乎不属于该类别

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM