1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.service; |
12 | |
|
13 | |
import org.mule.api.MessagingException; |
14 | |
import org.mule.api.MuleEvent; |
15 | |
import org.mule.api.MuleException; |
16 | |
import org.mule.api.processor.MessageProcessor; |
17 | |
import org.mule.api.routing.RoutingException; |
18 | |
import org.mule.api.service.Service; |
19 | |
import org.mule.routing.MessageFilter; |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
@Deprecated |
27 | 0 | public class ForwardingConsumer extends MessageFilter |
28 | |
{ |
29 | |
@Override |
30 | |
public MuleEvent processNext(MuleEvent event) throws MessagingException |
31 | |
{ |
32 | 0 | if (!(event.getFlowConstruct() instanceof Service)) |
33 | |
{ |
34 | 0 | throw new UnsupportedOperationException("ForwardingConsumer is only supported with Service"); |
35 | |
} |
36 | |
|
37 | 0 | MessageProcessor processor = ((Service) event.getFlowConstruct()).getOutboundMessageProcessor(); |
38 | |
|
39 | |
|
40 | |
|
41 | 0 | event.setStopFurtherProcessing(true); |
42 | |
|
43 | 0 | if (processor == null) |
44 | |
{ |
45 | 0 | logger.debug("Descriptor has no outbound router configured to forward to, continuing with normal processing"); |
46 | 0 | return event; |
47 | |
} |
48 | |
else |
49 | |
{ |
50 | |
try |
51 | |
{ |
52 | 0 | MuleEvent resultEvent = processor.process(event); |
53 | 0 | if (resultEvent != null) |
54 | |
{ |
55 | 0 | return resultEvent; |
56 | |
} |
57 | |
else |
58 | |
{ |
59 | 0 | return null; |
60 | |
} |
61 | |
} |
62 | 0 | catch (MuleException e) |
63 | |
{ |
64 | 0 | throw new RoutingException(event, this, e); |
65 | |
} |
66 | |
} |
67 | |
} |
68 | |
} |