Coverage Report - org.mule.endpoint.inbound.InboundLoggingMessageProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
InboundLoggingMessageProcessor
0%
0/12
0%
0/4
0
 
 1  
 /*
 2  
  * $Id: InboundLoggingMessageProcessor.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.endpoint.inbound;
 12  
 
 13  
 import org.mule.api.MuleEvent;
 14  
 import org.mule.api.MuleMessage;
 15  
 import org.mule.api.endpoint.InboundEndpoint;
 16  
 import org.mule.processor.AbstractMessageObserver;
 17  
 import org.mule.util.StringMessageUtils;
 18  
 
 19  
 public class InboundLoggingMessageProcessor extends AbstractMessageObserver
 20  
 {
 21  
 
 22  
     protected InboundEndpoint endpoint;
 23  
 
 24  
     public InboundLoggingMessageProcessor(InboundEndpoint endpoint)
 25  0
     {
 26  0
         this.endpoint = endpoint;
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public void observe(MuleEvent event)
 31  
     {
 32  0
         MuleMessage message = event.getMessage();
 33  0
         if (logger.isDebugEnabled())
 34  
         {
 35  0
             logger.debug("Message Received on: " + endpoint.getEndpointURI());
 36  
         }
 37  0
         if (logger.isTraceEnabled())
 38  
         {
 39  
             try
 40  
             {
 41  0
                 logger.trace("Message Payload: \n"
 42  
                              + StringMessageUtils.truncate(StringMessageUtils.toString(message.getPayload()),
 43  
                                  200, false));
 44  0
                 logger.trace("Message detail: \n" + StringMessageUtils.headersToString(message));
 45  
             }
 46  0
             catch (Exception e)
 47  
             {
 48  
                 // ignore
 49  0
             }
 50  
         }
 51  0
     }
 52  
 }