Groovy Examples

Go to list of examples

MPL Payload Log

MPL Payload Log

Basic MPL logging to see the payload in the monitoring.

You don't have to import any library to use messageLogFactory. It is already "injected" to your script.


Try it on Groovy IDE

def Message processData(Message message) {
    def body = message.getBody(java.lang.String) as String;

    def messageLog = messageLogFactory.getMessageLog(message);
    if(messageLog != null){

        messageLog.setStringProperty("Logging", "Printing Payload As Attachment");
        messageLog.addAttachmentAsString("Message#1", body, "text/plain");

    return message;