我正在使用 Camel ReSTLet 进行一般路由,响应时间为 300 毫秒,是否可以进行任何设置以减少响应时间。
我的路由配置
<route id="retriveEntry">
<from uri="restlet:/user/{cachename}/{userId}?restletMethod=GET"/>
<setHeader headerName="Content-Type">
<constant>application/xml</constant>
</setHeader>
<!-- <process ref="requestTimeProc"/> -->
<to uri="restlet:http://hostname:8180/rest/{cachename}/{userId}?restletMethod=GET"/>
<!-- <process ref="responseTimeProc"/> -->
</route>
Response time By hitting the backend URL directly is :40 ms http://hostname:8180/rest/{cachename}/{userId}
我也不知道为什么在我的 Camel 日志中看到这些警告:
WARNING: Addition of the standard header "Content-Length" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:38 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Date" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Host" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Connection" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "User-Agent" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
最佳答案
因为您只是将请求路由到后端服务,所以您不需要使用 camel-rest 来完成此类工作。你可以使用 camel-jetty 和 camel-http 来定义这样的路由
<route>
<from uri="jetty:xxx"/>
<to uri="http://xxx"/>
</route>
对于WARNING信息,应该在CAMEL-6590中解决
关于Apache Camel 路由性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19971546/