[CONF] Apache Camel Spring Web Services
Spring Web Services Page edited by Richard Kettelerij Comment: improved docs Changes (1) ... {code} More information on setting up Spring-WS can be found in [Writing Contract-First Web Services|http://static.springsource.org/spring-ws/sites/1.5/reference/html/tutorial.html]. Basically paragraph 3.6 Implementing the Endpoint is handled by this component (specifically paragraph 3.6.2 Routing the Message to the Endpoint is where {{CamelEndpointMapping}} comes in). h3. Endpoint mapping in routes ... Full Content Spring Web Services Component Available as of Camel 2.6 The springws: component allows you to integrate with Spring Web Services. It offers both client-side support, for accessing web services, and server-side support for creating your own contract-first web services. Maven users will need to add the following dependency to their pom.xml for this component: dependency groupIdorg.apache.camel/groupId artifactIdcamel-spring-ws/artifactId versionx.x.x/version !-- use the same version as your Camel core version -- /dependency DependenciesThis component offers support for Spring-WS 1.5.9 which is compatible with Spring 2.5.x. In order to run Spring-WS 1.5.9 on Spring 3.0 you need to exclude the OXM module from Spring 3.0 as this module is also included in Spring-WS 1.5.9 (see this post) URI format The URI scheme for this component is as follows springws:[mapping-type:]address[?options] To expose a web service mapping-type needs to be set to any of the following: Mapping type Description rootqname Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction Used to map web service requests based on the SOAP action specified in the header of the message. uri In order to map web service requests that target a specific URI. xpathresult Used to map web service requests based on the evaluation of an XPath _expression_ against the incoming message. The result of the evaluation should match the XPath result specified in the endpoint URI. beanname Allows you to reference a org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher in order to integrate with existing (legacy) endpoint mappings like PayloadRootQNameEndpointMapping, SoapActionEndpointMapping, etc As a consumer the address should contain a value relevant to the specified mapping-type (e.g. a SOAP action, XPath _expression_). As a producer the address should be set to the URI of the web service your calling upon. You can append query options to the URI in the following format, ?option=valueoption=value... Options Name Required? Description soapAction No SOAP action to include inside a SOAP request when accessing remote web services wsAddressingAction No WS-Addressing 1.0 action header to include when accessing web services. The To header is set to the address of the web service as specified in the endpoint URI (default Spring-WS behavior). _expression_ Only when mapping-type is xpathresult XPath _expression_ to use in the process of mapping web service requests, should match the result specified by xpathresult Registry based options The following options can be specified in the registry (most likely a Spring ApplicationContext) and referenced from the endpoint URI using the # notation. Name Required? Description webServiceTemplate No Option to provide a custom WebServiceTemplate. This allows for full control over client-side web services handling; like adding a custom interceptor or specifying a fault resolver, message sender or message factory. messageSender No Option to provide a custom WebServiceMessageSender. For example to perform authentication or use alternative transports messageFactory No Option to provide a custom WebServiceMessageFactory. For example when you want Apache Axiom to handle web service messages instead of SAAJ transformerFactory No Option to override default TransformerFactory. The provided transformer factory must be of type javax.xml.transform.TransformerFactory endpointMapping Only when mapping-type is rootqname, soapaction, uri or xpathresult Reference to org.apache.camel.component.spring.ws.bean.CamelEndpointMapping in the Registry/ApplicationContext. Only one bean is required in the registry to serve all Camel/Spring-WS endpoints. This bean is auto-discovered by the MessageDispatcher and used to map requests to Camel endpoints based on characteristics specified on the endpoint (like root QName, SOAP action, etc) Message headers Name Type Description CamelSpringWebserviceEndpointUri String URI of the
svn commit: r1027842 - in /camel/trunk/platforms/karaf/features/src/main/resources: features-spring2.xml features.xml
Author: davsclaus Date: Wed Oct 27 07:18:23 2010 New Revision: 1027842 URL: http://svn.apache.org/viewvc?rev=1027842view=rev Log: Added missing license header Modified: camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml camel/trunk/platforms/karaf/features/src/main/resources/features.xml Modified: camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml?rev=1027842r1=1027841r2=1027842view=diff == --- camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml (original) +++ camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml Wed Oct 27 07:18:23 2010 @@ -1,4 +1,21 @@ ?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. +-- features feature name='spring' version='${spring-version}' bundlemvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance-bundle-version}/bundle Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1027842r1=1027841r2=1027842view=diff == --- camel/trunk/platforms/karaf/features/src/main/resources/features.xml (original) +++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Wed Oct 27 07:18:23 2010 @@ -1,4 +1,21 @@ ?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. +-- features feature name='spring' version='${spring3-version}' bundlemvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance-bundle-version}/bundle
svn commit: r1027919 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/test/java/org/apache/camel/builder/ camel-core/src/test/java/org/apache/camel/processor/onexce
Author: davsclaus Date: Wed Oct 27 11:37:21 2010 New Revision: 1027919 URL: http://svn.apache.org/viewvc?rev=1027919view=rev Log: CAMEL-3281: Java DSL now fails fast if onException and the likes are not configured before routes, which they must. Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionAfterRouteTest.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderAddRoutesTest.java camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithIoOutProcessorExceptionTest.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?rev=1027919r1=1027918r2=1027919view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java Wed Oct 27 11:37:21 2010 @@ -136,6 +136,9 @@ public abstract class RouteBuilder exten * @return the current builder with the error handler configured */ public RouteBuilder errorHandler(ErrorHandlerBuilder errorHandlerBuilder) { +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(errorHandler must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); setErrorHandlerBuilder(errorHandlerBuilder); return this; @@ -147,6 +150,9 @@ public abstract class RouteBuilder exten * @return the builder */ public InterceptDefinition intercept() { +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(intercept must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.intercept(); } @@ -157,6 +163,9 @@ public abstract class RouteBuilder exten * @return the builder */ public InterceptFromDefinition interceptFrom() { +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(interceptFrom must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.interceptFrom(); } @@ -168,6 +177,9 @@ public abstract class RouteBuilder exten * @return the builder */ public InterceptFromDefinition interceptFrom(String uri) { +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(interceptFrom must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.interceptFrom(uri); } @@ -179,6 +191,9 @@ public abstract class RouteBuilder exten * @return the builder */ public InterceptSendToEndpointDefinition interceptSendToEndpoint(String uri) { +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(interceptSendToEndpoint must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.interceptSendToEndpoint(uri); } @@ -191,6 +206,10 @@ public abstract class RouteBuilder exten * @return the builder */ public OnExceptionDefinition onException(Class exception) { +// is only allowed at the top currently +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(onException must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.onException(exception); } @@ -217,6 +236,10 @@ public abstract class RouteBuilder exten * @return the builder */ public OnCompletionDefinition onCompletion() { +// is only allowed at the top currently +if (!routeCollection.getRoutes().isEmpty()) { +throw new IllegalArgumentException(onCompletion must be defined before any routes in the RouteBuilder); +} routeCollection.setCamelContext(getContext()); return routeCollection.onCompletion(); } Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderAddRoutesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderAddRoutesTest.java?rev=1027919r1=1027918r2=1027919view=diff == ---
[CONF] Apache Camel Camel 2.6.0 Release
Camel 2.6.0 Release Page edited by Claus Ibsen Changes (1) ... * Fixed issue in OSGi with refreshing Camel bundles causing a race condition when discovering type converters * Introduced [ScheduledRoutePolicy] with the [Quartz] component * Java DSL [RouteBuilder] now fails if {{onException}} and the likes are not configured before routes, which they must. h3. New [Enterprise Integration Patterns] ... Full Content Camel 2.6.0 release (currently in progress) New and Noteworthy Welcome to the 2.6.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Fixed issue in OSGi with refreshing Camel bundles causing a race condition when discovering type converters Introduced ScheduledRoutePolicy with the Quartz component Java DSL RouteBuilder now fails if onException and the likes are not configured before routes, which they must. New Enterprise Integration Patterns New Components New DSL New Annotations New Data Formats New Languages New Examples New Tutorials API breaking Known Issues The Tracer may not output all details for some situations such as when using onCompletion or intercept etc. Not all Examples have ANT build.xml files to run the example using ANT. Project cannot be fully build using Maven 3.0 One may encounter build errors in camel-ftp with java versions older than "1.5.0_24" Dozer does not work in OSGi camel-blueprint is not fully feature complete (such as @Producer, @Consume is not supported) camel-blueprint using package scan does not work Important changes to consider when upgrading Getting the Distributions Binary Distributions Description Download Link PGP Signature file of download Windows Distribution apache-camel-2.6.0.zip apache-camel-2.6.0.zip.asc Unix/Linux/Cygwin Distribution apache-camel-2.6.0.tar.gz apache-camel-2.6.0.tar.gz.asc The above URLs use redirectionThe above URLs use the Apache Mirror system to redirect you to a suitable mirror for your download. Some users have experienced issues with some versions of browsers (e.g. some Safari browsers). If the download doesn't seem to work for you from the above URL then try using FireFox Source Distributions Description Download Link PGP Signature file of download Source for Windows apache-camel-2.6.0-src.zip apache-camel-2.6.0-src.zip.asc Source for Unix/Linux/Cygwin apache-camel-2.6.0-src.tar.gz apache-camel-2.6.0-src.tar.gz.asc Getting the Binaries using Maven 2 To use this release in your maven project, the proper dependency configuration that you should use in your Maven POM is: dependency groupIdorg.apache.camel/groupId artifactIdcamel-core/artifactId version2.6.0/version /dependency SVN Tag Checkout svn co http://svn.apache.org/repos/asf/camel/tags/camel-2.6.0 Changelog For a more detailed view of new features and bug fixes, see the: release notes for 2.6.0 Change Notification Preferences View Online | View Changes | Add Comment
svn commit: r1027979 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/loadbalancer/ camel-core/src/test/java/org/apache/camel/process
Author: akarpe Date: Wed Oct 27 14:38:45 2010 New Revision: 1027979 URL: http://svn.apache.org/viewvc?rev=1027979view=rev Log: CAMEL-3197 - Changed the Default Delimiter from : to , Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java camel/trunk/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRandomLoadBalance.xml camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/weightedRoundRobinLoadBalance.xml Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java?rev=1027979r1=1027978r2=1027979view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java Wed Oct 27 14:38:45 2010 @@ -195,21 +195,7 @@ public class LoadBalanceDefinition exten * @return the builder */ public LoadBalanceDefinition weighted(boolean roundRobin, String distributionRatio) { -WeightedLoadBalancer weighted; -ListInteger distributionRatioList = new ArrayListInteger(); - -String[] ratios = distributionRatio.split(:); -for (String ratio : ratios) { -distributionRatioList.add(new Integer(ratio)); -} - -if (!roundRobin) { -weighted = new WeightedRandomLoadBalancer(distributionRatioList); -} else { -weighted = new WeightedRoundRobinLoadBalancer(distributionRatioList); -} -loadBalancerType = new LoadBalancerDefinition(weighted); -return this; +return weighted(roundRobin, distributionRatio, ,); } /** Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java?rev=1027979r1=1027978r2=1027979view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java Wed Oct 27 14:38:45 2010 @@ -56,7 +56,7 @@ public class WeightedLoadBalancerDefinit try { if (distributionRatioDelimiter == null) { -distributionRatioDelimiter = :; +distributionRatioDelimiter = ,; } String[] ratios = distributionRatio.split(distributionRatioDelimiter); Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java?rev=1027979r1=1027978r2=1027979view=diff == --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRandomLoadBalanceTest.java Wed Oct 27 14:38:45 2010 @@ -50,7 +50,7 @@ public class WeightedRandomLoadBalanceTe // START SNIPPET: example from(direct:start) -.loadBalance().weighted(false, 4:2:1) +.loadBalance().weighted(false, 4,2,1) .to(mock:x, mock:y, mock:z); // END SNIPPET: example } @@ -113,7 +113,7 @@ public class WeightedRandomLoadBalanceTe public void configure() { // START SNIPPET: example from(direct:start) -.loadBalance().weighted(false, 2:3) +.loadBalance().weighted(false, 2,3) .to(mock:x, mock:y, mock:z); // END SNIPPET: example } Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WeightedRoundRobinLoadBalanceTest.java URL:
[CONF] Apache Camel Load Balancer
Load Balancer Page edited by Ashwin Karpe Changes (7) ... || Option || Type || Default || Description || | roundRobin | boolean | false | The default value for round-robin is false. In the absence of this setting or parameter the load balancing algorithm used is random. | distributionRatio | String | none | The distributionRatio is a delimited String consisting on integer weights separated by delimiters for example 2:3:5. 2,3,5. The distributionRatio must match the number of endpoints and/or processors specified in the load balancer list. | | distributionRatioDelimiter | String | : , | The distributionRatioDelimiter is the delimiter used to specify the distributionRatio. If this attribute is not specified a default delimiter :, is expected as the delimiter used for specifying the distributionRatio. | h4. Using Weighted round-robin random load balancing ... // round-robin from(direct:start) .loadBalance().weighted(true, 4:2:1) .loadBalance().weighted(true, 4:2:1 distributionRatioDelimiter=:) .to(mock:x, mock:y, mock:z); //random from(direct:start) .loadBalance().weighted(false, 4,2,1, ,) .loadBalance().weighted(false, 4,2,1) .to(mock:x, mock:y, mock:z); {code} ... from uri=direct:start/ loadBalance weighted roundRobin=false distributionRatio=4,2,1 distributionRatioDelimiter=, distributionRatio=4-2-1 distributionRatioDelimiter=- / to uri=mock:x/ to uri=mock:y/ ... Full Content Load Balancer The Load Balancer Pattern allows you to delegate to one of a number of endpoints using a variety of different load balancing policies. Build in load balancing policies Camel has out of the box the following policies: Policy Description Round Robin The exchanges is selected in a round robin fashion. This is a well known and classic policy. This spreads the load even. Random A random endpoint is selected for each exchange Sticky Sticky load balancing using an _expression_ to calculate a correlation key to perform the sticky load balancing; rather like jsessionid in the web or JMSXGroupID in JMS. Topic Topic which sends to all destinations (rather like JMS Topics) Failover Camel 2.0: In case of failures the exchange is tried on the next endpoint. Weighted Round-Robin Camel 2.5: The weighted load balancing policy allows you to specify a processing load distribution ratio for each server with respect to others.In addition to the weight, endpoint selection is then further refined using round-robin distribution based on weight. Weighted Random Camel 2.5: The weighted load balancing policy allows you to specify a processing load distribution ratio for each server with respect to others.In addition to the weight, endpoint selection is then further refined using random distribution based on weight. Round Robin Camel 1.x behavior The round robin load balancer can actually be used to failover with Camel 1.x. This is no longer possible in Camel 2.x as the underlying Error Handler foundation has been significantly overhauled in Camel 2.x. Frankly the round robin load balancer in Camel 1.x was not thought to be used in a failover scenario. Camel 2.x behavior The round robin load balancer is not meant to work with failover, for that you should use the dedicated failover load balancer. The round robin load balancer will only change to next endpoint per message. The round robin load balancer is statefull as it keeps state which endpoint to use next time. Using the Fluent Builders from("direct:start").loadBalance(). roundRobin().to("mock:x", "mock:y", "mock:z"); Using the Spring configuration camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" route from uri="direct:start"/ loadBalance roundRobin/ to uri="mock:x"/ to uri="mock:y"/ to uri="mock:z"/ /loadBalance /route /camelContext So the above example will load balance requests from direct:start to one of the available mock endpoint instances, in this case using a round robbin policy. For further examples of this pattern in use you could look at the junit test case Failover Available as of Camel 2.0 The failover load balancer is capable of trying the next processor in case an Exchange failed with an exception during processing. You can configure the failover with a list of specific exception to only failover. If you do not specify any exceptions it will failover over any exceptions. It uses the same strategy for matching exceptions as the Exception