CAMEL-6289: Separated broker example into cxf and jms. Thanks to Ravi Godbole 
for the patch.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/054515d2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/054515d2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/054515d2

Branch: refs/heads/master
Commit: 054515d26c82f094b934f364efdbacee35149756
Parents: 952ae96
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Feb 8 10:27:22 2017 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Feb 8 10:40:53 2017 +0100

----------------------------------------------------------------------
 examples/README.md                              |   3 +-
 .../camel-example-loan-broker-cxf/README.md     |  34 +++
 examples/camel-example-loan-broker-cxf/pom.xml  | 172 +++++++++++++++
 .../BankResponseAggregationStrategy.java        |  34 +++
 .../org/apache/camel/loanbroker/Client.java     |  60 ++++++
 .../camel/loanbroker/CreditScoreProcessor.java  |  73 +++++++
 .../org/apache/camel/loanbroker/LoanBroker.java |  37 ++++
 .../apache/camel/loanbroker/LoanBrokerWS.java   |  27 +++
 .../apache/camel/loanbroker/ReplyProcessor.java |  35 ++++
 .../org/apache/camel/loanbroker/bank/Bank.java  |  46 ++++
 .../apache/camel/loanbroker/bank/BankQuote.java |  61 ++++++
 .../apache/camel/loanbroker/bank/BankWS.java    |  32 +++
 .../camel/loanbroker/credit/CreditAgency.java   |  33 +++
 .../camel/loanbroker/credit/CreditAgencyWS.java |  31 +++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 ++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../META-INF/spring/webServiceCamelContext.xml  | 108 ++++++++++
 .../src/main/resources/features.xml             |  23 ++
 .../src/main/resources/loanbroker.properties    |  23 ++
 .../src/main/resources/log4j2.properties        |  23 ++
 .../src/main/resources/logging.properties       |  74 +++++++
 .../camel/loanbroker/LoanBrokerWSTest.java      |  79 +++++++
 .../src/test/resources/log4j2.properties        |  29 +++
 .../camel-example-loan-broker-jms/README.md     |  34 +++
 examples/camel-example-loan-broker-jms/pom.xml  | 177 ++++++++++++++++
 .../BankResponseAggregationStrategy.java        |  44 ++++
 .../org/apache/camel/loanbroker/Client.java     |  46 ++++
 .../org/apache/camel/loanbroker/Constants.java  |  27 +++
 .../camel/loanbroker/CreditAgencyProcessor.java |  36 ++++
 .../org/apache/camel/loanbroker/LoanBroker.java |  46 ++++
 .../camel/loanbroker/LoanBrokerRoute.java       |  49 +++++
 .../apache/camel/loanbroker/ReplyProcessor.java |  36 ++++
 .../camel/loanbroker/bank/BankProcessor.java    |  45 ++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 ++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../main/resources/META-INF/spring/client.xml   |  34 +++
 .../main/resources/META-INF/spring/server.xml   |  45 ++++
 .../src/main/resources/features.xml             |  41 ++++
 .../src/main/resources/loanbroker.properties    |  23 ++
 .../src/main/resources/log4j2.properties        |  23 ++
 .../src/main/resources/logging.properties       |  74 +++++++
 .../camel/loanbroker/LoanBrokerQueueTest.java   |  65 ++++++
 .../src/test/resources/log4j2.properties        |  29 +++
 examples/camel-example-loan-broker/README.md    |  42 ----
 examples/camel-example-loan-broker/pom.xml      | 210 -------------------
 .../BankResponseAggregationStrategy.java        |  44 ----
 .../camel/loanbroker/queue/version/Client.java  |  51 -----
 .../loanbroker/queue/version/Constants.java     |  27 ---
 .../queue/version/CreditAgencyProcessor.java    |  36 ----
 .../loanbroker/queue/version/JmsBroker.java     |  98 ---------
 .../loanbroker/queue/version/LoanBroker.java    |  63 ------
 .../queue/version/LoanBrokerRoute.java          |  49 -----
 .../queue/version/ReplyProcessor.java           |  36 ----
 .../queue/version/bank/BankProcessor.java       |  45 ----
 .../BankResponseAggregationStrategy.java        |  34 ---
 .../loanbroker/webservice/version/Client.java   |  58 -----
 .../version/CreditScoreProcessor.java           |  73 -------
 .../webservice/version/LoanBroker.java          |  37 ----
 .../webservice/version/LoanBrokerWS.java        |  27 ---
 .../webservice/version/ReplyProcessor.java      |  35 ----
 .../webservice/version/bank/Bank.java           |  46 ----
 .../webservice/version/bank/BankQuote.java      |  61 ------
 .../webservice/version/bank/BankWS.java         |  32 ---
 .../webservice/version/credit/CreditAgency.java |  33 ---
 .../version/credit/CreditAgencyWS.java          |  31 ---
 .../src/main/resources/META-INF/LICENSE.txt     | 203 ------------------
 .../src/main/resources/META-INF/NOTICE.txt      |  11 -
 .../META-INF/spring/webServiceCamelContext.xml  | 108 ----------
 .../src/main/resources/features.xml             |  42 ----
 .../src/main/resources/loanbroker.properties    |  23 --
 .../src/main/resources/log4j2.properties        |  23 --
 .../src/main/resources/logging.properties       |  74 -------
 .../queue/version/LoanBrokerQueueTest.java      |  77 -------
 .../webservice/version/LoanBrokerWSTest.java    |  77 -------
 .../src/test/resources/log4j2.properties        |  29 ---
 examples/pom.xml                                |   3 +-
 76 files changed, 2340 insertions(+), 1837 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/README.md
