1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.construct.processor; |
12 | |
|
13 | |
import org.mule.api.MuleEvent; |
14 | |
import org.mule.api.MuleException; |
15 | |
import org.mule.api.construct.FlowConstruct; |
16 | |
import org.mule.api.construct.FlowConstructAware; |
17 | |
import org.mule.api.processor.MessageProcessor; |
18 | |
import org.mule.util.ObjectUtils; |
19 | |
|
20 | 0 | public class FlowConstructStatisticsMessageProcessor implements MessageProcessor, FlowConstructAware |
21 | |
{ |
22 | |
protected FlowConstruct flowConstruct; |
23 | |
|
24 | |
public MuleEvent process(MuleEvent event) throws MuleException |
25 | |
{ |
26 | 0 | if (flowConstruct.getStatistics().isEnabled()) |
27 | |
{ |
28 | 0 | if (event.getEndpoint().getExchangePattern().hasResponse()) |
29 | |
{ |
30 | 0 | flowConstruct.getStatistics().incReceivedEventSync(); |
31 | |
} |
32 | |
else |
33 | |
{ |
34 | 0 | flowConstruct.getStatistics().incReceivedEventASync(); |
35 | |
} |
36 | |
} |
37 | |
|
38 | 0 | return event; |
39 | |
} |
40 | |
|
41 | |
public void setFlowConstruct(FlowConstruct flowConstruct) |
42 | |
{ |
43 | 0 | this.flowConstruct = flowConstruct; |
44 | 0 | } |
45 | |
|
46 | |
@Override |
47 | |
public String toString() |
48 | |
{ |
49 | 0 | return ObjectUtils.toString(this); |
50 | |
} |
51 | |
} |