我有一个简单的Web服务ws1,它只有一个由netty公开的“ hello world”的setBody。我想在camel-ahc的帮助下异步调用此Web服务。
为此,我有一个主骆驼上下文,每6秒调用一次ws1,但是在另一个线程中调用ws1之后,程序的控制未返回主骆驼上下文线程,似乎是camel-ahc组件无法正常工作,并且60秒后发生请求超时异常。 在我的pom中,我添加了: 骆驼 骆驼反应流
<camelContext trace="true" id="mainCamelContext" xmlns="http://camel.apache.org/schema/blueprint" >
<route id="ahc-route-first-api">
<from uri="timer://webinar?period=6000"/>
<log message="this is body: ${body}"/>
<to uri="ahc:http://192.168.100.232:9999/ws1"/>
<log message="this is body after call: ${body}"/>
</route>
</camelContext>
在Fuse中安装捆绑软件时:
10:35:18.914信息[骆驼(mainCamelContext)线程#316- timer:// webinar]这是正文:10:35:18.914信息[骆驼 (mainCamelContext)线程#316-timer:// webinar] ID-本地主机-localdomain-1552973873885-38-116 >>> (ahc-route-first-api)日志[这是正文:$ {body}]-> ahc:// http://192.168.100.232:9999/api?throwExceptionOnFailure=false <<<模式:InOnly, 标头:{breadcrumbId = ID-localhost-localdomain-1552973873885-38-116, firedTime = Sat Apr 06 10:35:18 IRDT 2019},BodyType:空,Body:[Body is null] 10:35:19.202 WARN [AsyncHttpClient-timer-87-1]错误处理 交换。交换[ID-localhost-localdomain-1552973873885-38-114]。 引起原因:[java.util.concurrent.TimeoutException-请求超时 192.168.100.232/192.168.100.232:9999在60000毫秒后] java.util.concurrent.TimeoutException:请求超时 在org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)的60000 ms之后为192.168.100.232/192.168.100.232:9999 [1990:wrap_file__home_ossl_.m2_repository_org_asynchttpclient_async-http-client_2.4.3_async-http-client-2.4.3.jar_Export-Package_org.asynchttpclient .__ version_2.4.3:0.0.0] 在 org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50) [1990:wrap_file__home_ossl_.m2_repository_org_asynchttpclient_async-http-client_2.4.3_async-http-client-2.4.3.jar_Export-Package_org.asynchttpclient .__ version_2.4.3:0.0.0] 在 io.netty.util.HashedWheelTimer $ HashedWheelTimeout.expire(HashedWheelTimer.java:663) [654:io.netty.common:4.1.16.Final-redhat-2]在 io.netty.util.HashedWheelTimer $ HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:738) [654:io.netty.common:4.1.16.Final-redhat-2]在 io.netty.util.HashedWheelTimer $ Worker.run(HashedWheelTimer.java:466) [654:io.netty.common:4.1.16.Final-redhat-2]在 io.netty.util.concurrent.DefaultThreadFactory $ DefaultRunnableDecorator.run(DefaultThreadFactory.java:138) [654:io.netty.common:4.1.16.Final-redhat-2]在 java.lang.Thread.run(Thread.java:748)[?:?] 10:35:19.203错误 [AsyncHttpClient-timer-87-1](MessageId: ExchangeId上的ID-localhost-localdomain-1552973873885-38-117: ID-localhost-localdomain-1552973873885-38-114)。精疲力尽 传递尝试:1被捕获:java.util.concurrent.TimeoutException: 60000毫秒后请求超时到192.168.100.232/192.168.100.232:9999