1
2
3
4
5
6
7
8
9
10
11 package org.mule.context.notification;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.api.component.Component;
15 import org.mule.api.construct.FlowConstruct;
16 import org.mule.api.context.notification.ServerNotification;
17
18
19
20
21
22 public class ComponentMessageNotification extends ServerNotification
23 {
24
25 private static final long serialVersionUID = -6369685122731797646L;
26
27 public static final int COMPONENT_PRE_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 1;
28 public static final int COMPONENT_POST_INVOKE = COMPONENT_EVENT_ACTION_START_RANGE + 2;
29
30 static
31 {
32 registerAction("component pre invoke", COMPONENT_PRE_INVOKE);
33 registerAction("component post invoke", COMPONENT_POST_INVOKE);
34 }
35
36
37
38
39
40 public ComponentMessageNotification(MuleMessage message, Component component, FlowConstruct flowConstruct, int action)
41 {
42 super(cloneMessage(message), action);
43 resourceIdentifier = flowConstruct.getName();
44
45 }
46
47 @Override
48 protected String getPayloadToString()
49 {
50 return ((MuleMessage) source).getPayloadForLogging();
51 }
52
53
54
55
56 public String getServiceName()
57 {
58 return resourceIdentifier;
59 }
60
61 @Override
62 public String toString()
63 {
64 return EVENT_NAME + "{action=" + getActionName(action) + ", message: " + source + ", resourceId="
65 + resourceIdentifier + ", timestamp=" + timestamp + ", serverId=" + serverId + ", component: "
66 + "}";
67 }
68
69 @Override
70 public String getType()
71 {
72 return "trace";
73 }
74 }