Spring boot 无法访问JMS服务器时,注册表中未定义Spring Boot Micro服务

Spring boot 无法访问JMS服务器时,注册表中未定义Spring Boot Micro服务,spring-boot,spring-jms,spring-boot-actuator,Spring Boot,Spring Jms,Spring Boot Actuator,我有一个奇怪的问题,我花了好几天的时间才解决。基本上,我有一个基于SpringBootVersion2.1.10.RELEASE的Jhipster项目,它包含4个微服务。我们对其中的两个感兴趣:Gateway和Corehub。 在网关中,我有一个angular应用程序,它执行一个POST to/services/corehub/api/someendpoint,该应用程序过去一直在工作,现在由于不同的错误消息而失败,但我经常使用的是 { "type": "htt

我有一个奇怪的问题,我花了好几天的时间才解决。基本上,我有一个基于SpringBootVersion2.1.10.RELEASE的Jhipster项目,它包含4个微服务。我们对其中的两个感兴趣:Gateway和Corehub。 在网关中,我有一个angular应用程序,它执行一个POST to/services/corehub/api/someendpoint,该应用程序过去一直在工作,现在由于不同的错误消息而失败,但我经常使用的是

{
  "type": "https://www.jhipster.tech/problem/problem-with-message",
  "title": "Method Not Allowed",
  "status": 405,
  "detail": "Request method 'POST' not supported",
  "path": "/services/ambientcorehub/api/trips",
  "message": "error.http.405"
}
最后,我查看了用于内部通信的微服务的注册表跟踪,发现当出现此错误时,我在跟踪中再也找不到corehub。因此,corehub micro服务似乎未注册

这个服务的另一个GIT分支没有这个问题,所以我在这两个分支之间进行了区分,并删除了更改,直到我可以缩小问题的范围。 因此,在corehub中,我有一个基于此mq JMS spring实现的JMS侦听器。maven依赖项如下所示:

        <dependency>
            <groupId>com.ibm.mq</groupId>
            <artifactId>mq-jms-spring-boot-starter</artifactId>
            <version>2.2.7</version>
        </dependency>
是否有可能捕获此异常以避免破坏常规的Spring引导注册机制? 由于无法访问JMS服务器,我无法承担集群停机的费用

除此之外,我在IBMMQ端打开了这条消息,一个人建议我停止JMS运行状况指示器。因此,我将以下属性设置为无效:

management:
  endpoint:
    jms:
      # Prevent Unreachable JMS Server from unregistering corehub from the registry, leading to unreachable microservice from the Gateway
      enabled: false
相应的文档是

任何帮助都将不胜感激。 非常感谢。
Christophe

如果您不希望在JMS关闭时应用程序被视为不健康,我建议禁用JMS运行状况指示器。它不适合您,因为您使用了
management.endpoint.jms.enabled
。要使用的正确属性是
management.health.jms.enabled

management:
  health:
    jms:
      enabled: false

如果您不希望在JMS关闭时应用程序被视为不健康,那么我建议禁用JMS运行状况指示器。它不适合您,因为您使用了
management.endpoint.jms.enabled
。要使用的正确属性是
management.health.jms.enabled

management:
  health:
    jms:
      enabled: false
management:
  health:
    jms:
      enabled: false