1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.service.processor; |
8 | |
|
9 | |
import org.mule.api.MuleEvent; |
10 | |
import org.mule.api.MuleException; |
11 | |
import org.mule.api.processor.MessageProcessor; |
12 | |
import org.mule.api.service.Service; |
13 | |
|
14 | |
import org.apache.commons.logging.Log; |
15 | |
import org.apache.commons.logging.LogFactory; |
16 | |
|
17 | |
public class ServiceLoggingMessageProcessor implements MessageProcessor |
18 | |
{ |
19 | 0 | protected final transient Log logger = LogFactory.getLog(getClass()); |
20 | |
protected Service service; |
21 | |
|
22 | |
public ServiceLoggingMessageProcessor(Service service) |
23 | 0 | { |
24 | 0 | this.service = service; |
25 | 0 | } |
26 | |
|
27 | |
public MuleEvent process(MuleEvent event) throws MuleException |
28 | |
{ |
29 | 0 | if (event.getEndpoint().getExchangePattern().hasResponse()) |
30 | |
{ |
31 | 0 | if (logger.isDebugEnabled()) |
32 | |
{ |
33 | 0 | logger.debug("Service: " + service.getName() + " has received synchronous event on: " |
34 | |
+ event.getEndpoint().getEndpointURI()); |
35 | |
} |
36 | |
} |
37 | |
else |
38 | |
{ |
39 | 0 | if (logger.isDebugEnabled()) |
40 | |
{ |
41 | 0 | logger.debug("Service: " + service.getName() + " has received asynchronous event on: " |
42 | |
+ event.getEndpoint().getEndpointURI()); |
43 | |
} |
44 | |
} |
45 | |
|
46 | 0 | return event; |
47 | |
} |
48 | |
} |