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