1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.service; |
12 | |
|
13 | |
import org.mule.api.MuleException; |
14 | |
import org.mule.api.processor.MessageProcessor; |
15 | |
import org.mule.api.routing.Aggregator; |
16 | |
import org.mule.management.stats.RouterStatistics; |
17 | |
import org.mule.processor.chain.DefaultMessageProcessorChainBuilder; |
18 | |
import org.mule.routing.AbstractAggregator; |
19 | |
import org.mule.source.StartableCompositeMessageSource; |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class ServiceAsyncReplyCompositeMessageSource extends ServiceCompositeMessageSource |
26 | |
{ |
27 | |
protected Long timeout; |
28 | 0 | protected boolean failOnTimeout = true; |
29 | |
|
30 | |
public ServiceAsyncReplyCompositeMessageSource() |
31 | 0 | { |
32 | 0 | statistics = new RouterStatistics(RouterStatistics.TYPE_RESPONSE); |
33 | 0 | } |
34 | |
|
35 | |
protected void createMessageProcessorChain() throws MuleException |
36 | |
{ |
37 | 0 | DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder(flowConstruct); |
38 | 0 | builder.chain(processors); |
39 | 0 | builder.chain(listener); |
40 | 0 | listener = builder.build(); |
41 | 0 | } |
42 | |
|
43 | |
public Long getTimeout() |
44 | |
{ |
45 | 0 | return timeout; |
46 | |
} |
47 | |
|
48 | |
public void setTimeout(Long timeout) |
49 | |
{ |
50 | 0 | this.timeout = timeout; |
51 | 0 | } |
52 | |
|
53 | |
public boolean isFailOnTimeout() |
54 | |
{ |
55 | 0 | return failOnTimeout; |
56 | |
} |
57 | |
|
58 | |
public void setFailOnTimeout(boolean failOnTimeout) |
59 | |
{ |
60 | 0 | this.failOnTimeout = failOnTimeout; |
61 | 0 | } |
62 | |
|
63 | |
public void expireAggregation(String groupId) |
64 | |
{ |
65 | 0 | for (MessageProcessor processor : processors) |
66 | |
{ |
67 | 0 | if (processor instanceof Aggregator) |
68 | |
{ |
69 | 0 | ((AbstractAggregator) processor).expireAggregation(groupId); |
70 | |
} |
71 | |
} |
72 | 0 | } |
73 | |
|
74 | |
} |