Author: cmoulliard Date: Fri Apr 23 08:51:01 2010 New Revision: 937195 URL: http://svn.apache.org/viewvc?rev=937195&view=rev Log: CAMEL-2670 : Add a new example : loadbalancing with apache camel-mina (no CORBA/RMI is required to wire ojects)
Added: camel/trunk/examples/camel-example-loadbalancing-mina/ camel/trunk/examples/camel-example-loadbalancing-mina/README.txt (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina1/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/java/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina2/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/java/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml (with props) camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties (with props) Added: camel/trunk/examples/camel-example-loadbalancing-mina/README.txt URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/README.txt?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/README.txt (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/README.txt Fri Apr 23 08:51:01 2010 @@ -0,0 +1,172 @@ +Loadbalancing with MINA Example +=============================== + +This example show how you can easily use the camel-mina component to design a solution allowing to distribute message +workload on several servers. Those servers are simple TCP/IP servers created by the Apache MINA framework and running in +separate Java Virtual Machine. The loadbalancer pattern of Camel which is used top of them allows to send in a Round Robin model +mode the messages created from a camel-bean component respectively to each server running on localhost:9999 and localhost:9998. +MINA has been configured to send over the wire objects serialized and this is what is showed also in this example. +The advantage of this apporach is that you don't need to use CORBA or Java RMI for the communication between the different jvm. +The example has been configured to use InOut EIP pattern. + +The demo starts when every one minute, a Report object is created from the camel loadbalancer server. This object is send by the +camel loadbalancer to a MINA server and object is serialized. One of the two MINA servers (localhost:9999 and localhost:9998) receives +the object and enrich it by setting the field reply of the Report object. The reply is send back by the MINA server to the camel loadbalancer +who will display in its log the content of the Report object. + +1. Description of the routes +============================ + +1) Loadbalancer + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Generator"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <package> + com.intuit.ai.step.camel + </package> + <route id="sendMessage"> + <from uri="timer://org.apache.camel.example.loadbalancer?fixedRate=true&period=60000"/> + <bean ref="service" method="createReport"/> + <to uri="direct:loadbalance"/> + </route> + + <route id="loadbalancer"> + <from uri="direct:loadbalance"/> + <loadBalance> + <roundRobin/> + <to uri="mina:tcp://localhost:9999?sync=true&allowDefaultCodec=true"/> + <to uri="mina:tcp://localhost:9998?sync=true&allowDefaultCodec=true"/> + </loadBalance> + <to uri="log:org.apache.camel.example?level=INFO"/> + </route> +</camelContext> + +</beans> + +2) MINA 1 + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Reporting"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <route id="mina1"> + <from uri="mina:tcp://localhost:9999"/> + <setHeader headerName="minaServer"><constant>localhost:9999</constant></setHeader> + <bean ref="service" method="updateReport"/> + </route> +</camelContext> + +</beans> + +2) MINA 2 + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Reporting"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <route id="mina1"> + <from uri="mina:tcp://localhost:9998"/> + <setHeader headerName="minaServer"><constant>localhost:9999</constant></setHeader> + <bean ref="service" method="updateReport"/> + </route> +</camelContext> + +</beans> + +2. Test the example +=================== + +First compile the loadbalancing example and add it in your maven repo. +remark : Classes compiled in this project are used by mina1 and mina2 + +>loadbalancing +mvn clean install + +To run the example, execute now the following command : + +>mina1 +mvn clean install camel:run + +>mina2 +mvn clean install camel:run + +>loadbalancing +mvn camel:run + +and check the result in the log of loadbalancer + +[pache.camel.spring.Main.main()] MainSupport INFO Apache Camel 2.2.0 starting +[pache.camel.spring.Main.main()] CamelNamespaceHandler INFO camel-osgi.jar/camel-spring-osgi.jar not detected in classpath +[pache.camel.spring.Main.main()] DefaultCamelContext INFO Apache Camel 2.2.0 (CamelContext:camelContext) is starting +[pache.camel.spring.Main.main()] DefaultCamelContext INFO JMX enabled. Using DefaultManagedLifecycleStrategy. +[pache.camel.spring.Main.main()] DefaultCamelContext INFO Started 2 routes +[pache.camel.spring.Main.main()] DefaultCamelContext INFO Apache Camel 2.2.0 (CamelContext:camelContext) started +[che.camel.example.loadbalancer] example INFO Exchange[BodyType:org.apache.camel.example.model.Report, Body:>> *************** +******************************** +>> Report id : 1 +>> Report title : Report Title : 1 +>> Report content : This is a dummy report +>> Report reply : Report updated from MINA server running on : localhost:9999 +>> *********************************************** +] +[che.camel.example.loadbalancer] example INFO Exchange[BodyType:org.apache.camel.example.model.Report, Body:>> *************** +******************************** +>> Report id : 2 +>> Report title : Report Title : 2 +>> Report content : This is a dummy report +>> Report reply : Report updated from MINA server running on : localhost:9998 +>> *********************************************** +] +[che.camel.example.loadbalancer] example INFO Exchange[BodyType:org.apache.camel.example.model.Report, Body:>> *************** +******************************** +>> Report id : 3 +>> Report title : Report Title : 3 +>> Report content : This is a dummy report +>> Report reply : Report updated from MINA server running on : localhost:9999 +>> *********************************************** +] + +... + + + + + + + + + + + + + + + +Enjoy it + Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/README.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,92 @@ +<?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> + + <groupId>org.apache.camel.example</groupId> + <artifactId>loadbalancing</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + + <name>A Camel Route</name> + <url>http://www.myorganization.org</url> + + <properties> + <camel-version>2.2.0</camel-version> + <log4j-version>1.2.14</log4j-version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-mina</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j-version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.5.10</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.5.6</version> + </dependency> + </dependencies> + + <build> + <defaultGoal>install</defaultGoal> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + + <!-- allows the route to be ran via 'mvn camel:run' --> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-maven-plugin</artifactId> + <version>${camel-version}</version> + </plugin> + + </plugins> + </build> +</project> Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java Fri Apr 23 08:51:01 2010 @@ -0,0 +1,93 @@ +/** + * 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.example.model; + +import java.io.Serializable; + +import sun.tools.tree.ThisExpression; + +public class Report implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + private String title; + private String content; + private String reply; + + /** + * @return the id + */ + public Integer getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(Integer id) { + this.id = id; + } + /** + * @return the title + */ + public String getTitle() { + return title; + } + /** + * @param title the title to set + */ + public void setTitle(String title) { + this.title = title; + } + /** + * @return the content + */ + public String getContent() { + return content; + } + /** + * @param content the content to set + */ + public void setContent(String content) { + this.content = content; + } + /** + * @return the reply + */ + public String getReply() { + return reply; + } + /** + * @param reply the reply to set + */ + public void setReply(String reply) { + this.reply = reply; + } + + public String toString() { + StringBuilder result = new StringBuilder(); + result.append(">> ***********************************************" + "\n"); + result.append(">> Report id : " + this.id + "\n"); + result.append(">> Report title : " + this.title+ "\n"); + result.append(">> Report content : " + this.content+ "\n"); + result.append(">> Report reply : " + this.reply+ "\n"); + result.append(">> ***********************************************" + "\n"); + return result.toString(); + + } + +} Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/model/Report.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java Fri Apr 23 08:51:01 2010 @@ -0,0 +1,41 @@ +/** + * 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.example.service; + +import org.apache.camel.example.model.Report; + +public class Generator { + + private static int count = 0; + + public Report createReport() throws Exception { + + int counter = ++count; + + // Create a Report object + Report report = new Report(); + report.setId(counter); + report.setTitle("Report Title : " + counter); + report.setContent("This is a dummy report"); + + // Add the report to the Body + return report; + } + + + +} Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Generator.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java Fri Apr 23 08:51:01 2010 @@ -0,0 +1,42 @@ +/** + * 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.example.service; + +import org.apache.camel.Body; +import org.apache.camel.Exchange; +import org.apache.camel.Header; +import org.apache.camel.Processor; +import org.apache.camel.example.model.Report; + +public class Reporting implements Processor { + + private static Integer count; + + public void process(Exchange exchange) throws Exception { + } + + public Report updateReport(@Body Report report, @Header("minaServer") String name) throws Exception { + + report.setReply("Report updated from MINA server running on : " + name); + + // send the report updated + return report; + } + + + +} Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/java/org/apache/camel/example/service/Reporting.java ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,53 @@ +<?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. +--> + +<!-- Configures the Camel Context--> + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Generator"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <package> + com.intuit.ai.step.camel + </package> + <route id="sendMessage"> + <from uri="timer://org.apache.camel.example.loadbalancer?fixedRate=true&period=60000"/> + <bean ref="service" method="createReport"/> + <to uri="direct:loadbalance"/> + </route> + + <route id="loadbalancer"> + <from uri="direct:loadbalance"/> + <loadBalance> + <roundRobin/> + <to uri="mina:tcp://localhost:9999?sync=true&allowDefaultCodec=true"/> + <to uri="mina:tcp://localhost:9998?sync=true&allowDefaultCodec=true"/> + </loadBalance> + <to uri="log:org.apache.camel.example?level=INFO"/> + </route> +</camelContext> + +</beans> Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties Fri Apr 23 08:51:01 2010 @@ -0,0 +1,22 @@ + +# +# The logging properties used for eclipse testing, We want to see debug output on the console. +# +log4j.rootLogger=INFO, out + +# uncomment the following line to turn on Camel debugging +#log4j.logger.org.apache.camel=DEBUG + +# uncomment the following line to turn on ActiveMQ debugging +#log4j.logger.org.apache.activemq=DEBUG + +log4j.logger.org.springframework=WARN + + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n +#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/loadbalancing/src/main/resources/log4j.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,97 @@ +<?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> + + <groupId>org.apache.camel.example</groupId> + <artifactId>mina1</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + + <name>A Camel Route</name> + <url>http://www.myorganization.org</url> + + <properties> + <camel-version>2.2.0</camel-version> + <log4j-version>1.2.14</log4j-version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.example</groupId> + <artifactId>loadbalancing</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-mina</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j-version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.5.10</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.5.6</version> + </dependency> + </dependencies> + + <build> + <defaultGoal>install</defaultGoal> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + + <!-- allows the route to be ran via 'mvn camel:run' --> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-maven-plugin</artifactId> + <version>${camel-version}</version> + </plugin> + + </plugins> + </build> +</project> Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,40 @@ +<?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. +--> + +<!-- Configures the Camel Context--> + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Reporting"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <route id="mina1"> + <from uri="mina:tcp://localhost:9999"/> + <setHeader headerName="minaServer"><constant>localhost:9999</constant></setHeader> + <bean ref="service" method="updateReport"/> + </route> +</camelContext> + +</beans> \ No newline at end of file Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/META-INF/spring/camel-context-mina1.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties Fri Apr 23 08:51:01 2010 @@ -0,0 +1,22 @@ + +# +# The logging properties used for eclipse testing, We want to see debug output on the console. +# +log4j.rootLogger=INFO, out + +# uncomment the following line to turn on Camel debugging +#log4j.logger.org.apache.camel=DEBUG + +# uncomment the following line to turn on ActiveMQ debugging +#log4j.logger.org.apache.activemq=DEBUG + +log4j.logger.org.springframework=WARN + + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n +#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina1/src/main/resources/log4j.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,97 @@ +<?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> + + <groupId>org.apache.camel.example</groupId> + <artifactId>mina2</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + + <name>A Camel Route</name> + <url>http://www.myorganization.org</url> + + <properties> + <camel-version>2.2.0</camel-version> + <log4j-version>1.2.14</log4j-version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.example</groupId> + <artifactId>loadbalancing</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-mina</artifactId> + <version>${camel-version}</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j-version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.5.10</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.5.6</version> + </dependency> + </dependencies> + + <build> + <defaultGoal>install</defaultGoal> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + + <!-- allows the route to be ran via 'mvn camel:run' --> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-maven-plugin</artifactId> + <version>${camel-version}</version> + </plugin> + + </plugins> + </build> +</project> Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml Fri Apr 23 08:51:01 2010 @@ -0,0 +1,40 @@ +<?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. +--> + +<!-- Configures the Camel Context--> + +<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" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://camel.apache.org/schema/spring + http://camel.apache.org/schema/spring/camel-spring.xsd "> + +<bean id="service" class="org.apache.camel.example.service.Reporting"/> + +<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> + <route id="mina1"> + <from uri="mina:tcp://localhost:9998"/> + <setHeader headerName="minaServer"><constant>localhost:9998</constant></setHeader> + <bean ref="service" method="updateReport"/> + </route> +</camelContext> + +</beans> \ No newline at end of file Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/META-INF/spring/camel-context-mina2.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties?rev=937195&view=auto ============================================================================== --- camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties (added) +++ camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties Fri Apr 23 08:51:01 2010 @@ -0,0 +1,22 @@ + +# +# The logging properties used for eclipse testing, We want to see debug output on the console. +# +log4j.rootLogger=INFO, out + +# uncomment the following line to turn on Camel debugging +#log4j.logger.org.apache.camel=DEBUG + +# uncomment the following line to turn on ActiveMQ debugging +#log4j.logger.org.apache.activemq=DEBUG + +log4j.logger.org.springframework=WARN + + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n +#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer Propchange: camel/trunk/examples/camel-example-loadbalancing-mina/mina2/src/main/resources/log4j.properties ------------------------------------------------------------------------------ svn:eol-style = native