wso2使用响应和条件

wso2使用响应和条件,wso2,wso2esb,wso2carbon,Wso2,Wso2esb,Wso2carbon,是否可以将响应中的json用作属性,然后使用它生成条件语句?我研究了条件路由器和序列以实现这一点,但我不知道如何获得响应并将其放入属性中介,或者只是将其用于条件路由器 我有这样的回答 { "fruit": "apple" } 然后我想看看关键的水果是不是苹果 if (response.fruit == "apple") { callMediator(); } else { callOtherMediator(); } 要设置为属性,请执行以下操作: <prope

是否可以将响应中的json用作属性,然后使用它生成条件语句?我研究了条件路由器和序列以实现这一点,但我不知道如何获得响应并将其放入属性中介,或者只是将其用于条件路由器

我有这样的回答

{
    "fruit": "apple"
}
然后我想看看关键的水果是不是苹果

if (response.fruit == "apple") {
    callMediator();
} else {
    callOtherMediator();
}
要设置为属性,请执行以下操作:

<property name="fruit" expression="//fruit"/>

要检查,请使用


<filter source="$ctx:fruit" regex="apple">
      <then>
          <send/>
      </then>
      <else>
          <drop/>
      </else>
</filter>