简体   繁体   English

如何在spring-rabbitmq + spring cloud中手动从侦听器断开频道

[英]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.

相关问题 如何设置spring-rabbitmq侦听器的接收速率 - How can I set the spring-rabbitmq listener's rate of receive message 通过 spring-rabbitmq 自动重试连接到代理 - Automatic retry connection to broker by spring-rabbitmq Camel - 使用 spring-rabbitmq 进行确认管理 - Camel - Acknowledgement management with spring-rabbitmq 具有侦听器的类的上下文-spring-rabbitmq,内部结构和基于消息包含的注入bean - Context of class with listener - spring-rabbitmq, internals and injecting beans based on contain of message Rabbitmq和spring-rabbitmq中的DLX-拒绝消息的一些注意事项 - DLX in rabbitmq and spring-rabbitmq - some considerations of rejecting messages spring-rabbitmq中的自动注入自定义ErrorHandler - Auto-injection custom ErrorHandler in spring-rabbitmq Play Framework:为Spring RabbitMQ监听器手动打开JPA上下文 - Play Framework: Manually open JPA context for Spring RabbitMQ listener Spring Batch:如何在侦听器方法中从 ItemReader 手动读取项目? - Spring Batch: How to read items manually from an ItemReader in a listener method? Spring 云 function 正在使用 rabbitmq 队列 - 调度程序没有频道的订阅者 - Spring cloud function Cosuming rabbitmq queue - Dispatcher has no subscribers for channel Spring-rabbitmq - 即使在连接不足的情况下也可以启动spring-boot服务器 - Spring-rabbitmq - start spring-boot server even in case of lack of connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM