Apache Camel 路由性能

3

我正在使用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}

我在我的骆驼日志中也看到了这些警告,不确定原因:

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
1个回答

2

你只需要将请求路由到后端服务,就不需要使用camel-rest来完成这种工作。你可以使用camel-jetty和camel-http来定义路由,如下所示:

<route>
    <from uri="jetty:xxx"/>
    <to uri="http://xxx"/>
</route>

针对这个警告信息,应该在CAMEL-6590中解决。


这个链接更好,因为它有一个更好的http代理示例,并启用了你需要的选项:http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html - Claus Ibsen
嗨Willem/Claus,我如何在使用Jetty或http路由时,在from子句中执行类似于restletMethod=GET的条件检查? - remo
您可以检查消息头“CamelHttpMethod”来获取它。 - Willem Jiang

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接