1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.endpoint.inbound; |
8 | |
|
9 | |
import org.mule.api.MuleEvent; |
10 | |
import org.mule.api.MuleException; |
11 | |
import org.mule.api.endpoint.InboundEndpoint; |
12 | |
import org.mule.api.processor.MessageProcessor; |
13 | |
import org.mule.context.notification.EndpointMessageNotification; |
14 | |
import org.mule.transport.AbstractConnector; |
15 | |
import org.mule.util.ObjectUtils; |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class InboundNotificationMessageProcessor implements MessageProcessor |
21 | |
{ |
22 | |
protected InboundEndpoint endpoint; |
23 | |
|
24 | |
public InboundNotificationMessageProcessor(InboundEndpoint endpoint) |
25 | 0 | { |
26 | 0 | this.endpoint = endpoint; |
27 | 0 | } |
28 | |
|
29 | |
public MuleEvent process(MuleEvent event) throws MuleException |
30 | |
{ |
31 | 0 | AbstractConnector connector = (AbstractConnector) endpoint.getConnector(); |
32 | 0 | if (connector.isEnableMessageEvents()) |
33 | |
{ |
34 | 0 | connector.fireNotification(new EndpointMessageNotification(event.getMessage(), endpoint, |
35 | |
event.getFlowConstruct().getName(), EndpointMessageNotification.MESSAGE_RECEIVED)); |
36 | |
} |
37 | |
|
38 | 0 | return event; |
39 | |
} |
40 | |
|
41 | |
@Override |
42 | |
public String toString() |
43 | |
{ |
44 | 0 | return ObjectUtils.toString(this); |
45 | |
} |
46 | |
} |