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