写入日志后,响应体是空的

时间:2018-04-02 09:06:17

标签: jbossfuse

我在spring dsl上测试fuse63用于休息服务,我需要在后端系统代理驼峰上的休息服务,这里有摘录:

 <camelContext id="_camelContext1_rest" xmlns="http://camel.apache.org/schema/spring">
        <restConfiguration component="spark-rest" port="9091"/>
        <rest path="/say">
          <post consumes="application/json" produces="text/plain" uri="/hellopost">
           <to uri="direct:hellopost"/>
          </post> 
...
       <route id="_route_saypost">
            <from id="_from_saypost" uri="direct:hellopost"/>
            <log id="_log_saypost" message="this is hellopost"/>
            <to id="_file_saypost" uri="file:/tmp2/target/messages/hellopost?fileName=${header.fileName}"/>
            <setHeader headerName="camel-test" id="_setHeader1">
                <constant>this is camel</constant>
            </setHeader>
            <setHeader headerName="CamelHttpMethod" id="_setHeader2">
                <constant>POST</constant>
            </setHeader>
            <log id="_log_saypost_before_rest" message="before rest"/>
            <to id="_to1" uri="http4://192.168.56.11:8080/test/httpheader.jsp?bridgeEndpoint=true&amp;synchronous=true"/>
            <setHeader headerName="Content-Type" id="_setHeader2">
                <constant>application/json</constant>
            </setHeader>
        </route>

这样可以正常工作,但如果我在路径末尾添加日志记录操作:

    <log id="_log_saypost_after_rest3" message="${body}"/>
  </route>

来自camel的响应主体(localhost:9091 / say / hellopost)将为空,在记录操作后,响应主体被清除的原因是什么?

祝你好运

1 个答案:

答案 0 :(得分:1)

使用像

这样的流缓存
"name"=>
      {"type"=>"keyword",
       "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_start"=>{"type"=>"text", "analyzer"=>"searchkick_word_start_index"}},
       "ignore_above"=>30000},
     "price"=>{"type"=>"float"}

http://camel.apache.org/why-is-my-message-body-empty.html这个问题的答案。