数据未使用骆驼从一个端点传输到另一端点

时间:2020-10-25 20:09:35

标签: apache-camel spring-camel

我请求进入https://xx.xx.x.xxx/consumers/域,并以JSON格式获取一些响应数据,并向其传递了另一个端点 direct:consumer ,但在 direct:consumer 端点,如果我的打印主体快要空了,有人可以帮我如何将数据从一个端点传输到另一个端点。

from("timer://runOnce?repeatCount=1")
.process(consumerCreate)
.to("https://xx.xx.x.xxx/consumers/").log("response data from create:: ${body}")
.to("direct:consumer");

在下面的端点中,如果打印正文得到空响应,而不是JSON数据

from("direct:consumer").log("the body is ${body} ");

有人可以帮我这是预期的行为还是我错过了什么?

1 个答案:

答案 0 :(得分:0)

看看启用蒸汽缓存:

https://camel.apache.org/manual/latest/stream-caching.html

没有它,http生产者返回的流只能被读取一次,例如在第一条日志消息中。因此,为什么要记录消息正文时,在第二个direct:consumer路由中什么也没打印。