----------------------------------------------------------------------
diff --git a/examples/README.md b/examples/README.md
index b88da65..992ea67 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -38,7 +38,8 @@ All examples have been sort by type/category
 
 ##### Tutorials
 
-* [camel-example-loan-broker](camel-example-loan-broker/README.md)
+* [camel-example-loan-broker-cxf](camel-example-loan-broker-cxf/README.md)
+* [camel-example-loan-broker-jms](camel-example-loan-broker-jms/README.md)
 * [camel-example-reportincident](camel-example-reportincident/README.md)
 * 
[camel-example-reportincident-wssecurity](camel-example-reportincident-wssecurity/README.md)
 * [camel-example-cafe](camel-example-cafe/README.md)

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-cxf/README.md 
b/examples/camel-example-loan-broker-cxf/README.md
new file mode 100644
index 0000000..ed5366e
--- /dev/null
+++ b/examples/camel-example-loan-broker-cxf/README.md
@@ -0,0 +1,34 @@
+# Loan Broker Example
+
+### Introduction
+This example shows how to use Camel to implement the EIP's loan broker example,
+from the EIP book 
(http://www.enterpriseintegrationpatterns.com/SystemManagementExample.html).
+
+The example use web services for exchanging messages between
+the client, credit agency, and the banks.
+
+### Build
+
+You will need to compile this example first:
+
+       mvn compile
+
+### Run
+
+       mvn exec:java -PWS.LoanBroker
+       mvn exec:java -PWS.Client
+
+To stop the example hit <kbd>ctrl</kbd>+<kbd>c</kbd>
+
+### Documentation
+
+This example is documented at
+  <http://camel.apache.org/loan-broker-example.html>
+
+### Forum, Help, etc
+
+If you hit an problems please let us know on the Camel Forums
+       <http://camel.apache.org/discussion-forums.html>
+
+Please help us make Apache Camel better - we appreciate any feedback you may
+have.  Enjoy!

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-cxf/pom.xml 
b/examples/camel-example-loan-broker-cxf/pom.xml
new file mode 100644
index 0000000..121f97f
--- /dev/null
+++ b/examples/camel-example-loan-broker-cxf/pom.xml
@@ -0,0 +1,172 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-loan-broker-cxf</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Example :: Loan-Broker</name>
+  <description>An example that shows the EIP's loan broker demo</description>
+
+  <properties>
+    <camel.osgi.export.pkg>
+      org.apache.camel.loanbroker.*
+    </camel.osgi.export.pkg>
+    <!-- to avoid us import bunch of cxf package -->
+    <camel.osgi.dynamic>*</camel.osgi.dynamic>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cxf</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-transports-http-jetty</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+ 
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-spring</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <phase>package</phase>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>target/classes/features.xml</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
+        </configuration>
+      </plugin>
+
+      <!-- Allows the example to be run via 'mvn compile exec:java' -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <mainClass>${target.main.class}</mainClass>
+          <includePluginDependencies>false</includePluginDependencies>
+          <classpathScope>runtime</classpathScope>
+          <systemProperties>
+            <property>
+              <key>java.util.logging.config.file</key>
+              <value>logging.properties</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+     <profile>
+      <id>WS.LoanBroker</id>
+      <properties>
+        
<target.main.class>org.apache.camel.loanbroker.LoanBroker</target.main.class>
+      </properties>
+    </profile>
+    <profile>
+      <id>WS.Client</id>
+      <properties>
+        
<target.main.class>org.apache.camel.loanbroker.Client</target.main.class>
+      </properties>
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
new file mode 100644
index 0000000..f4805bc
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.loanbroker.bank.BankQuote;
+
+//START SNIPPET: aggregating
+// This POJO aggregator is supported since Camel 2.12
+public class BankResponseAggregationStrategy {
+    
+    public BankQuote aggregate(BankQuote oldQuote, BankQuote newQuote) {
+        if (oldQuote != null && oldQuote.getRate() <= newQuote.getRate()) {
+            return oldQuote;
+        } else {
+            return newQuote;
+        }
+    }
+
+}
+//END SNIPPET: aggregating

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java
new file mode 100644
index 0000000..ccaf369
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/Client.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.util.StopWatch;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+
+/**
+ * The client that will invoke the loan broker service
+ */
+//START SNIPPET: client
+public final class Client {
+    
+       //Change the port to the one on which Loan broker is listening.
+       
+    private static String url = "http://localhost:9008/loanBroker";;
+
+    private Client() {
+    }
+
+    public static LoanBrokerWS getProxy(String address) {
+        // Now we use the simple front API to create the client proxy
+        ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
+        ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
+        clientBean.setAddress(address);
+        clientBean.setServiceClass(LoanBrokerWS.class);
+        // just create a new bus for use
+        clientBean.setBus(BusFactory.newInstance().createBus());
+        return (LoanBrokerWS) proxyFactory.create();
+    }
+
+    public static void main(String[] args) {
+        LoanBrokerWS loanBroker = getProxy(url);
+
+        StopWatch watch = new StopWatch();
+        String result = loanBroker.getLoanQuote("SSN", 5000.00, 24);
+
+        System.out.println("Took " + watch.stop() + " milliseconds to call the 
loan broker service");
+        System.out.println(result);
+    }
+
+}
+//END SNIPPET: client
+

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java
new file mode 100644
index 0000000..0296357
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/CreditScoreProcessor.java
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.loanbroker.credit.CreditAgencyWS;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+
+/**
+ * Credit score processor.
+ */
+//START SNIPPET: credit
+public class CreditScoreProcessor implements Processor {
+    private String creditAgencyAddress;
+    private CreditAgencyWS proxy;
+
+    public CreditScoreProcessor(String address) {
+        creditAgencyAddress = address;
+        proxy = getProxy();
+    }
+
+    private CreditAgencyWS getProxy() {
+        // Here we use JaxWs front end to create the proxy
+        JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
+        ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
+        clientBean.setAddress(creditAgencyAddress);
+        clientBean.setServiceClass(CreditAgencyWS.class);
+        clientBean.setBus(BusFactory.getDefaultBus());
+        return (CreditAgencyWS)proxyFactory.create();
+    }
+
+    @SuppressWarnings("unchecked")
+    public void process(Exchange exchange) throws Exception {
+        List<Object> request = exchange.getIn().getBody(List.class);
+
+        String ssn = (String) request.get(0);
+        Double amount = (Double) request.get(1);
+        Integer loanDuration = (Integer) request.get(2);
+        int historyLength = proxy.getCreditHistoryLength(ssn);
+        int score = proxy.getCreditScore(ssn);
+
+        // create the invocation message for Bank client
+        List<Object> bankRequest = new ArrayList<Object>();
+        bankRequest.add(ssn);
+        bankRequest.add(amount);
+        bankRequest.add(loanDuration);
+        bankRequest.add(historyLength);
+        bankRequest.add(score);
+        exchange.getOut().setBody(bankRequest);
+        exchange.getOut().setHeader("operationName", "getQuote");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
new file mode 100644
index 0000000..b55dfd9
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.spring.Main;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Main class to run the loan broker server from command line.
+ */
+public final class LoanBroker {
+
+    private LoanBroker() {
+    }
+
+    public static void main(String... args) throws Exception {
+        // create a new main which will boot the Spring XML file
+        Main main = new Main();
+        main.setApplicationContext(new 
ClassPathXmlApplicationContext("META-INF/spring/webServiceCamelContext.xml"));
+        main.run();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java
new file mode 100644
index 0000000..3ed2e09
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/LoanBrokerWS.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+//START SNIPPET: loanBroker
+
+// This SEI has no @WebService annotation, we use the simple frontend API to 
create client and server
+public interface LoanBrokerWS {
+
+    String getLoanQuote(String ssn, Double loanAmount, Integer loanDuration);
+
+}
+//END SNIPPET: loanBroker

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
new file mode 100644
index 0000000..231f28d
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.loanbroker.bank.BankQuote;
+
+/**
+ * Processor to set the reply message for the loan broker web service
+ */
+public class ReplyProcessor implements Processor {
+    
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        BankQuote quote = exchange.getIn().getBody(BankQuote.class);
+        
+        String answer = "The best rate is " + quote.toString();
+        exchange.getOut().setBody(answer);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java
new file mode 100644
index 0000000..13151e1
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/Bank.java
@@ -0,0 +1,46 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker.bank;
+
+//START SNIPPET: bankImpl
+public class Bank implements BankWS {
+    private String bankName;
+    private double primeRate;
+
+    public Bank(String name) {
+        bankName = name;
+        primeRate = 3.5;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public BankQuote getQuote(String ssn, double loanAmount, int loanDuration, 
int creditHistory, int creditScore) {
+        Double rate = primeRate + (double)(loanDuration / 12) / 10 + 
Math.random() * 10 / 10;
+        // Wait for a while
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            // do nothing here
+        }
+        BankQuote result = new BankQuote(bankName, ssn, rate);
+        return result;
+    }
+
+}
+//END SNIPPET: bankImpl

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java
new file mode 100644
index 0000000..315d315
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankQuote.java
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker.bank;
+
+public class BankQuote {
+    private String bankName;
+    private String ssn;
+    private Double rate;
+
+    public BankQuote() {
+    }
+
+    public BankQuote(String name, String s, Double r) {
+        bankName = name;
+        ssn = s;
+        rate = r;
+    }
+
+    public void setBankName(String name) {
+        bankName = name;
+    }
+
+    public void setSsn(String s) {
+        ssn = s;
+    }
+
+    public void setRate(Double r) {
+        rate = r;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public String getSsn() {
+        return ssn;
+    }
+
+    public Double getRate() {
+        return rate;
+    }
+
+    public String toString() {
+        return "[ssn:" + ssn + " bank:" + bankName + " rate:" + rate + "]";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java
new file mode 100644
index 0000000..62ee442
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/bank/BankWS.java
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker.bank;
+
+import javax.jws.WebService;
+
+//START SNIPPET: bank
+// Since we use @WebServices here, please make sure to use JaxWs frontend API 
create the client and server
+@WebService
+public interface BankWS {
+
+    String getBankName();
+
+    BankQuote getQuote(String ssn, double loanAmount, int loanDuration, int 
creditHistory, int creditScore);
+
+}
+//END SNIPPET: bank
+

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java
new file mode 100644
index 0000000..93a531a
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgency.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker.credit;
+
+//START SNIPPET: creditAgencyImpl
+public class CreditAgency implements CreditAgencyWS {
+
+    public int getCreditHistoryLength(String ssn) {
+        int creditScore = (int)(Math.random() * 600 + 300);
+        return creditScore;
+    }
+
+    public int getCreditScore(String ssn) {
+        int creditHistoryLength = (int)(Math.random() * 19 + 1);
+        return creditHistoryLength;
+    }
+
+}
+//END SNIPPET: creditAgencyImpl

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java
 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java
new file mode 100644
index 0000000..6e7ba00
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/java/org/apache/camel/loanbroker/credit/CreditAgencyWS.java
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker.credit;
+
+import javax.jws.WebService;
+
+//START SNIPPET: creditAgency
+@WebService
+public interface CreditAgencyWS {
+
+    int getCreditScore(String ssn);
+
+    int getCreditHistoryLength(String ssn);
+
+}
+//END SNIPPET: creditAgency
+

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt
 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml
 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml
new file mode 100644
index 0000000..5e1cf06
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/META-INF/spring/webServiceCamelContext.xml
@@ -0,0 +1,108 @@
+<?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="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:camel="http://camel.apache.org/schema/spring";
+       xmlns:cxf="http://camel.apache.org/schema/cxf";
+       xmlns:jaxws="http://cxf.apache.org/jaxws";
+       xmlns:context="http://www.springframework.org/schema/context";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
+         http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+         http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
+         http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>
+
+  <!-- spring property placeholder, ignore resource not found as the file 
resource is for unit testing -->
+  <context:property-placeholder 
location="classpath:loanbroker.properties,file:target/custom.properties"
+                                ignore-resource-not-found="true"/>
+
+  <!-- web service for credit agency -->
+  <jaxws:endpoint id="creditAgent"
+                  implementor="org.apache.camel.loanbroker.credit.CreditAgency"
+                  
address="http://localhost:${credit_agency.port}/creditAgency"/>
+
+  <bean id="bank1" class="org.apache.camel.loanbroker.bank.Bank">
+    <constructor-arg index="0">
+      <value>bank1</value>
+    </constructor-arg>
+  </bean>
+
+  <bean id="bank2" class="org.apache.camel.loanbroker.bank.Bank">
+    <constructor-arg index="0">
+      <value>bank2</value>
+    </constructor-arg>
+  </bean>
+
+  <bean id="bank3" class="org.apache.camel.loanbroker.bank.Bank">
+    <constructor-arg index="0">
+      <value>bank3</value>
+    </constructor-arg>
+  </bean>
+
+  <!-- web service for the 3 banks -->
+  <jaxws:endpoint id="bankService1"
+                  implementor="#bank1"
+                  address="http://localhost:${bank1.port}/bank1"/>
+
+  <jaxws:endpoint id="bankService2"
+                  implementor="#bank2"
+                  address="http://localhost:${bank2.port}/bank2"/>
+
+  <jaxws:endpoint id="bankService3"
+                  implementor="#bank3"
+                  address="http://localhost:${bank3.port}/bank3"/>
+  
+  
+  <!-- loan broker web service -->
+  <cxf:cxfEndpoint id="loanBroker"
+                   address="http://localhost:${loan_broker.port}/loanBroker";
+                   serviceClass="org.apache.camel.loanbroker.LoanBrokerWS"/>
+
+  <!-- Camel -->
+  <camel:camelContext id="webService">
+
+    <!-- define endpoints for the banks -->
+    <camel:endpoint id="bank1WS" 
uri="cxf://http://localhost:${bank1.port}/bank1?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/>
+    <camel:endpoint id="bank2WS" 
uri="cxf://http://localhost:${bank2.port}/bank2?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/>
+    <camel:endpoint id="bank3WS" 
uri="cxf://http://localhost:${bank3.port}/bank3?serviceClass=org.apache.camel.loanbroker.bank.BankWS"/>
+
+    <camel:route id="loanBrokerRoute">
+      <camel:from uri="cxf:bean:loanBroker"/>
+      <camel:process ref="creditScoreProcessor"/>
+      <camel:multicast parallelProcessing="true" strategyRef="bankResponse">
+        <camel:to ref="bank1WS"/>
+        <camel:to ref="bank2WS"/>
+        <camel:to ref="bank3WS"/>
+      </camel:multicast>
+      <camel:process ref="replyProcessor"/>
+    </camel:route>
+  </camel:camelContext>
+
+  <!-- processor to calculate credit score -->
+  <bean id="creditScoreProcessor" 
class="org.apache.camel.loanbroker.CreditScoreProcessor">
+    <constructor-arg index="0" 
value="http://localhost:${credit_agency.port}/creditAgency"/>
+  </bean>
+  
+  <bean id="replyProcessor" 
class="org.apache.camel.loanbroker.ReplyProcessor"/>
+  
+  <!-- strategy to assemble the bank responses -->
+  <bean id="bankResponse" 
class="org.apache.camel.loanbroker.BankResponseAggregationStrategy"/>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml 
b/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml
new file mode 100644
index 0000000..ab20efa
--- /dev/null
+++ b/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml
@@ -0,0 +1,23 @@
+<?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>
+       
<repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features
+       </repository>
+
+       <feature name='camel-example-loan-broker' version='${project.version}'>
+               <feature version="${project.version}">camel</feature>
+               <feature version="${project.version}">camel-cxf</feature>
+               
<bundle>mvn:org.apache.camel/camel-example-loan-broker/${project.version}
+               </bundle>
+       </feature>
+
+</features>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/loanbroker.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/loanbroker.properties
 
b/examples/camel-example-loan-broker-cxf/src/main/resources/loanbroker.properties
new file mode 100644
index 0000000..7cc9889
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/loanbroker.properties
@@ -0,0 +1,23 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+# properties for the application
+bank1.port=9001
+bank2.port=9002
+bank3.port=9003
+credit_agency.port=9006
+loan_broker.port=9008

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties 
b/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..a937db3
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties
@@ -0,0 +1,23 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.stdout.type = Console
+appender.stdout.name = stdout
+appender.stdout.layout.type = PatternLayout
+appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.stdout.ref = stdout

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties 
b/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties
new file mode 100644
index 0000000..41f062c
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties
@@ -0,0 +1,74 @@
+#
+#
+#    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.
+#
+#
+############################################################
+#      Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+#      Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+#handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers.  For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= WARNING
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = WARNING
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java
 
b/examples/camel-example-loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java
new file mode 100644
index 0000000..d84880f
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/test/java/org/apache/camel/loanbroker/LoanBrokerWSTest.java
@@ -0,0 +1,79 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.camel.loanbroker.Client;
+import org.apache.camel.loanbroker.LoanBrokerWS;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class LoanBrokerWSTest extends CamelSpringTestSupport {
+    
+    private static String url;
+    
+    @BeforeClass
+    public static void setupFreePort() throws Exception {
+        // find a free port number, and write that in the custom.properties 
file
+        // which we will use for the unit tests, to avoid port number in use 
problems
+        int port = AvailablePortFinder.getNextAvailable(); 
+        String bank1 = "bank1.port=" + port;
+        port = AvailablePortFinder.getNextAvailable();
+        String bank2 = "bank2.port=" + port;
+        port = AvailablePortFinder.getNextAvailable();
+        String bank3 = "bank3.port=" + port;
+        port = AvailablePortFinder.getNextAvailable();
+        String credit = "credit_agency.port=" + port;
+        port = AvailablePortFinder.getNextAvailable();
+        String loan = "loan_broker.port=" + port;
+
+        File custom = new File("target/custom.properties");
+        FileOutputStream fos = new FileOutputStream(custom);
+        fos.write(bank1.getBytes());
+        fos.write("\n".getBytes());
+        fos.write(bank2.getBytes());
+        fos.write("\n".getBytes());
+        fos.write(bank3.getBytes());
+        fos.write("\n".getBytes());
+        fos.write(credit.getBytes());
+        fos.write("\n".getBytes());
+        fos.write(loan.getBytes());
+        fos.write("\n".getBytes());
+        fos.close();
+
+        url = "http://localhost:"; + port + "/loanBroker";
+    }
+
+    @Test
+    public void testInvocation() throws Exception {
+        LoanBrokerWS loanBroker = Client.getProxy(url);
+        String result = loanBroker.getLoanQuote("SSN", 1000.54, 10);
+        log.info("Result: {}", result);
+        assertTrue(result.startsWith("The best rate is [ssn:SSN bank:bank"));
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new 
ClassPathXmlApplicationContext("/META-INF/spring/webServiceCamelContext.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties 
b/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..c6d2618
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-example-loan-broker-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
+

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/README.md 
b/examples/camel-example-loan-broker-jms/README.md
new file mode 100644
index 0000000..cc0cfff
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/README.md
@@ -0,0 +1,34 @@
+# Loan Broker Example
+
+### Introduction
+This example shows how to use Camel to implement the EIP's loan broker example,
+from the EIP book 
(http://www.enterpriseintegrationpatterns.com/SystemManagementExample.html).
+
+The example uses JMS queues for exchanging messages between
+the client, credit agency, and the banks.
+
+### Build
+
+You will need to compile this example first:
+
+       mvn compile
+
+### Run
+
+       mvn exec:java -PQueue.LoanBroker
+       mvn exec:java -PQueue.Client
+
+To stop the example hit <kbd>ctrl</kbd>+<kbd>c</kbd>
+
+### Documentation
+
+This example is documented at
+  <http://camel.apache.org/loan-broker-example.html>
+
+### Forum, Help, etc
+
+If you hit an problems please let us know on the Camel Forums
+       <http://camel.apache.org/discussion-forums.html>
+
+Please help us make Apache Camel better - we appreciate any feedback you may
+have.  Enjoy!

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/pom.xml 
b/examples/camel-example-loan-broker-jms/pom.xml
new file mode 100644
index 0000000..1b694e8
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/pom.xml
@@ -0,0 +1,177 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-loan-broker-jms</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Example :: Loan-Broker :: JMS</name>
+  <description>An example that shows the EIP's loan broker demo using 
JMS</description>
+
+   <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-jms</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-broker</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-kahadb-store</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-camel</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-spring</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+    
+     <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <phase>package</phase>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>target/classes/features.xml</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>    
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
+        </configuration>
+      </plugin>
+
+      <!-- Allows the example to be run via 'mvn compile exec:java' -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <mainClass>${target.main.class}</mainClass>
+          <includePluginDependencies>false</includePluginDependencies>
+          <classpathScope>runtime</classpathScope>
+          <systemProperties>
+            <property>
+              <key>java.util.logging.config.file</key>
+              <value>logging.properties</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>Queue.LoanBroker</id>
+      <properties>
+        
<target.main.class>org.apache.camel.loanbroker.LoanBroker</target.main.class>
+      </properties>
+    </profile>
+    <profile>
+      <id>Queue.Client</id>
+      <properties>
+        
<target.main.class>org.apache.camel.loanbroker.Client</target.main.class>
+      </properties>
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
new file mode 100644
index 0000000..cf81ed6
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/BankResponseAggregationStrategy.java
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+
+//START SNIPPET: aggregation
+public class BankResponseAggregationStrategy implements AggregationStrategy {
+
+    @Override
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        // the first time we only have the new exchange
+        if (oldExchange == null) {
+            return newExchange;
+        }
+
+        Double oldQuote = 
oldExchange.getIn().getHeader(Constants.PROPERTY_RATE, Double.class);
+        Double newQuote = 
newExchange.getIn().getHeader(Constants.PROPERTY_RATE, Double.class);
+
+        // return the winner with the lowest rate
+        if (oldQuote.doubleValue() <= newQuote.doubleValue()) {
+            return oldExchange;
+        } else {
+            return newExchange;
+        }
+    }
+
+}
+// END SNIPPET: aggregation

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Client.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Client.java
 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Client.java
new file mode 100644
index 0000000..d5e066d
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Client.java
@@ -0,0 +1,46 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+//START SNIPPET: client
+public final class Client {
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+       
+       AbstractApplicationContext applicationContext = new 
ClassPathXmlApplicationContext("META-INF/spring/client.xml"); 
+        CamelContext context = applicationContext.getBean("camel", 
CamelContext.class);
+        context.start();
+
+        ProducerTemplate template = context.createProducerTemplate();
+
+        String out = template.requestBodyAndHeader("jms:queue:loan", null, 
Constants.PROPERTY_SSN, "Client-A", String.class);
+        System.out.println(out);
+
+        template.stop();
+        context.stop();
+    }
+
+}
+// END SNIPPET: client

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Constants.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Constants.java
 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Constants.java
new file mode 100644
index 0000000..6d5d46d
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/Constants.java
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+public interface Constants {
+
+    String PROPERTY_SSN = "ssn";
+    String PROPERTY_SCORE = "score";
+    String PROPERTY_HISTORYLENGTH = "hlength";
+    String PROPERTY_RATE = "rate";
+    String PROPERTY_BANK = "bank";
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/CreditAgencyProcessor.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/CreditAgencyProcessor.java
 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/CreditAgencyProcessor.java
new file mode 100644
index 0000000..a782387
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/CreditAgencyProcessor.java
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+//START SNIPPET: creditAgency
+public class CreditAgencyProcessor implements Processor {
+
+    public void process(Exchange exchange) throws Exception {
+        String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, 
String.class);
+        int score = (int) (Math.random() * 600 + 300);
+        int hlength = (int) (Math.random() * 19 + 1);
+
+        exchange.getOut().setHeader(Constants.PROPERTY_SCORE, score);
+        exchange.getOut().setHeader(Constants.PROPERTY_HISTORYLENGTH, hlength);
+        exchange.getOut().setHeader(Constants.PROPERTY_SSN, ssn);
+    }
+
+}
+//END SNIPPET: creditAgency

http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
new file mode 100644
index 0000000..a0a497b
--- /dev/null
+++ 
b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBroker.java
@@ -0,0 +1,46 @@
+/**
+ * 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.
+ */
+package org.apache.camel.loanbroker;
+
+import org.apache.camel.spring.Main;
+
+/**
+ * Main class to start the loan broker server
+ */
+public final class LoanBroker {
+
+       private LoanBroker() {
+       }
+
+       // START SNIPPET: starting
+       public static void main(String... args) throws Exception {
+
+               Main main = new Main();
+               // configure the location of the Spring XML file
+               
+               main.setApplicationContextUri("META-INF/spring/server.xml");
+
+               main.addRouteBuilder(new LoanBrokerRoute());
+
+               main.run();
+               
+               //TODO Do we need to add timer to stop after 5 mins as in the 
previous example.
+
+       }
+       // END SNIPPET: starting
+
+}

Reply via email to