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:03 UTC
[3/4] camel git commit: CAMEL-6289: Separated broker example into cxf
and jms. Thanks to Ravi Godbole for the patch.
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);
- }
-}