You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/02/08 09:41:01 UTC
[1/4] camel git commit: Fixed CS
Repository: camel
Updated Branches:
refs/heads/master 952ae9646 -> 634c4d77c
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/634c4d77
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/634c4d77
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/634c4d77
Branch: refs/heads/master
Commit: 634c4d77c3c3b536e1907f6688437cd122b83625
Parents: 054515d
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Feb 8 10:40:26 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Feb 8 10:40:53 2017 +0100
----------------------------------------------------------------------
.../camel-example-loan-broker-cxf/README.md | 2 +-
examples/camel-example-loan-broker-cxf/pom.xml | 6 +-
.../BankResponseAggregationStrategy.java | 2 +-
.../org/apache/camel/loanbroker/Client.java | 6 +-
.../camel/loanbroker/CreditScoreProcessor.java | 2 +-
.../apache/camel/loanbroker/ReplyProcessor.java | 4 +-
.../org/apache/camel/loanbroker/bank/Bank.java | 2 +-
.../camel/loanbroker/credit/CreditAgency.java | 4 +-
.../META-INF/spring/webServiceCamelContext.xml | 17 +++--
.../src/main/resources/features.xml | 42 +++++++-----
.../src/main/resources/log4j2.properties | 13 ++--
.../src/main/resources/logging.properties | 24 ++-----
.../camel/loanbroker/LoanBrokerWSTest.java | 8 +--
.../src/test/resources/log4j2.properties | 23 +++----
.../camel-example-loan-broker-jms/README.md | 2 +-
.../org/apache/camel/loanbroker/Client.java | 4 +-
.../org/apache/camel/loanbroker/LoanBroker.java | 26 +++----
.../camel/loanbroker/LoanBrokerRoute.java | 18 ++---
.../camel/loanbroker/bank/BankProcessor.java | 2 +-
.../main/resources/META-INF/spring/client.xml | 54 ++++++++-------
.../main/resources/META-INF/spring/server.xml | 72 ++++++++++----------
.../camel/loanbroker/LoanBrokerQueueTest.java | 67 +++++++++---------
.../src/test/resources/log4j2.properties | 23 +++----
.../mention/TwitterSalesforceApplication.java | 2 +
24 files changed, 209 insertions(+), 216 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index ed5366e..6ca423b 100644
--- a/examples/camel-example-loan-broker-cxf/README.md
+++ b/examples/camel-example-loan-broker-cxf/README.md
@@ -1,4 +1,4 @@
-# Loan Broker Example
+# Loan Broker Example with Apache CXF
### Introduction
This example shows how to use Camel to implement the EIP's loan broker example,
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index 121f97f..662a676 100644
--- a/examples/camel-example-loan-broker-cxf/pom.xml
+++ b/examples/camel-example-loan-broker-cxf/pom.xml
@@ -58,7 +58,7 @@
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
@@ -69,7 +69,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<!-- logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
@@ -155,7 +155,7 @@
</build>
<profiles>
- <profile>
+ <profile>
<id>WS.LoanBroker</id>
<properties>
<target.main.class>org.apache.camel.loanbroker.LoanBroker</target.main.class>
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index f4805bc..2ee0260 100644
--- 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
@@ -21,7 +21,7 @@ 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;
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index ccaf369..c760372 100644
--- 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
@@ -26,9 +26,9 @@ import org.apache.cxf.frontend.ClientProxyFactoryBean;
*/
//START SNIPPET: client
public final class Client {
-
- //Change the port to the one on which Loan broker is listening.
-
+
+ //Change the port to the one on which Loan broker is listening.
+
private static String url = "http://localhost:9008/loanBroker";
private Client() {
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index 0296357..9794cdb 100644
--- 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
@@ -46,7 +46,7 @@ public class CreditScoreProcessor implements Processor {
clientBean.setAddress(creditAgencyAddress);
clientBean.setServiceClass(CreditAgencyWS.class);
clientBean.setBus(BusFactory.getDefaultBus());
- return (CreditAgencyWS)proxyFactory.create();
+ return (CreditAgencyWS) proxyFactory.create();
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index 231f28d..e6be083 100644
--- 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
@@ -24,11 +24,11 @@ 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/634c4d77/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
index 13151e1..7c499ba 100644
--- 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
@@ -31,7 +31,7 @@ public class Bank implements BankWS {
}
public BankQuote getQuote(String ssn, double loanAmount, int loanDuration, int creditHistory, int creditScore) {
- Double rate = primeRate + (double)(loanDuration / 12) / 10 + Math.random() * 10 / 10;
+ Double rate = primeRate + (double) (loanDuration / 12) / 10 + Math.random() * 10 / 10;
// Wait for a while
try {
Thread.sleep(1000);
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index 93a531a..bedb24d 100644
--- 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
@@ -20,12 +20,12 @@ package org.apache.camel.loanbroker.credit;
public class CreditAgency implements CreditAgencyWS {
public int getCreditHistoryLength(String ssn) {
- int creditScore = (int)(Math.random() * 600 + 300);
+ int creditScore = (int) (Math.random() * 600 + 300);
return creditScore;
}
public int getCreditScore(String ssn) {
- int creditHistoryLength = (int)(Math.random() * 19 + 1);
+ int creditHistoryLength = (int) (Math.random() * 19 + 1);
return creditHistoryLength;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index 5e1cf06..5373601 100644
--- 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
@@ -68,8 +68,8 @@
<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"
@@ -79,9 +79,12 @@
<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: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"/>
@@ -99,9 +102,9 @@
<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"/>
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index ab20efa..79ffc67 100644
--- a/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml
+++ b/examples/camel-example-loan-broker-cxf/src/main/resources/features.xml
@@ -1,23 +1,29 @@
<?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. -->
+<!--
+ 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>
+ <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>
+ <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/634c4d77/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
index a937db3..f9a4829 100644
--- a/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties
+++ b/examples/camel-example-loan-broker-cxf/src/main/resources/log4j2.properties
@@ -14,10 +14,9 @@
## 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
+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/634c4d77/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
index 41f062c..12bd10e 100644
--- a/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties
+++ b/examples/camel-example-loan-broker-cxf/src/main/resources/logging.properties
@@ -25,50 +25,40 @@
# 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
-
+.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
-
+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
-
-
+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/634c4d77/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
index d84880f..906116b 100644
--- 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
@@ -19,8 +19,6 @@ 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;
@@ -29,14 +27,14 @@ 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();
+ int port = AvailablePortFinder.getNextAvailable();
String bank1 = "bank1.port=" + port;
port = AvailablePortFinder.getNextAvailable();
String bank2 = "bank2.port=" + port;
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index c6d2618..83758d9 100644
--- a/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties
+++ b/examples/camel-example-loan-broker-cxf/src/test/resources/log4j2.properties
@@ -14,16 +14,15 @@
# 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
+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/634c4d77/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
index cc0cfff..8588af2 100644
--- a/examples/camel-example-loan-broker-jms/README.md
+++ b/examples/camel-example-loan-broker-jms/README.md
@@ -1,4 +1,4 @@
-# Loan Broker Example
+# Loan Broker Example with JMS
### Introduction
This example shows how to use Camel to implement the EIP's loan broker example,
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index d5e066d..2aad6cf 100644
--- 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
@@ -28,8 +28,8 @@ public final class Client {
}
public static void main(String args[]) throws Exception {
-
- AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/client.xml");
+
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/client.xml");
CamelContext context = applicationContext.getBean("camel", CamelContext.class);
context.start();
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/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
index a0a497b..560745e 100644
--- 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
@@ -23,24 +23,20 @@ import org.apache.camel.spring.Main;
*/
public final class LoanBroker {
- private LoanBroker() {
- }
+ private LoanBroker() {
+ }
- // START SNIPPET: starting
- public static void main(String... args) throws Exception {
+ // 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 main = new Main();
+ // configure the location of the Spring XML file
- main.addRouteBuilder(new LoanBrokerRoute());
+ 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
+ main.run();
+ }
+ // END SNIPPET: starting
}
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
index 479df79..1da7a88 100644
--- a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
+++ b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
@@ -30,14 +30,14 @@ public class LoanBrokerRoute extends RouteBuilder {
public void configure() {
// START SNIPPET: dsl-2
from("jms:queue:loan")
- // let the credit agency do the first work
- .process(new CreditAgencyProcessor())
- // send the request to the three banks
- .multicast(new BankResponseAggregationStrategy()).parallelProcessing()
- .to("jms:queue:bank1", "jms:queue:bank2", "jms:queue:bank3")
- .end()
- // and prepare the reply message
- .process(new ReplyProcessor());
+ // let the credit agency do the first work
+ .process(new CreditAgencyProcessor())
+ // send the request to the three banks
+ .multicast(new BankResponseAggregationStrategy()).parallelProcessing()
+ .to("jms:queue:bank1", "jms:queue:bank2", "jms:queue:bank3")
+ .end()
+ // and prepare the reply message
+ .process(new ReplyProcessor());
// Each bank processor will process the message and put the response message back
from("jms:queue:bank1").process(new BankProcessor("bank1"));
@@ -45,5 +45,5 @@ public class LoanBrokerRoute extends RouteBuilder {
from("jms:queue:bank3").process(new BankProcessor("bank3"));
// END SNIPPET: dsl-2
}
-
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
index 9b142f3..5bdeb5d 100644
--- a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
+++ b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
@@ -33,7 +33,7 @@ public class BankProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, String.class);
Integer historyLength = exchange.getIn().getHeader(Constants.PROPERTY_HISTORYLENGTH, Integer.class);
- double rate = primeRate + (double)(historyLength / 12) / 10 + (Math.random() * 10) / 10;
+ double rate = primeRate + (double) (historyLength / 12) / 10 + (Math.random() * 10) / 10;
// set reply details as headers
exchange.getOut().setHeader(Constants.PROPERTY_BANK, bankName);
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
index f85bbf7..2d86378 100644
--- a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
+++ b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
@@ -1,34 +1,36 @@
<?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. -->
+<!--
+ 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:u="http://www.springframework.org/schema/util"
- xmlns:broker="http://activemq.apache.org/schema/core"
- xsi:schemaLocation="
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
- http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
-
- <!-- create a CamelContext -->
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" />
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
- <property name="connectionFactory">
- <bean class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL" value="tcp://localhost:51616" />
- </bean>
- </property>
- </bean>
+ <!-- create a CamelContext -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"/>
+ <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+ <property name="connectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:51616"/>
+ </bean>
+ </property>
+ </bean>
</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
index 3d3e072..c46f2b3 100644
--- a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
+++ b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
@@ -1,45 +1,47 @@
<?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. -->
+<!--
+ 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:u="http://www.springframework.org/schema/util"
- xmlns:broker="http://activemq.apache.org/schema/core"
- xsi:schemaLocation="
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:broker="http://activemq.apache.org/schema/core"
+ xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
- <!-- create a CamelContext -->
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" />
-
-
- <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
- <property name="connectionFactory">
- <bean class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL" value="vm://myBroker?broker.persistent=false&broker.useJmx=false"/>
- </bean>
- </property>
- </bean>
+ <!-- create a CamelContext -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"/>
- <!-- lets configure the ActiveMQ JMS broker server -->
- <broker:broker useJmx="true" persistent="false" brokerName="myBroker">
- <broker:transportConnectors>
- <!-- expose a VM transport for in-JVM transport between AMQ and Camel on the server side -->
- <broker:transportConnector name="vm" uri="vm://myBroker"/>
- <!-- expose a TCP transport for clients to use -->
- <broker:transportConnector name="tcp" uri="tcp://localhost:51616"/>
- </broker:transportConnectors>
- </broker:broker>
+ <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+ <property name="connectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="vm://myBroker?broker.persistent=false&broker.useJmx=false"/>
+ </bean>
+ </property>
+ </bean>
+ <!-- lets configure the ActiveMQ JMS broker server -->
+ <broker:broker useJmx="true" persistent="false" brokerName="myBroker">
+ <broker:transportConnectors>
+ <!-- expose a VM transport for in-JVM transport between AMQ and Camel on the server side -->
+ <broker:transportConnector name="vm" uri="vm://myBroker"/>
+ <!-- expose a TCP transport for clients to use -->
+ <broker:transportConnector name="tcp" uri="tcp://localhost:51616"/>
+ </broker:transportConnectors>
+ </broker:broker>
</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java b/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
index 7691e55..6fefaf8 100644
--- a/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
+++ b/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
@@ -18,8 +18,6 @@ package org.apache.camel.loanbroker;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
-import org.apache.camel.loanbroker.Constants;
-import org.apache.camel.loanbroker.LoanBrokerRoute;
import org.apache.camel.test.junit4.TestSupport;
import org.junit.After;
import org.junit.Before;
@@ -28,38 +26,37 @@ import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class LoanBrokerQueueTest extends TestSupport {
- private AbstractApplicationContext applicationContext;
- protected CamelContext camelContext;
- protected ProducerTemplate template;
-
- @Before
- public void startServices() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/server.xml");
- camelContext = getCamelContext();
- camelContext.addRoutes(new LoanBrokerRoute());
- template = camelContext.createProducerTemplate();
- camelContext.start();
- }
-
- @After
- public void stopServices() throws Exception {
- if (camelContext != null) {
- camelContext.stop();
- }
- }
-
- @Test
- public void testClientInvocation() throws Exception {
- String out = template.requestBodyAndHeader("jms:queue:loan", null, Constants.PROPERTY_SSN, "Client-A",
- String.class);
-
- log.info("Result: {}", out);
- assertNotNull(out);
- assertTrue(out.startsWith("The best rate is [ssn:Client-A bank:bank"));
- }
-
- protected CamelContext getCamelContext() throws Exception {
- return applicationContext.getBean("camel", CamelContext.class);
- }
+ private AbstractApplicationContext applicationContext;
+ private CamelContext camelContext;
+ private ProducerTemplate template;
+
+ @Before
+ public void startServices() throws Exception {
+ applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/server.xml");
+ camelContext = getCamelContext();
+ camelContext.addRoutes(new LoanBrokerRoute());
+ template = camelContext.createProducerTemplate();
+ camelContext.start();
+ }
+
+ @After
+ public void stopServices() throws Exception {
+ if (camelContext != null) {
+ camelContext.stop();
+ }
+ }
+
+ @Test
+ public void testClientInvocation() throws Exception {
+ String out = template.requestBodyAndHeader("jms:queue:loan", null, Constants.PROPERTY_SSN, "Client-A", String.class);
+
+ log.info("Result: {}", out);
+ assertNotNull(out);
+ assertTrue(out.startsWith("The best rate is [ssn:Client-A bank:bank"));
+ }
+
+ protected CamelContext getCamelContext() throws Exception {
+ return applicationContext.getBean("camel", CamelContext.class);
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/634c4d77/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties b/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
index c6d2618..83758d9 100644
--- a/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
+++ b/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
@@ -14,16 +14,15 @@
# 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
+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/634c4d77/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceApplication.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceApplication.java b/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceApplication.java
index b2f60c8..3ea6044 100644
--- a/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceApplication.java
+++ b/examples/camel-example-twitter-salesforce/src/main/java/org/apache/camel/example/mention/TwitterSalesforceApplication.java
@@ -19,6 +19,7 @@ package org.apache.camel.example.mention;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+//CHECKSTYLE:OFF
@SpringBootApplication
public class TwitterSalesforceApplication {
@@ -30,3 +31,4 @@ public class TwitterSalesforceApplication {
}
}
+//CHECKSTYLE:ON
[3/4] camel git commit: CAMEL-6289: Separated broker example into cxf
and jms. Thanks to Ravi Godbole for the patch.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
new file mode 100644
index 0000000..479df79
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/LoanBrokerRoute.java
@@ -0,0 +1,49 @@
+/**
+ * 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.builder.RouteBuilder;
+import org.apache.camel.loanbroker.bank.BankProcessor;
+
+/**
+ * The route for the loan broker example.
+ */
+public class LoanBrokerRoute extends RouteBuilder {
+
+ /**
+ * Let's configure the Camel routing rules using Java code...
+ */
+ public void configure() {
+ // START SNIPPET: dsl-2
+ from("jms:queue:loan")
+ // let the credit agency do the first work
+ .process(new CreditAgencyProcessor())
+ // send the request to the three banks
+ .multicast(new BankResponseAggregationStrategy()).parallelProcessing()
+ .to("jms:queue:bank1", "jms:queue:bank2", "jms:queue:bank3")
+ .end()
+ // and prepare the reply message
+ .process(new ReplyProcessor());
+
+ // Each bank processor will process the message and put the response message back
+ from("jms:queue:bank1").process(new BankProcessor("bank1"));
+ from("jms:queue:bank2").process(new BankProcessor("bank2"));
+ from("jms:queue:bank3").process(new BankProcessor("bank3"));
+ // END SNIPPET: dsl-2
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.java
new file mode 100644
index 0000000..ea3af1c
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/ReplyProcessor.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: translator
+public class ReplyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String bankName = exchange.getIn().getHeader(Constants.PROPERTY_BANK, String.class);
+ String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, String.class);
+ Double rate = exchange.getIn().getHeader(Constants.PROPERTY_RATE, Double.class);
+
+ String answer = "The best rate is [ssn:" + ssn + " bank:" + bankName + " rate:" + rate + "]";
+ exchange.getOut().setBody(answer);
+ }
+
+}
+//END SNIPPET: translator
+
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
new file mode 100644
index 0000000..9b142f3
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/java/org/apache/camel/loanbroker/bank/BankProcessor.java
@@ -0,0 +1,45 @@
+/**
+ * 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 org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.loanbroker.Constants;
+
+//START SNIPPET: bank
+public class BankProcessor implements Processor {
+ private final String bankName;
+ private final double primeRate;
+
+ public BankProcessor(String name) {
+ bankName = name;
+ primeRate = 3.5;
+ }
+
+ public void process(Exchange exchange) throws Exception {
+ String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, String.class);
+ Integer historyLength = exchange.getIn().getHeader(Constants.PROPERTY_HISTORYLENGTH, Integer.class);
+ double rate = primeRate + (double)(historyLength / 12) / 10 + (Math.random() * 10) / 10;
+
+ // set reply details as headers
+ exchange.getOut().setHeader(Constants.PROPERTY_BANK, bankName);
+ exchange.getOut().setHeader(Constants.PROPERTY_SSN, ssn);
+ exchange.getOut().setHeader(Constants.PROPERTY_RATE, rate);
+ }
+
+}
+//END SNIPPET: bank
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/LICENSE.txt b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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-jms/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/NOTICE.txt b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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-jms/src/main/resources/META-INF/spring/client.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
new file mode 100644
index 0000000..f85bbf7
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/client.xml
@@ -0,0 +1,34 @@
+<?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:u="http://www.springframework.org/schema/util"
+ xmlns:broker="http://activemq.apache.org/schema/core"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+ <!-- create a CamelContext -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" />
+
+ <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+ <property name="connectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:51616" />
+ </bean>
+ </property>
+ </bean>
+
+
+</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
new file mode 100644
index 0000000..3d3e072
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/resources/META-INF/spring/server.xml
@@ -0,0 +1,45 @@
+<?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:u="http://www.springframework.org/schema/util"
+ xmlns:broker="http://activemq.apache.org/schema/core"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+ <!-- create a CamelContext -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" />
+
+
+ <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+ <property name="connectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="vm://myBroker?broker.persistent=false&broker.useJmx=false"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- lets configure the ActiveMQ JMS broker server -->
+ <broker:broker useJmx="true" persistent="false" brokerName="myBroker">
+ <broker:transportConnectors>
+ <!-- expose a VM transport for in-JVM transport between AMQ and Camel on the server side -->
+ <broker:transportConnector name="vm" uri="vm://myBroker"/>
+ <!-- expose a TCP transport for clients to use -->
+ <broker:transportConnector name="tcp" uri="tcp://localhost:51616"/>
+ </broker:transportConnectors>
+ </broker:broker>
+
+
+</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/features.xml b/examples/camel-example-loan-broker-jms/src/main/resources/features.xml
new file mode 100644
index 0000000..16f3efe
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/main/resources/features.xml
@@ -0,0 +1,41 @@
+<?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='activemq-feature' version='${project.version}'>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1</bundle>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0</bundle>
+ <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool/1.5.4_1</bundle>
+ <bundle>mvn:org.apache.xbean/xbean-spring/3.4.3</bundle>
+ <bundle>mvn:org.apache.activemq/kahadb/${activemq-version}</bundle>
+ <bundle>mvn:org.apache.activemq/activemq-core/${activemq-version}</bundle>
+ <bundle>mvn:org.apache.activemq/activemq-ra/${activemq-version}</bundle>
+ <bundle>mvn:org.apache.activemq/activemq-pool/${activemq-version}</bundle>
+ <bundle>mvn:org.apache.activemq/activemq-camel/${activemq-version}</bundle>
+ </feature>
+
+ <feature name='camel-example-loan-broker' version='${project.version}'>
+ <feature version="${project.version}">camel</feature>
+ <feature version="${project.version}">camel-jms</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-jms/src/main/resources/loanbroker.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/loanbroker.properties b/examples/camel-example-loan-broker-jms/src/main/resources/loanbroker.properties
new file mode 100644
index 0000000..7cc9889
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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-jms/src/main/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/log4j2.properties b/examples/camel-example-loan-broker-jms/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..a937db3
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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-jms/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/main/resources/logging.properties b/examples/camel-example-loan-broker-jms/src/main/resources/logging.properties
new file mode 100644
index 0000000..41f062c
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java b/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
new file mode 100644
index 0000000..7691e55
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/src/test/java/org/apache/camel/loanbroker/LoanBrokerQueueTest.java
@@ -0,0 +1,65 @@
+/**
+ * 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.apache.camel.loanbroker.Constants;
+import org.apache.camel.loanbroker.LoanBrokerRoute;
+import org.apache.camel.test.junit4.TestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class LoanBrokerQueueTest extends TestSupport {
+ private AbstractApplicationContext applicationContext;
+ protected CamelContext camelContext;
+ protected ProducerTemplate template;
+
+ @Before
+ public void startServices() throws Exception {
+ applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/server.xml");
+ camelContext = getCamelContext();
+ camelContext.addRoutes(new LoanBrokerRoute());
+ template = camelContext.createProducerTemplate();
+ camelContext.start();
+ }
+
+ @After
+ public void stopServices() throws Exception {
+ if (camelContext != null) {
+ camelContext.stop();
+ }
+ }
+
+ @Test
+ public void testClientInvocation() throws Exception {
+ String out = template.requestBodyAndHeader("jms:queue:loan", null, Constants.PROPERTY_SSN, "Client-A",
+ String.class);
+
+ log.info("Result: {}", out);
+ assertNotNull(out);
+ assertTrue(out.startsWith("The best rate is [ssn:Client-A bank:bank"));
+ }
+
+ protected CamelContext getCamelContext() throws Exception {
+ return applicationContext.getBean("camel", CamelContext.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties b/examples/camel-example-loan-broker-jms/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..c6d2618
--- /dev/null
+++ b/examples/camel-example-loan-broker-jms/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/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/README.md b/examples/camel-example-loan-broker/README.md
deleted file mode 100644
index 9be9e2f..0000000
--- a/examples/camel-example-loan-broker/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# 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 has two versions (JMS queues, and web services),
-that uses a different transport for exchanging messages between
-the client, credit agency, and the banks.
-
-### Build
-
-You will need to compile this example first:
-
- mvn compile
-
-### Run
-
-The example of JMS queue version should run if you type
-
- mvn exec:java -PQueue.LoanBroker
- mvn exec:java -PQueue.Client
-
-The example of web services version
-
- 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/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/pom.xml b/examples/camel-example-loan-broker/pom.xml
deleted file mode 100644
index b1cd270..0000000
--- a/examples/camel-example-loan-broker/pom.xml
+++ /dev/null
@@ -1,210 +0,0 @@
-<?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</artifactId>
- <packaging>jar</packaging>
- <name>Camel :: Example :: Loan-Broker</name>
- <description>An example that shows the EPI's loan broker demo</description>
-
- <properties>
- <camel.osgi.export.pkg>
- org.apache.camel.loanbroker.*
- </camel.osgi.export.pkg>
- <camel.osgi.import.additional>
- org.apache.activemq.xbean,org.apache.activemq.broker,org.apache.activemq.pool
- </camel.osgi.import.additional>
- <!-- 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.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.queue.version.LoanBroker</target.main.class>
- </properties>
- </profile>
- <profile>
- <id>Queue.Client</id>
- <properties>
- <target.main.class>org.apache.camel.loanbroker.queue.version.Client</target.main.class>
- </properties>
- </profile>
- <profile>
- <id>WS.LoanBroker</id>
- <properties>
- <target.main.class>org.apache.camel.loanbroker.webservice.version.LoanBroker</target.main.class>
- </properties>
- </profile>
- <profile>
- <id>WS.Client</id>
- <properties>
- <target.main.class>org.apache.camel.loanbroker.webservice.version.Client</target.main.class>
- </properties>
- </profile>
- </profiles>
-
-</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
deleted file mode 100644
index 657de5c..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.queue.version;
-
-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/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java
deleted file mode 100644
index 04ba52f..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.queue.version;
-
-import javax.jms.ConnectionFactory;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.DefaultCamelContext;
-
-//START SNIPPET: client
-public final class Client {
-
- private Client() {
- }
-
- public static void main(String args[]) throws Exception {
- CamelContext context = new DefaultCamelContext();
- // Set up the ActiveMQ JMS Components
- ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:51616");
- // Note we can explicit name of the component
- context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
- 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/src/main/java/org/apache/camel/loanbroker/queue/version/Constants.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Constants.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Constants.java
deleted file mode 100644
index 621f6d6..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Constants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.queue.version;
-
-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/src/main/java/org/apache/camel/loanbroker/queue/version/CreditAgencyProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/CreditAgencyProcessor.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/CreditAgencyProcessor.java
deleted file mode 100644
index 5abaa6e..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/CreditAgencyProcessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.queue.version;
-
-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/src/main/java/org/apache/camel/loanbroker/queue/version/JmsBroker.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/JmsBroker.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/JmsBroker.java
deleted file mode 100644
index 5bf4e20..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/JmsBroker.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * 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.queue.version;
-
-import java.io.File;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
-
-/**
- * Embedded JMS broker
- */
-public final class JmsBroker {
- private JMSEmbeddedBroker jmsBrokerThread;
- private String jmsBrokerUrl = "tcp://localhost:51616";
-
- public JmsBroker() {
- }
-
- public JmsBroker(String url) {
- jmsBrokerUrl = url;
- }
-
- public void start() throws Exception {
- jmsBrokerThread = new JMSEmbeddedBroker(jmsBrokerUrl);
- jmsBrokerThread.startBroker();
- }
-
- public void stop() throws Exception {
- synchronized (this) {
- jmsBrokerThread.shutdownBroker = true;
- }
- jmsBrokerThread.join();
- jmsBrokerThread = null;
- }
-
- class JMSEmbeddedBroker extends Thread {
- boolean shutdownBroker;
- final String brokerUrl;
- Exception exception;
-
- JMSEmbeddedBroker(String url) {
- brokerUrl = url;
- }
-
- public void startBroker() throws Exception {
- synchronized (this) {
- super.start();
- try {
- wait();
- if (exception != null) {
- throw exception;
- }
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- }
- }
-
- public void run() {
- try {
- BrokerService broker = new BrokerService();
- synchronized (this) {
- broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
- broker.setTmpDataDirectory(new File(System.getProperty("broker.tmp.datadir", "./target/broker-tmp")));
- broker.addConnector(brokerUrl);
- broker.start();
- Thread.sleep(200);
- notifyAll();
- }
- synchronized (this) {
- while (!shutdownBroker) {
- wait(1000);
- }
- }
- broker.stop();
- } catch (Exception e) {
- exception = e;
- e.printStackTrace();
- }
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java
deleted file mode 100644
index fcbb4ed..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.queue.version;
-
-import javax.jms.ConnectionFactory;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.DefaultCamelContext;
-
-/**
- * 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 {
- // setup an embedded JMS broker
- JmsBroker broker = new JmsBroker();
- broker.start();
-
- // create a camel context
- CamelContext context = new DefaultCamelContext();
-
- // Set up the ActiveMQ JMS Components
- ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:51616");
- // Note we can explicitly name the component
- context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
-
- // add the route
- context.addRoutes(new LoanBrokerRoute());
-
- // start Camel
- context.start();
- System.out.println("Server is ready");
-
- // let it run for 5 minutes before shutting down
- Thread.sleep(5 * 60 * 1000);
- context.stop();
- Thread.sleep(1000);
- broker.stop();
- }
- // END SNIPPET: starting
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBrokerRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBrokerRoute.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBrokerRoute.java
deleted file mode 100644
index 297a69c..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBrokerRoute.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.queue.version;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.loanbroker.queue.version.bank.BankProcessor;
-
-/**
- * The route for the loan broker example.
- */
-public class LoanBrokerRoute extends RouteBuilder {
-
- /**
- * Let's configure the Camel routing rules using Java code...
- */
- public void configure() {
- // START SNIPPET: dsl-2
- from("jms:queue:loan")
- // let the credit agency do the first work
- .process(new CreditAgencyProcessor())
- // send the request to the three banks
- .multicast(new BankResponseAggregationStrategy()).parallelProcessing()
- .to("jms:queue:bank1", "jms:queue:bank2", "jms:queue:bank3")
- .end()
- // and prepare the reply message
- .process(new ReplyProcessor());
-
- // Each bank processor will process the message and put the response message back
- from("jms:queue:bank1").process(new BankProcessor("bank1"));
- from("jms:queue:bank2").process(new BankProcessor("bank2"));
- from("jms:queue:bank3").process(new BankProcessor("bank3"));
- // END SNIPPET: dsl-2
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/ReplyProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/ReplyProcessor.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/ReplyProcessor.java
deleted file mode 100644
index 6bb9553..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/ReplyProcessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.queue.version;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-
-//START SNIPPET: translator
-public class ReplyProcessor implements Processor {
-
- public void process(Exchange exchange) throws Exception {
- String bankName = exchange.getIn().getHeader(Constants.PROPERTY_BANK, String.class);
- String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, String.class);
- Double rate = exchange.getIn().getHeader(Constants.PROPERTY_RATE, Double.class);
-
- String answer = "The best rate is [ssn:" + ssn + " bank:" + bankName + " rate:" + rate + "]";
- exchange.getOut().setBody(answer);
- }
-
-}
-//END SNIPPET: translator
-
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/bank/BankProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/bank/BankProcessor.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/bank/BankProcessor.java
deleted file mode 100644
index e0ba9be..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/bank/BankProcessor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.queue.version.bank;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.loanbroker.queue.version.Constants;
-
-//START SNIPPET: bank
-public class BankProcessor implements Processor {
- private final String bankName;
- private final double primeRate;
-
- public BankProcessor(String name) {
- bankName = name;
- primeRate = 3.5;
- }
-
- public void process(Exchange exchange) throws Exception {
- String ssn = exchange.getIn().getHeader(Constants.PROPERTY_SSN, String.class);
- Integer historyLength = exchange.getIn().getHeader(Constants.PROPERTY_HISTORYLENGTH, Integer.class);
- double rate = primeRate + (double)(historyLength / 12) / 10 + (Math.random() * 10) / 10;
-
- // set reply details as headers
- exchange.getOut().setHeader(Constants.PROPERTY_BANK, bankName);
- exchange.getOut().setHeader(Constants.PROPERTY_SSN, ssn);
- exchange.getOut().setHeader(Constants.PROPERTY_RATE, rate);
- }
-
-}
-//END SNIPPET: bank
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/BankResponseAggregationStrategy.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/BankResponseAggregationStrategy.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/BankResponseAggregationStrategy.java
deleted file mode 100644
index 848b5db..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/BankResponseAggregationStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.webservice.version;
-
-import org.apache.camel.loanbroker.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
deleted file mode 100644
index cc5a262..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/Client.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.webservice.version;
-
-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 {
-
- 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/src/main/java/org/apache/camel/loanbroker/webservice/version/CreditScoreProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/CreditScoreProcessor.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/CreditScoreProcessor.java
deleted file mode 100644
index 0dbe7a2..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/CreditScoreProcessor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.webservice.version;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.loanbroker.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java
deleted file mode 100644
index ac2cfd8..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.webservice.version;
-
-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/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWS.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWS.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWS.java
deleted file mode 100644
index 7a1bcec..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWS.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.webservice.version;
-
-//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/src/main/java/org/apache/camel/loanbroker/webservice/version/ReplyProcessor.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/ReplyProcessor.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/ReplyProcessor.java
deleted file mode 100644
index 1af3837..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/ReplyProcessor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.webservice.version;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.loanbroker.webservice.version.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);
- }
-}
[4/4] camel git commit: CAMEL-6289: Separated broker example into cxf
and jms. Thanks to Ravi Godbole for the patch.
Posted by da...@apache.org.
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 <da...@apache.org>
Authored: Wed Feb 8 10:27:22 2017 +0100
Committer: Claus Ibsen <da...@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
+
+}
[2/4] camel git commit: CAMEL-6289: Separated broker example into cxf
and jms. Thanks to Ravi Godbole for the patch.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/Bank.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/Bank.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/Bank.java
deleted file mode 100644
index 270a570..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/Bank.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankQuote.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankQuote.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankQuote.java
deleted file mode 100644
index c6bc963..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankQuote.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankWS.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankWS.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankWS.java
deleted file mode 100644
index e1057ce..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/bank/BankWS.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgency.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgency.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgency.java
deleted file mode 100644
index 01ab72c..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgency.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.webservice.version.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/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgencyWS.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgencyWS.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgencyWS.java
deleted file mode 100644
index f791c04..0000000
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/credit/CreditAgencyWS.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.webservice.version.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/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/META-INF/LICENSE.txt b/examples/camel-example-loan-broker/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- 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/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/META-INF/NOTICE.txt b/examples/camel-example-loan-broker/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == 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/src/main/resources/META-INF/spring/webServiceCamelContext.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/webServiceCamelContext.xml b/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/webServiceCamelContext.xml
deleted file mode 100644
index b083c5e..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/webServiceCamelContext.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?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.webservice.version.credit.CreditAgency"
- address="http://localhost:${credit_agency.port}/creditAgency"/>
-
- <bean id="bank1" class="org.apache.camel.loanbroker.webservice.version.bank.Bank">
- <constructor-arg index="0">
- <value>bank1</value>
- </constructor-arg>
- </bean>
-
- <bean id="bank2" class="org.apache.camel.loanbroker.webservice.version.bank.Bank">
- <constructor-arg index="0">
- <value>bank2</value>
- </constructor-arg>
- </bean>
-
- <bean id="bank3" class="org.apache.camel.loanbroker.webservice.version.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.webservice.version.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.webservice.version.bank.BankWS"/>
- <camel:endpoint id="bank2WS" uri="cxf://http://localhost:${bank2.port}/bank2?serviceClass=org.apache.camel.loanbroker.webservice.version.bank.BankWS"/>
- <camel:endpoint id="bank3WS" uri="cxf://http://localhost:${bank3.port}/bank3?serviceClass=org.apache.camel.loanbroker.webservice.version.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.webservice.version.CreditScoreProcessor">
- <constructor-arg index="0" value="http://localhost:${credit_agency.port}/creditAgency"/>
- </bean>
-
- <bean id="replyProcessor" class="org.apache.camel.loanbroker.webservice.version.ReplyProcessor"/>
-
- <!-- strategy to assemble the bank responses -->
- <bean id="bankResponse" class="org.apache.camel.loanbroker.webservice.version.BankResponseAggregationStrategy"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/features.xml b/examples/camel-example-loan-broker/src/main/resources/features.xml
deleted file mode 100644
index 37f9d23..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/features.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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='activemq-feature' version='${project.version}'>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1</bundle>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0</bundle>
- <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool/1.5.4_1</bundle>
- <bundle>mvn:org.apache.xbean/xbean-spring/3.4.3</bundle>
- <bundle>mvn:org.apache.activemq/kahadb/${activemq-version}</bundle>
- <bundle>mvn:org.apache.activemq/activemq-core/${activemq-version}</bundle>
- <bundle>mvn:org.apache.activemq/activemq-ra/${activemq-version}</bundle>
- <bundle>mvn:org.apache.activemq/activemq-pool/${activemq-version}</bundle>
- <bundle>mvn:org.apache.activemq/activemq-camel/${activemq-version}</bundle>
- </feature>
-
- <feature name='camel-example-loan-broker' version='${project.version}'>
- <feature version="${project.version}">camel</feature>
- <feature version="${project.version}">camel-jms</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/src/main/resources/loanbroker.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/loanbroker.properties b/examples/camel-example-loan-broker/src/main/resources/loanbroker.properties
deleted file mode 100644
index 7cc9889..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/loanbroker.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-## ------------------------------------------------------------------------
-## 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/src/main/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/log4j2.properties b/examples/camel-example-loan-broker/src/main/resources/log4j2.properties
deleted file mode 100644
index a937db3..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/log4j2.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/main/resources/logging.properties b/examples/camel-example-loan-broker/src/main/resources/logging.properties
deleted file mode 100644
index 41f062c..0000000
--- a/examples/camel-example-loan-broker/src/main/resources/logging.properties
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-#
-# 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/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerQueueTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerQueueTest.java b/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerQueueTest.java
deleted file mode 100644
index 7409a5a..0000000
--- a/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/queue/version/LoanBrokerQueueTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.queue.version;
-
-import javax.jms.ConnectionFactory;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.test.junit4.TestSupport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoanBrokerQueueTest extends TestSupport {
- protected CamelContext camelContext;
- protected JmsBroker broker;
- protected ProducerTemplate template;
-
- @Before
- public void startServices() throws Exception {
- deleteDirectory("activemq-data");
-
- camelContext = new DefaultCamelContext();
- broker = new JmsBroker("vm://localhost");
- broker.start();
-
- // Set up the ActiveMQ JMS Components
- ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost");
-
- // Note we can explicitly name the component
- camelContext.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
-
- camelContext.addRoutes(new LoanBrokerRoute());
-
- template = camelContext.createProducerTemplate();
- camelContext.start();
- }
-
- @After
- public void stopServices() throws Exception {
- if (camelContext != null) {
- camelContext.stop();
- }
-
- Thread.sleep(1000);
- if (broker != null) {
- broker.stop();
- }
- }
-
- @Test
- public void testClientInvocation() throws Exception {
- String out = template.requestBodyAndHeader("jms:queue:loan", null, Constants.PROPERTY_SSN, "Client-A", String.class);
-
- log.info("Result: {}", out);
- assertNotNull(out);
- assertTrue(out.startsWith("The best rate is [ssn:Client-A bank:bank"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/054515d2/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWSTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWSTest.java b/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWSTest.java
deleted file mode 100644
index 6a86678..0000000
--- a/examples/camel-example-loan-broker/src/test/java/org/apache/camel/loanbroker/webservice/version/LoanBrokerWSTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.webservice.version;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-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/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-loan-broker/src/test/resources/log4j2.properties b/examples/camel-example-loan-broker/src/test/resources/log4j2.properties
deleted file mode 100644
index c6d2618..0000000
--- a/examples/camel-example-loan-broker/src/test/resources/log4j2.properties
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index f8223dd..492b2b2 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -63,7 +63,8 @@
<module>camel-example-jmx</module>
<module>camel-example-jms-file</module>
<module>camel-example-loadbalancing</module>
- <module>camel-example-loan-broker</module>
+ <module>camel-example-loan-broker-cxf</module>
+ <module>camel-example-loan-broker-jms</module>
<module>camel-example-management</module>
<module>camel-example-mybatis</module>
<module>camel-example-netty-http</module>