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