问题描述
我正在使用 Quarkus 将请求代理到另一个 REST 服务。当下游服务运行时,一切正常。当我关闭下游并通过 Quarkus 发送请求(例如 curl 请求)时,第一个请求卡住了,对于所有其他进一步的 curl 请求,我收到以下错误,即使下游服务恢复,系统也永远不会恢复。
Request Failed: java.lang.IllegalStateException: SRMSG00028: The subscription to events has been cancelled
我使用 org.eclipse.microprofile.reactive.messaging.Emitter 和 org.eclipse.microprofile.reactive.messaging.Channel。
我该如何处理这种情况?我希望 curl 请求在下游服务关闭时超时,一旦服务重新启动,我应该得到 200 Ok 响应,而不是上面的“IIlegalStateException 他对事件的订阅已被取消”。
可能是我遗漏了一些简单的东西,但我在 Quarkus 文档中找不到与此相关的任何内容。请指教。
谢谢,
解决方法
我使用的是 smallrye-http 连接器。
mp.messaging.outgoing.metrics.connector=smallrye-http
mp.messaging.outgoing.metrics.method=POST
mp.messaging.outgoing.metrics.url=http://localhost:9090/test
改为使用
mp.messaging.outgoing.metrics.connector=quarkus-http
mp.messaging.outgoing.metrics.method=POST
mp.messaging.outgoing.metrics.url=http://localhost:9090/test
这将解决问题。感谢 Quarkus 团队的指导。更多详情https://github.com/quarkusio/quarkus/issues/15344