简体   繁体   English

阿帕奇骆驼得到码头的空响应

[英]Apache Camel get empty response from jetty

I face a complex case. 我面临一个复杂的案件。 What I'm doing is as following steps: 我正在做的是以下步骤:

1) <from uri="jetty:http://0.0.0.0:30100/jetty/test"/> 1) <from uri="jetty:http://0.0.0.0:30100/jetty/test"/>

2) <to uri="hazelcast-client:master-test-series" /> 2) <to uri="hazelcast-client:master-test-series" />

3) <to uri="bean:modelSeriesWrapperTest" /> 3) <to uri="bean:modelSeriesWrapperTest" />

4) 4)

 <split parallelProcessing="true" streaming="true"> <simple>${body}</simple> <to uri="direct:dw.model.test"/> </split> 

5) From another route 5)从另一条路线

 <from uri="direct:dw.model.test"/> <aggregate strategyRef="myAggregatorStrategy" completionTimeout="1000"> <correlationExpression> <constant>true</constant> </correlationExpression> <marshal ref="modelSeriesVariantColourGson" /> <camel:to uri="file:src/data/catask/output?fileName=output.xml"/> </aggregate> 

The problem is that the jetty response is empty. 问题在于码头反应是空的。 I use TCP trace to track the request and response, the Content-Length is 0. But the output.xml file has correct JSON format content. 我使用TCP跟踪来跟踪请求和响应,Content-Length为0。但是output.xml文件具有正确的JSON格式内容。 Even I cross the <camel:to uri="file:src/data/catask/output?fileName=output.xml"/> . 甚至我跨过<camel:to uri="file:src/data/catask/output?fileName=output.xml"/> The jetty response is still empty. 码头反应仍然是空的。

I try the InOut pattern, it doesn't work as well. 我尝试了InOut模式,它也不起作用。 It seems jetty return directly, not waiting split done. 看来码头直接返回,而不是等待拆分完成。 I try to set In and Out body, it doesn't work either. 我尝试设置In和Out主体,它也不起作用。 I Google every case that I can image. 我会在每种情况下使用Google搜索。 There is no helpful case. 没有帮助的情况。 Could you please help me? 请你帮助我好吗? Thank you very much. 非常感谢你。

If you want the jetty response to include whatever information from your aggregator, then you must use the splitter only approach as documented at: 如果您希望码头反应包括来自聚合器的任何信息,则必须使用仅拆分器方法,如以下文档所述:

The splitter has built-in aggregation, and that ensures when the splitter is done, it aggregates also, and then you can use that as the jetty response. 拆分器具有内置的聚合,可以确保拆分器完成后也进行聚合,然后可以将其用作码头响应。

When you use <aggregate> then it becomes a separate exchange. 当您使用<aggregate>它将成为一个单独的交换。 To understand this more then read more about the aggregate eip, and other SO, and in various Camel books etc. 要了解更多信息,请阅读更多有关聚合eip和其他SO的信息,以及各种Camel书籍等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM