2017-09-22 12 views
0

何らかの条件に基づいてメッセージをMuleアプリケーションで変換したい。Transform Message - 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" 
} 

いずれにせよ、私に親切に助けてください。

答えて

4

それ以外の条件がある場合に使用できます。 Like

%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" 
} 

関連する問題