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 | |
|
30 | |
static { |
31 | 0 | registerAction("missed async reply", MISSED_ASYNC_REPLY); |
32 | 0 | registerAction("async reply timeout", ASYNC_REPLY_TIMEOUT); |
33 | 0 | registerAction("correlation timeout", CORRELATION_TIMEOUT); |
34 | 0 | } |
35 | |
|
36 | |
public RoutingNotification(MuleMessage resource, String identifier, int action) |
37 | |
{ |
38 | 0 | super(resource, action); |
39 | 0 | resourceIdentifier = identifier; |
40 | 0 | } |
41 | |
|
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 | |
public String getType() |
55 | |
{ |
56 | 0 | if (action == MISSED_ASYNC_REPLY) |
57 | |
{ |
58 | 0 | return TYPE_WARNING; |
59 | |
} |
60 | 0 | else if (action == ASYNC_REPLY_TIMEOUT) |
61 | |
{ |
62 | 0 | return TYPE_WARNING; |
63 | |
} |
64 | |
else |
65 | |
{ |
66 | 0 | return TYPE_INFO; |
67 | |
} |
68 | |
} |
69 | |
|
70 | |
} |