Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

java - 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. 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). 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.

I'm using Spring Cloud Stream v.3.0.3. Does Spring Cloud Stream support this use case?

question from:https://stackoverflow.com/questions/66050207/does-spring-cloud-stream-support-reading-from-a-rabbit-queue-unknown-until-runti

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No, s-c-stream was never designed for cases like this. 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. 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...