You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2012/09/18 10:02:55 UTC
svn commit: r1387030 - in /camel/branches/camel-2.9.x: ./
components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/
components/camel-cxf/
components/camel-cxf/src/main/java/org/apache/camel/component/cxf/
components/ca...
Author: ningjiang
Date: Tue Sep 18 08:02:54 2012
New Revision: 1387030
URL: http://svn.apache.org/viewvc?rev=1387030&view=rev
Log:
CAMEL-5622 CxfConsumer should avoid using the async invocation with the decouple endpoints transport
Added:
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/
- copied from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/HelloWorld.java
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/HelloWorld.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/HelloWorldImpl.java
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/HelloWorldImpl.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/MessageLossSimulator.java
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/MessageLossSimulator.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/MyProcessor.java
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/MyProcessor.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/WSRMTest.java
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsrm/WSRMTest.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/resources/HelloWorld.wsdl
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/resources/HelloWorld.wsdl
camel/branches/camel-2.9.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/
- copied from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/
camel/branches/camel-2.9.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/WSRMTest-context.xml
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/WSRMTest-context.xml
camel/branches/camel-2.9.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/ws_rm.xml
- copied unchanged from r1387024, camel/branches/camel-2.10.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsrm/ws_rm.xml
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/CxfConstants.java
camel/branches/camel-2.9.x/components/camel-cxf/pom.xml
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1387019
Merged /camel/branches/camel-2.10.x:r1387024
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/CxfConstants.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/CxfConstants.java?rev=1387030&r1=1387029&r2=1387030&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/CxfConstants.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/CxfConstants.java Tue Sep 18 08:02:54 2012
@@ -54,6 +54,11 @@ public final class CxfConstants {
public static final String CAMEL_CXF_RS_OPERATION_RESOURCE_INFO_STACK = "CamelCxfRsOperationResourceInfoStack";
public static final String CAMEL_CXF_ATTACHMENTS = "CamelAttachments";
public static final String CAMEL_CXF_RS_THROW_EXCEPTION_ON_FAILURE = "CamelCxfRsThrowExceptionOnFailure";
+
+ public static final String WSA_HEADERS_INBOUND = "javax.xml.ws.addressing.context.inbound";
+
+ public static final String WSA_HEADERS_OUTBOUND = "javax.xml.ws.addressing.context.outbound";
+
private CxfConstants() {
// Utility class
Modified: camel/branches/camel-2.9.x/components/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/pom.xml?rev=1387030&r1=1387029&r2=1387030&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/pom.xml (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/pom.xml Tue Sep 18 08:02:54 2012
@@ -188,6 +188,14 @@
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
+
+ <!-- this dependency is just for testing -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-rm</artifactId>
+ <version>${cxf-version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=1387030&r1=1387029&r2=1387030&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Tue Sep 18 08:02:54 2012
@@ -36,6 +36,8 @@ import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.service.invoker.Invoker;
import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +65,8 @@ public class CxfConsumer extends Default
public Object invoke(Exchange cxfExchange, Object o) {
LOG.trace("Received CXF Request: {}", cxfExchange);
Continuation continuation;
- if (!endpoint.isSynchronous() && (continuation = getContinuation(cxfExchange)) != null) {
+ if (!endpoint.isSynchronous() && isAsyncInvocationSupported(cxfExchange)
+ && (continuation = getContinuation(cxfExchange)) != null) {
LOG.trace("Calling the Camel async processors.");
return asyncInvoke(cxfExchange, continuation);
} else {
@@ -241,6 +244,23 @@ public class CxfConsumer extends Default
super.doStop();
}
+ protected boolean isAsyncInvocationSupported(Exchange cxfExchange) {
+ Message cxfMessage = cxfExchange.getInMessage();
+ AddressingProperties addressingProperties = (AddressingProperties) cxfMessage.get(CxfConstants.WSA_HEADERS_INBOUND);
+ if (addressingProperties != null
+ && !ContextUtils.isGenericAddress(addressingProperties.getReplyTo())) {
+ //it's decoupled endpoint, so already switch thread and
+ //use executors, which means underlying transport won't
+ //be block, so we shouldn't rely on continuation in
+ //this case, as the SuspendedInvocationException can't be
+ //caught by underlying transport. So we should use the SyncInvocation this time
+ return false;
+ }
+ // we assume it should support AsyncInvocation out of box
+ return true;
+
+ }
+
public Server getServer() {
return server;
}