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.context.notification.ServerNotification; |
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class RoutingNotification extends ServerNotification |
21 | |
{ |
22 | |
|
23 | |
|
24 | |
|
25 | |
private static final long serialVersionUID = -6455441938378523145L; |
26 | |
public static final int MISSED_ASYNC_REPLY = ROUTING_EVENT_ACTION_START_RANGE + 1; |
27 | |
public static final int ASYNC_REPLY_TIMEOUT = ROUTING_EVENT_ACTION_START_RANGE + 2; |
28 | |
public static final int CORRELATION_TIMEOUT = ROUTING_EVENT_ACTION_START_RANGE + 3; |
29 | |
public static final int MISSED_AGGREGATION_GROUP_EVENT = ROUTING_EVENT_ACTION_START_RANGE + 4; |
30 | |
|
31 | |
|
32 | |
static { |
33 | 0 | registerAction("missed async reply", MISSED_ASYNC_REPLY); |
34 | 0 | registerAction("async reply timeout", ASYNC_REPLY_TIMEOUT); |
35 | 0 | registerAction("correlation timeout", CORRELATION_TIMEOUT); |
36 | 0 | registerAction("missed aggregation group event", MISSED_AGGREGATION_GROUP_EVENT); |
37 | 0 | } |
38 | |
|
39 | |
public RoutingNotification(MuleMessage resource, String identifier, int action) |
40 | |
{ |
41 | 0 | super(cloneMessage(resource), action); |
42 | 0 | resourceIdentifier = identifier; |
43 | 0 | } |
44 | |
|
45 | |
@Override |
46 | |
protected String getPayloadToString() |
47 | |
{ |
48 | |
try |
49 | |
{ |
50 | 0 | return ((MuleMessage)source).getPayloadAsString(); |
51 | |
} |
52 | 0 | catch (Exception e) |
53 | |
{ |
54 | 0 | return source.toString(); |
55 | |
} |
56 | |
} |
57 | |
|
58 | |
@Override |
59 | |
public String getType() |
60 | |
{ |
61 | 0 | if (action == MISSED_ASYNC_REPLY) |
62 | |
{ |
63 | 0 | return TYPE_WARNING; |
64 | |
} |
65 | 0 | else if (action == ASYNC_REPLY_TIMEOUT) |
66 | |
{ |
67 | 0 | return TYPE_WARNING; |
68 | |
} |
69 | 0 | else if (action == MISSED_AGGREGATION_GROUP_EVENT) |
70 | |
{ |
71 | 0 | return TYPE_WARNING; |
72 | |
} |
73 | |
else |
74 | |
{ |
75 | 0 | return TYPE_INFO; |
76 | |
} |
77 | |
} |
78 | |
|
79 | |
} |