You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/09/27 07:40:40 UTC
svn commit: r699564 - in
/servicemix/components/bindings/servicemix-cxf-bc/trunk/src:
main/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfbc/
test/resources/org/apache/servicemix/cxfbc/
Author: ffang
Date: Fri Sep 26 22:40:40 2008
New Revision: 699564
URL: http://svn.apache.org/viewvc?rev=699564&view=rev
Log:
[SM-1592]cxf-bc consumer should allow async sending of message exchanges to the NMR
Added:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml (with props)
Modified:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=699564&r1=699563&r2=699564&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Fri Sep 26 22:40:40 2008
@@ -258,8 +258,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)
@@ -609,14 +611,18 @@
message.getExchange().setOneWay(CxfBcConsumer.this.isOneway);
try {
- if (CxfBcConsumer.this.synchronous
+ if (CxfBcConsumer.this.isOneway) {
+ context.getDeliveryChannel().send(exchange);
+ } else if (CxfBcConsumer.this.isSynchronous()
&& !CxfBcConsumer.this.isOneway) {
- message.getInterceptorChain().pause();
context.getDeliveryChannel().sendSync(exchange,
timeout);
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);
+ }
}
} catch (Exception e) {
@@ -829,5 +835,19 @@
public boolean isUseJBIWrapper() {
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/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java?rev=699564&r1=699563&r2=699564&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java Fri Sep 26 22:40:40 2008
@@ -89,6 +89,12 @@
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/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml?rev=699564&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml Fri Sep 26 22:40:40 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/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml