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