gpt4 book ai didi

java - Bluepring XML 中的 null 交换的 apache Camel 简单语言测试不起作用

转载 作者:行者123 更新时间:2023-12-02 01:16:21 24 4
gpt4 key购买 nike

我正在使用 Apache Camel 2.17 并使用简单语言来捕获空交换。它不起作用,我尝试了几种格式化方法,但它没有捕获空值。我相信这是我使用它的格式/语法。请指示我哪里出错了。谢谢!

<process id="_process18" ref="csvMarshallerProcessor"/>
<process id="toReOrgCSV" ref="reOrgCSVData"/>
<choice id="_choice13">
<when id="_when13">
<simple>"${body}" == null</simple>
<log id="_log22" message="body is NULL, do not send NULL body!"/>
<stop id="_stop7"/>
</when>
<otherwise id="_otherwise1">

我已经尝试过

<simple>"${body} == null"</simple>
<simple>"${body}" == null</simple>
<simple>${body} == null</simple>
<simple>${body} == 'null'</simple>

如果数据被过滤掉并且不符合发送条件,我在之前的过程中将交换设置为空。我想只使用 Camel Spring XML。

???

最佳答案

不要将exchange设置为null,因为这是无效的,将消息正文设置为null或空字符串等。

exchange.getIn().setBody(null);

然后就可以用simple来测试它的null了,

${body} == null

或者如果您将其设置为空文本

${body} == ''

关于java - Bluepring XML 中的 null 交换的 apache Camel 简单语言测试不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58475284/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com