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