【问题标题】:condition in Transform Message - Mule转换消息中的条件 - Mule
【发布时间】:2017-09-22 07:06:41
【问题描述】:

我想根据某些条件在 mule 应用程序中转换消息。

%dw 1.0
%output application/json
---
{
    **// create the below if the size of payload is greater than 0**
    resource_type : "speciality",
    speciality_name : payload[0].speciality_name,
    speciality_description : payload[0].speciality_description,
    uuid : payload[0].uuid

   **//else create the below message**
   message : "No records were fetched from backend"
}

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: mule mule-esb


    【解决方案1】:

    您可以使用 when 否则条件。喜欢

    %dw 1.0
    %output application/json
    ---
    {
        // create the below if the size of payload is greater than 0**
        resource_type : "speciality",
        speciality_name : payload[0].speciality_name,
        speciality_description : payload[0].speciality_description,
        uuid : payload[0].uuid
    } when payload != null and (sizeOf payload) > 0 otherwise
    {
       //else create the below message**
       message : "No records were fetched from backend"
    }
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2021-02-22
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多