【问题标题】:Apache Camel Routing performanceApache Camel 路由性能
【发布时间】:2013-11-14 07:02:22
【问题描述】:

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

【问题讨论】:

    标签: apache http apache-camel infinispan


    【解决方案1】:

    由于您只是将请求路由到后端服务,因此您不需要使用 camel-rest 来完成此类工作。您可以使用 camel-jetty 和 camel-http 来定义这样的路线

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

    对于警告消息,它应该在CAMEL-6590中解析

    【讨论】:

    • 此链接更好,因为它有更好的 http 代理示例并启用了您需要的选项:camel.apache.org/…
    • 您好 Willem/Claus,我该如何使用 Jetty 或 http 路由从子句中执行 restletMethod=GET 条件签入
    • 你可以查看消息头“CamelHttpMethod”。
    猜你喜欢
    • 1970-01-01
    • 2016-09-29
    • 2018-07-01
    • 1970-01-01
    • 2011-08-04
    • 2018-02-14
    • 2014-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多