Author: ffang
Date: Fri Sep 26 21:51:26 2008
New Revision: 699555

URL: http://svn.apache.org/viewvc?rev=699555&view=rev
Log:
[SM-1592]cxf-bc consumer should allow async sending of message exchanges to the 
NMR

Added:
    
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
   (with props)
Modified:
    
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java

Modified: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=699555&r1=699554&r2=699555&view=diff
==============================================================================
--- 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
 (original)
+++ 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
 Fri Sep 26 21:51:26 2008
@@ -254,8 +254,10 @@
     }
 
     public void process(MessageExchange exchange) throws Exception {
+        synchronized (messages.get(exchange.getExchangeId())) {
+            messages.get(exchange.getExchangeId()).notifyAll();
+        }
         Message message = messages.remove(exchange.getExchangeId());
-        message.getInterceptorChain().resume();
         if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
             exchange.setStatus(ExchangeStatus.DONE);
             message.getExchange().get(ComponentContext.class)
@@ -590,15 +592,16 @@
             message.getExchange().setOneWay(CxfBcConsumer.this.isOneway);
 
             try {
-                if (CxfBcConsumer.this.synchronous
+                if (CxfBcConsumer.this.isSynchronous()
                         && !CxfBcConsumer.this.isOneway) {
-                    message.getInterceptorChain().pause();
                     context.getDeliveryChannel().sendSync(exchange,
                             timeout * 1000);
                     process(exchange);
                 } else {
-                    context.getDeliveryChannel().send(exchange);
-
+                    synchronized 
(CxfBcConsumer.this.messages.get(exchange.getExchangeId())) {
+                        context.getDeliveryChannel().send(exchange);
+                        
CxfBcConsumer.this.messages.get(exchange.getExchangeId()).wait(timeout * 1000);
+                    }
                 }
             } catch (Exception e) {
                 throw new Fault(e);
@@ -815,4 +818,18 @@
         return useJBIWrapper;
     }
 
+    /**
+     * Specifies if the endpoint expects send messageExchange by sendSync 
+     * @param  synchronous a boolean
+     * @org.apache.xbean.Property description="Specifies if the endpoint 
expects send messageExchange by sendSync . 
+     * Default is <code>true</code>."
+     **/
+    public void setSynchronous(boolean synchronous) {
+        this.synchronous = synchronous;
+    }
+
+    public boolean isSynchronous() {
+        return synchronous;
+    }
+
 }

Modified: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java?rev=699555&r1=699554&r2=699555&view=diff
==============================================================================
--- 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
 (original)
+++ 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
 Fri Sep 26 21:51:26 2008
@@ -89,6 +89,11 @@
         multiClientTestBase();
     }
     
+    public void testMultipleClientWithAsyn() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/xbean_asyn.xml");
+        multiClientTestBase();
+    }
+    
     private void calculatorTestBase() throws Exception {
 
         URL wsdl = getClass().getResource("/wsdl/calculator.wsdl");

Added: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml?rev=699555&view=auto
==============================================================================
--- 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
 (added)
+++ 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
 Fri Sep 26 21:51:26 2008
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
+       xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0";
+       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0";
+       xmlns:test="urn:test"
+       xmlns:calculator="http://apache.org/cxf/calculator";>
+  
+  <sm:container id="jbi" embedded="true">
+    
+    <sm:endpoints>
+      <cxfse:endpoint>
+        <cxfse:pojo>
+          <bean class="org.apache.cxf.calculator.CalculatorImpl" />
+        </cxfse:pojo>
+        <cxfse:inInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+        </cxfse:inInterceptors>
+        <cxfse:outInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+        </cxfse:outInterceptors>
+        <cxfse:inFaultInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+        </cxfse:inFaultInterceptors>
+        <cxfse:outFaultInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+        </cxfse:outFaultInterceptors>
+      </cxfse:endpoint>
+      <cxfbc:consumer wsdl="/wsdl/calculator.wsdl"
+                      targetEndpoint="CalculatorPort"
+                      targetService="calculator:CalculatorService"
+                      targetInterface="calculator:CalculatorPortType"
+                      synchronous="false"
+                      >
+        <cxfbc:inInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+        </cxfbc:inInterceptors>
+        <cxfbc:outInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+        </cxfbc:outInterceptors>
+        <cxfbc:inFaultInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+        </cxfbc:inFaultInterceptors>
+        <cxfbc:outFaultInterceptors>
+          <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+        </cxfbc:outFaultInterceptors>
+      </cxfbc:consumer>
+    </sm:endpoints>
+    
+  </sm:container>
+  
+</beans>

Propchange: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to