camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r685153 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml
Date Tue, 12 Aug 2008 13:58:50 GMT
Author: ningjiang
Date: Tue Aug 12 06:58:49 2008
New Revision: 685153

URL: http://svn.apache.org/viewvc?rev=685153&view=rev
Log:
CAMEL-815 support to set the loadBalancerStrategy before the outputs elements

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java?rev=685153&r1=685152&r2=685153&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
Tue Aug 12 06:58:49 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.model;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
@@ -23,6 +24,7 @@
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
 
@@ -48,7 +50,7 @@
  */
 @XmlRootElement(name = "loadBalance")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class LoadBalanceType extends OutputType<LoadBalanceType> {
+public class LoadBalanceType extends ProcessorType<LoadBalanceType> {
     @XmlAttribute(required = false)
     private String ref;
 
@@ -60,6 +62,9 @@
         )
     private LoadBalancerType loadBalancerType;
 
+    @XmlElementRef
+    private List<ProcessorType<?>> outputs = new ArrayList<ProcessorType<?>>();
+
     public LoadBalanceType() {
     }
 
@@ -68,6 +73,28 @@
         return "loadbalance";
     }
 
+    public List<ProcessorType<?>> getOutputs() {
+        return outputs;
+    }
+
+    public void setOutputs(List<ProcessorType<?>> outputs) {
+        this.outputs = outputs;
+        if (outputs != null) {
+            for (ProcessorType output : outputs) {
+                configureChild(output);
+            }
+        }
+    }
+
+
+    @Override
+    protected void configureChild(ProcessorType output) {
+        super.configureChild(output);
+        if (isInheritErrorHandler()) {
+            output.setErrorHandlerBuilder(getErrorHandlerBuilder());
+        }
+    }
+
     public String getRef() {
         return ref;
     }

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml?rev=685153&r1=685152&r2=685153&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/loadBalance.xml
Tue Aug 12 06:58:49 2008
@@ -22,16 +22,17 @@
        http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
     ">
 
-  
+
   <!-- START SNIPPET: example -->
-  <bean id = "roundRobinRef" class="org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer"
/>
+
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="direct:start"/>
-      <loadBalance ref="roundRobinRef">
-          <to uri="mock:x"/>        
-          <to uri="mock:y"/>       
-          <to uri="mock:z"/>          
+      <loadBalance>
+          <roundRobin/>
+          <to uri="mock:x"/>
+          <to uri="mock:y"/>
+          <to uri="mock:z"/>
       </loadBalance>
     </route>
   </camelContext>



Mime
View raw message