1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.processor; |
12 | |
|
13 | |
import org.mule.api.MessagingException; |
14 | |
import org.mule.api.MuleEvent; |
15 | |
import org.mule.api.config.MuleProperties; |
16 | |
import org.mule.api.config.ThreadingProfile; |
17 | |
import org.mule.api.context.WorkManagerSource; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class OptionalAsyncInterceptingMessageProcessor extends AsyncInterceptingMessageProcessor |
26 | |
{ |
27 | |
public OptionalAsyncInterceptingMessageProcessor(WorkManagerSource workManagerSource) |
28 | |
{ |
29 | 0 | super(workManagerSource); |
30 | 0 | } |
31 | |
|
32 | |
@Deprecated |
33 | |
public OptionalAsyncInterceptingMessageProcessor(WorkManagerSource workManagerSource, boolean doThreading) |
34 | |
{ |
35 | 0 | super(workManagerSource, doThreading); |
36 | 0 | } |
37 | |
|
38 | |
public OptionalAsyncInterceptingMessageProcessor(ThreadingProfile threadingProfile, |
39 | |
String name, |
40 | |
int shutdownTimeout) |
41 | |
{ |
42 | 0 | super(threadingProfile, name, shutdownTimeout); |
43 | 0 | } |
44 | |
|
45 | |
@Override |
46 | |
protected boolean isProcessAsync(MuleEvent event) throws MessagingException |
47 | |
{ |
48 | 0 | Object messageProperty = event.getMessage().getInboundProperty(MuleProperties.MULE_FORCE_SYNC_PROPERTY); |
49 | 0 | boolean forceSync = Boolean.TRUE.equals(messageProperty); |
50 | |
|
51 | 0 | boolean hasResponse = event.getEndpoint().getExchangePattern().hasResponse(); |
52 | 0 | boolean isTransacted = event.getEndpoint().getTransactionConfig().isTransacted(); |
53 | |
|
54 | 0 | return !forceSync && doThreading && !hasResponse && !isTransacted; |
55 | |
} |
56 | |
|
57 | |
} |