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 public class ServiceStatisticsMessageProcessor implements MessageProcessor
19 {
20 protected Service service;
21
22 public ServiceStatisticsMessageProcessor(Service service)
23 {
24 this.service = service;
25 }
26
27 public MuleEvent process(MuleEvent event) throws MuleException
28 {
29 if (service.getStatistics().isEnabled())
30 {
31 if (event.getExchangePattern().hasResponse())
32 {
33 service.getStatistics().incReceivedEventSync();
34 }
35 else
36 {
37 service.getStatistics().incReceivedEventASync();
38 }
39 }
40
41 return event;
42 }
43 }