camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [01/12] CAMEL-6555 Created camel-netty4 module based on latest camel-netty code
Date Fri, 18 Jul 2014 15:15:28 GMT
Repository: camel
Updated Branches:
  refs/heads/CAMEL-6555 [created] fd2b4a7e5


http://git-wip-us.apache.org/repos/asf/camel/blob/7b054480/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
new file mode 100644
index 0000000..7ea4d2d
--- /dev/null
+++ b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
@@ -0,0 +1,52 @@
+<?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"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <!-- use the worker pool builder to create to help create the shared thread pool -->
+  <bean id="poolBuilder" class="org.apache.camel.component.netty.NettyWorkerPoolBuilder">
+    <property name="workerCount" value="2"/>
+  </bean>
+
+  <!-- the shared worker thread pool -->
+  <bean id="sharedPool" class="org.jboss.netty.channel.socket.nio.WorkerPool"
+        factory-bean="poolBuilder" factory-method="build" destroy-method="shutdown">
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="netty:tcp://localhost:5021?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;orderedThreadPoolExecutor=false"/>
+      <to uri="log:result"/>
+      <to uri="mock:result"/>
+    </route>
+
+    <route>
+      <from uri="netty:tcp://localhost:5022?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;orderedThreadPoolExecutor=false"/>
+      <to uri="log:result"/>
+      <to uri="mock:result"/>
+    </route>
+
+    <route>
+      <from uri="netty:tcp://localhost:5023?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;orderedThreadPoolExecutor=false"/>
+      <to uri="log:result"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/7b054480/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/multiple-codecs.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/multiple-codecs.xml
b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/multiple-codecs.xml
new file mode 100644
index 0000000..e895577
--- /dev/null
+++ b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/multiple-codecs.xml
@@ -0,0 +1,72 @@
+<?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:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+       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://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <!-- START SNIPPET: routes -->
+    <camelContext id="multiple-netty-codecs-context" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct:multiple-codec"/>
+            <to uri="netty:tcp://localhost:5150?encoders=#encoders&amp;sync=false"/>
+        </route>
+        <route>
+            <from uri="netty:tcp://localhost:5150?decoders=#length-decoder,#string-decoder&amp;sync=false"/>
+            <to uri="mock:multiple-codec"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: routes -->
+
+    <!-- START SNIPPET: registry-beans -->
+    <util:list id="decoders" list-class="java.util.LinkedList">
+        <bean class="org.apache.camel.component.netty.ChannelHandlerFactories" factory-method="newLengthFieldBasedFrameDecoder">
+            <constructor-arg value="1048576"/>
+            <constructor-arg value="0"/>
+            <constructor-arg value="4"/>
+            <constructor-arg value="0"/>
+            <constructor-arg value="4"/>
+        </bean>
+        <bean class="org.jboss.netty.handler.codec.string.StringDecoder"/>
+    </util:list>
+
+    <util:list id="encoders" list-class="java.util.LinkedList">
+        <bean class="org.jboss.netty.handler.codec.frame.LengthFieldPrepender">
+            <constructor-arg value="4"/>
+        </bean>
+        <bean class="org.jboss.netty.handler.codec.string.StringEncoder"/>
+    </util:list>
+
+    <bean id="length-encoder" class="org.jboss.netty.handler.codec.frame.LengthFieldPrepender">
+        <constructor-arg value="4"/>
+    </bean>
+    <bean id="string-encoder" class="org.jboss.netty.handler.codec.string.StringEncoder"/>
+
+    <bean id="length-decoder" class="org.apache.camel.component.netty.ChannelHandlerFactories"
factory-method="newLengthFieldBasedFrameDecoder">
+        <constructor-arg value="1048576"/>
+        <constructor-arg value="0"/>
+        <constructor-arg value="4"/>
+        <constructor-arg value="0"/>
+        <constructor-arg value="4"/>
+    </bean>
+    <bean id="string-decoder" class="org.jboss.netty.handler.codec.string.StringDecoder"/>
+    <!-- START SNIPPET: registry-beans -->
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/7b054480/components/camel-netty4/src/test/resources/test.txt
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/resources/test.txt b/components/camel-netty4/src/test/resources/test.txt
new file mode 100644
index 0000000..b8713e9
--- /dev/null
+++ b/components/camel-netty4/src/test/resources/test.txt
@@ -0,0 +1,19 @@
+Song Of A Dream
+by: Dr Sarojini Naidu
+
+ONCE in the dream of a night I stood 
+Lone in the light of a magical wood, 
+Soul-deep in visions that poppy-like sprang; 
+And spirits of Truth were the birds that sang, 
+And spirits of Love were the stars that glowed, 
+And spirits of Peace were the streams that flowed 
+In that magical wood in the land of sleep.
+
+
+Lone in the light of that magical grove, 
+I felt the stars of the spirits of Love 
+Gather and gleam round my delicate youth, 
+And I heard the song of the spirits of Truth; 
+To quench my longing I bent me low 
+By the streams of the spirits of Peace that flow 
+In that magical wood in the land of sleep.
\ No newline at end of file


Mime
View raw message