77.5. 基于流的消息正文
如果消息正文基于流,这表示它收到的输入作为流提交给 Camel。这意味着您只能够读取一次流的内容。因此,当您使用 XPath 作为 Message Filter 或 Content Based Router 时,您需要多次访问数据,您应该使用流缓存,或使用流缓存,或者在前面将消息正文转换为字符串
,以安全地重新读取多次。
from("queue:foo"). filter().xpath("//foo")). to("queue:bar")
from("queue:foo").
filter().xpath("//foo")).
to("queue:bar")
from("queue:foo"). choice().xpath("//foo")).to("queue:bar"). otherwise().to("queue:others");
from("queue:foo").
choice().xpath("//foo")).to("queue:bar").
otherwise().to("queue:others");