Commit 547ff863 authored by zero-mac's avatar zero-mac

删除stop rabbitMq的处理代码,此时通过preDestroy已经完成了rabbitMq的监听暂停,不需要再执行一遍.

parent be6cfe74
package cn.quantgroup.tech.shutdown;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.config.RabbitListenerConfigUtils;
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.Lifecycle;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PreDestroy;
......@@ -29,15 +26,6 @@ public class BaseDestroyHandler {
@PreDestroy
private void stopRabbitMQ() {
try {
RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry = applicationContext.getBean(
RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME,
RabbitListenerEndpointRegistry.class);
rabbitListenerEndpointRegistry.getListenerContainers().forEach(Lifecycle::stop);
} catch (Exception e) {
//貌似这段日志不会打印...
log.error("貌似停止 MQ 遇到了问题... 你有MQ么? ");
}
log.info("MQ listener stopped");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment