Groovy - Write log incoming payload only if there is as exception in SAP CPI ( Business Technology Platform) Code Example

The code for Write log incoming payload only if there is as exception in SAP CPI ( Business Technology Platform)

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;

def Message processData(Message message)
{
       def map  = message.getProperties();
       def ex   = map.get("CamelExceptionCaught");
       if (ex != null)
       {
           exceptionText    = ex.getMessage();
           def messageLog   = messageLogFactory.getMessageLog(message);
           messageLog.addAttachmentAsString("Exception", exceptionText,"application/text");
       }
       return message;
}
Code by Reddy MS, on February 7, 2023 13:22

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.