[英]How to disconnect a Channel manually from listener in spring-rabbitmq + spring cloud
I have created a RabbitMQ application using Spring Cloud + Spring Boot and based on the following logic: I am closing the channel which will stop the assigned listener from accepting requests. 我已经使用Spring Cloud + Spring Boot创建了RabbitMQ应用程序,并基于以下逻辑:我正在关闭通道,该通道将停止分配的侦听器接受请求。
When I close the channel using channel.close()
method, I am able to see the channel getting auto-created and calling the listener again. 当我使用channel.close()
方法关闭通道时,可以看到该通道已自动创建并再次调用了侦听器。
Is there any way to disable the auto-creation of channels? 有什么方法可以禁用自动创建频道吗?
It sounds like you are using a listener container; 听起来您正在使用侦听器容器; you must not close()
its channel(s). 您不得close()
其频道。
You need to stop()
the container instead (which will close the channel). 您需要改为stop()
容器(这将关闭通道)。
Exactly how to do that depends on how you are using the framework - edit the question to show the configuration and your listener. 确切的操作方式取决于您使用框架的方式-编辑问题以显示配置和您的侦听器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.