camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/5] git commit: CAMEL-6488: camel-netty-http. Added example for blueprint.
Date Wed, 26 Jun 2013 10:43:59 GMT
CAMEL-6488: camel-netty-http. Added example for blueprint.


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

Branch: refs/heads/master
Commit: d7498cd158e598c5c67d311e92156a8d5929d76c
Parents: 6e8ca92
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jun 26 12:09:31 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jun 26 12:09:31 2013 +0200

----------------------------------------------------------------------
 .../http/DefaultNettySharedHttpServer.java      | 36 +++++++++++++---
 .../http/HttpServerSharedPipelineFactory.java   | 15 +++----
 .../component/netty/http/NettyHttpEndpoint.java |  2 +-
 .../netty/http/NettySharedHttpServer.java       | 12 +++++-
 .../netty/http/NettySharedHttpServerTest.java   |  3 +-
 .../SingleTCPNettyServerBootstrapFactory.java   |  5 ++-
 .../SingleUDPNettyServerBootstrapFactory.java   | 35 ++++++++-------
 .../camel-example-netty-http/myapp-one/pom.xml  | 45 +++++++++++++++-----
 .../resources/OSGI-INF/blueprint/camel-one.xml  |  5 ++-
 .../camel-example-netty-http/myapp-two/pom.xml  | 45 +++++++++++++++-----
 .../resources/OSGI-INF/blueprint/camel-two.xml  |  5 ++-
 .../shared-netty-http-server/pom.xml            |  1 -
 .../OSGI-INF/blueprint/http-server.xml          | 14 +++---
 13 files changed, 159 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
index 034bb68..c264128 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettySharedHttpServer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.netty.http;
 
-import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
 import org.apache.camel.component.netty.NettyServerBootstrapFactory;
 import org.apache.camel.component.netty.http.handlers.HttpServerMultiplexChannelHandler;
 import org.apache.camel.spi.ClassResolver;
@@ -32,14 +31,18 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultNettySharedHttpServer extends ServiceSupport implements NettySharedHttpServer
{
 
+    // TODO: option to enlist in JMX
+    // TODO: option to configure thread name pattern for the shared jetty threads
+
     private static final Logger LOG = LoggerFactory.getLogger(DefaultNettySharedHttpServer.class);
 
-    private NettyServerBootstrapConfiguration configuration;
+    private NettySharedHttpServerBootstrapConfiguration configuration;
     private HttpServerConsumerChannelFactory channelFactory;
     private HttpServerBootstrapFactory bootstrapFactory;
     private ClassResolver classResolver;
+    private boolean startServer = true;
 
-    public void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration)
{
+    public void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration
configuration) {
         this.configuration = configuration;
     }
 
@@ -59,6 +62,18 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements
Nett
         return bootstrapFactory;
     }
 
+    public int getConsumersSize() {
+        if (channelFactory != null) {
+            return channelFactory.consumers();
+        } else {
+            return -1;
+        }
+    }
+
+    public void setStartServer(boolean startServer) {
+        this.startServer = startServer;
+    }
+
     protected void doStart() throws Exception {
         ObjectHelper.notNull(configuration, "setNettyServerBootstrapConfiguration() must
be called with a NettyServerBootstrapConfiguration instance", this);
 
@@ -66,8 +81,12 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements
Nett
         if (configuration.getPort() <= 0) {
             throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration
" + configuration);
         }
+        // hostname must be set
+        if (ObjectHelper.isEmpty(configuration.getHost())) {
+            throw new IllegalArgumentException("Host must be configured on NettySharedHttpServerBootstrapConfiguration
" + configuration);
+        }
 
-        LOG.info("Starting NettySharedHttpServer using configuration: {} on port: {}", configuration,
configuration.getPort());
+        LOG.debug("NettySharedHttpServer using configuration: {}", configuration);
 
         // force using tcp as the underlying transport
         configuration.setProtocol("tcp");
@@ -80,11 +99,18 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements
Nett
         // create bootstrap factory and disable compatible check as its shared among the
consumers
         bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false);
         bootstrapFactory.init(null, configuration, pipelineFactory);
+
+        ServiceHelper.startServices(channelFactory);
+
+        if (startServer) {
+            LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(),
configuration.getPort());
+            ServiceHelper.startServices(bootstrapFactory);
+        }
     }
 
     @Override
     protected void doStop() throws Exception {
-        LOG.info("Stopping NettySharedHttpServer using configuration: {} on port: {}", configuration,
configuration.getPort());
+        LOG.info("Stopping NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
         ServiceHelper.stopServices(bootstrapFactory, channelFactory);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
index e4e88f9..daa896a 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerSharedPipelineFactory.java
@@ -43,12 +43,12 @@ import org.slf4j.LoggerFactory;
 public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(HttpServerSharedPipelineFactory.class);
-    private final NettyServerBootstrapConfiguration configuration;
+    private final NettySharedHttpServerBootstrapConfiguration configuration;
     private final HttpServerConsumerChannelFactory channelFactory;
     private final ClassResolver classResolver;
     private SSLContext sslContext;
 
-    public HttpServerSharedPipelineFactory(NettyServerBootstrapConfiguration configuration,
HttpServerConsumerChannelFactory channelFactory,
+    public HttpServerSharedPipelineFactory(NettySharedHttpServerBootstrapConfiguration configuration,
HttpServerConsumerChannelFactory channelFactory,
                                            ClassResolver classResolver) {
         this.configuration = configuration;
         this.channelFactory = channelFactory;
@@ -81,14 +81,13 @@ public class HttpServerSharedPipelineFactory extends HttpServerPipelineFactory
{
         }
 
         pipeline.addLast("decoder", new HttpRequestDecoder());
-        // Uncomment the following line if you don't want to handle HttpChunks.
-//        if (configuration.isChunked()) {
+        if (configuration.isChunked()) {
             pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
-//        }
+        }
         pipeline.addLast("encoder", new HttpResponseEncoder());
-//        if (configuration.isCompression()) {
-//            pipeline.addLast("deflater", new HttpContentCompressor());
-//        }
+        if (configuration.isCompression()) {
+            pipeline.addLast("deflater", new HttpContentCompressor());
+        }
 
         pipeline.addLast("handler", channelFactory.getChannelHandler());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
index 18565b4..252ea46 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpEndpoint.java
@@ -63,7 +63,7 @@ public class NettyHttpEndpoint extends NettyEndpoint implements HeaderFilterStra
 
         if (nettySharedHttpServer != null) {
             answer.setNettyServerBootstrapFactory(nettySharedHttpServer.getServerBootstrapFactory());
-            LOG.debug("Created NettyHttpConsumer: {} using NettySharedHttpServer: {}", answer,
nettySharedHttpServer);
+            LOG.info("NettyHttpConsumer: {} is using NettySharedHttpServer on port: {}",
answer, nettySharedHttpServer.getPort());
         } else {
             // reuse pipeline factory for the same address
             HttpServerBootstrapFactory factory = getComponent().getOrCreateHttpNettyServerBootstrapFactory(answer);

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
index b98f118..22110bb 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettySharedHttpServer.java
@@ -34,7 +34,7 @@ public interface NettySharedHttpServer extends Service {
     /**
      * Sets the bootstrap configuration to use by this shared Netty HTTP server.
      */
-    void setNettyServerBootstrapConfiguration(NettyServerBootstrapConfiguration configuration);
+    void setNettyServerBootstrapConfiguration(NettySharedHttpServerBootstrapConfiguration
configuration);
 
     /**
      * To use a custom {@link ClassResolver} for loading resource on the classpath.
@@ -42,6 +42,11 @@ public interface NettySharedHttpServer extends Service {
     void setClassResolver(ClassResolver classResolver);
 
     /**
+     * Whether to start the Netty HTTP server eager and bind to the port, or wait on first
demand
+     */
+    void setStartServer(boolean startServer);
+
+    /**
      * Gets the port number this Netty HTTP server uses.
      */
     int getPort();
@@ -56,4 +61,9 @@ public interface NettySharedHttpServer extends Service {
      */
     NettyServerBootstrapFactory getServerBootstrapFactory();
 
+    /**
+     * Number of consumers using this shared Netty HTTP server.
+     */
+    int getConsumersSize();
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
index aa8073f..a268ba9 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettySharedHttpServerTest.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.netty.http;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
 import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
@@ -61,6 +60,8 @@ public class NettySharedHttpServerTest extends BaseNettyTest {
         out = template.requestBody("netty-http:http://localhost:{{port}}/bar", "Hello Camel",
String.class);
         assertEquals("Bye Camel", out);
 
+        assertEquals(2, nettySharedHttpServer.getConsumersSize());
+
         assertMockEndpointsSatisfied();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
index 45442ce..17b019b 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleTCPNettyServerBootstrapFactory.java
@@ -124,11 +124,12 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport
impleme
             }
         }
 
-        LOG.info("Created ServerBootstrap {} with options: {}", serverBootstrap, serverBootstrap.getOptions());
+        LOG.debug("Created ServerBootstrap {} with options: {}", serverBootstrap, serverBootstrap.getOptions());
 
         // set the pipeline factory, which creates the pipeline for each newly created channels
         serverBootstrap.setPipelineFactory(pipelineFactory);
 
+        LOG.info("ServerBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
         channel = serverBootstrap.bind(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
         // to keep track of all channels in use
         allChannels.add(channel);
@@ -136,6 +137,8 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport
impleme
 
     protected void stopServerBootstrap() {
         // close all channels
+        LOG.info("ServerBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());
+
         LOG.trace("Closing {} channels", allChannels.size());
         ChannelGroupFuture future = allChannels.close();
         future.awaitUninterruptibly();

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
index 138c98f..b43fe97 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
@@ -46,7 +46,7 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport
impleme
     private NettyServerBootstrapConfiguration configuration;
     private ChannelPipelineFactory pipelineFactory;
     private DatagramChannelFactory datagramChannelFactory;
-    private ConnectionlessBootstrap connectionlessServerBootstrap;
+    private ConnectionlessBootstrap connectionlessBootstrap;
     private Channel channel;
     private ExecutorService workerExecutor;
 
@@ -100,43 +100,46 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport
impleme
             datagramChannelFactory = new NioDatagramChannelFactory(workerExecutor, configuration.getWorkerCount());
         }
 
-        connectionlessServerBootstrap = new ConnectionlessBootstrap(datagramChannelFactory);
-        connectionlessServerBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
-        connectionlessServerBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
-        connectionlessServerBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
-        connectionlessServerBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
-        connectionlessServerBootstrap.setOption("child.connectTimeoutMillis", configuration.getConnectTimeout());
-        connectionlessServerBootstrap.setOption("child.broadcast", configuration.isBroadcast());
-        connectionlessServerBootstrap.setOption("sendBufferSize", configuration.getSendBufferSize());
-        connectionlessServerBootstrap.setOption("receiveBufferSize", configuration.getReceiveBufferSize());
+        connectionlessBootstrap = new ConnectionlessBootstrap(datagramChannelFactory);
+        connectionlessBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
+        connectionlessBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
+        connectionlessBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
+        connectionlessBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
+        connectionlessBootstrap.setOption("child.connectTimeoutMillis", configuration.getConnectTimeout());
+        connectionlessBootstrap.setOption("child.broadcast", configuration.isBroadcast());
+        connectionlessBootstrap.setOption("sendBufferSize", configuration.getSendBufferSize());
+        connectionlessBootstrap.setOption("receiveBufferSize", configuration.getReceiveBufferSize());
         // only set this if user has specified
         if (configuration.getReceiveBufferSizePredictor() > 0) {
-            connectionlessServerBootstrap.setOption("receiveBufferSizePredictorFactory",
+            connectionlessBootstrap.setOption("receiveBufferSizePredictorFactory",
                     new FixedReceiveBufferSizePredictorFactory(configuration.getReceiveBufferSizePredictor()));
         }
         if (configuration.getBacklog() > 0) {
-            connectionlessServerBootstrap.setOption("backlog", configuration.getBacklog());
+            connectionlessBootstrap.setOption("backlog", configuration.getBacklog());
         }
 
         // set any additional netty options
         if (configuration.getOptions() != null) {
             for (Map.Entry<String, Object> entry : configuration.getOptions().entrySet())
{
-                connectionlessServerBootstrap.setOption(entry.getKey(), entry.getValue());
+                connectionlessBootstrap.setOption(entry.getKey(), entry.getValue());
             }
         }
 
-        LOG.info("Created ConnectionlessBootstrap {} with options: {}", connectionlessServerBootstrap,
connectionlessServerBootstrap.getOptions());
+        LOG.debug("Created ConnectionlessBootstrap {} with options: {}", connectionlessBootstrap,
connectionlessBootstrap.getOptions());
 
         // set the pipeline factory, which creates the pipeline for each newly created channels
-        connectionlessServerBootstrap.setPipelineFactory(pipelineFactory);
+        connectionlessBootstrap.setPipelineFactory(pipelineFactory);
 
-        channel = connectionlessServerBootstrap.bind(new InetSocketAddress(configuration.getHost(),
configuration.getPort()));
+        LOG.info("ConnectionlessBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
+        channel = connectionlessBootstrap.bind(new InetSocketAddress(configuration.getHost(),
configuration.getPort()));
         // to keep track of all channels in use
         allChannels.add(channel);
     }
 
     protected void stopServerBootstrap() {
         // close all channels
+        LOG.info("ConnectionlessBootstrap unbinding from {}:{}", configuration.getHost(),
configuration.getPort());
+
         LOG.trace("Closing {} channels", allChannels.size());
         ChannelGroupFuture future = allChannels.close();
         future.awaitUninterruptibly();

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-one/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/pom.xml b/examples/camel-example-netty-http/myapp-one/pom.xml
index 9a05c18..c7263f9 100644
--- a/examples/camel-example-netty-http/myapp-one/pom.xml
+++ b/examples/camel-example-netty-http/myapp-one/pom.xml
@@ -15,16 +15,41 @@
     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/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>camel-example-netty-http</artifactId>
-        <groupId>org.apache.camel</groupId>
-        <version>2.12-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>camel-example-netty-http</artifactId>
+    <groupId>org.apache.camel</groupId>
+    <version>2.12-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>camel-example-netty-myapp-one</artifactId>
-    <name>Camel :: Example :: Netty HTTP :: My Application One</name>
-    <packaging>bundle</packaging>
+  <artifactId>camel-example-netty-myapp-one</artifactId>
+  <name>Camel :: Example :: Netty HTTP :: My Application One</name>
+  <packaging>bundle</packaging>
+
+  <build>
+    <plugins>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <manifestLocation>target/META-INF</manifestLocation>
+          <instructions>
+            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+            <Import-Package>
+              org.apache.camel.component.netty,
+              org.apache.camel.component.netty.http,
+              org.osgi.service.blueprint
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
index 6371b35..a1ce86f 100644
--- a/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
+++ b/examples/camel-example-netty-http/myapp-one/src/main/resources/OSGI-INF/blueprint/camel-one.xml
@@ -23,12 +23,13 @@
   <!-- reference the shared http server -->
   <reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
 
+  <!-- Camel application which uses the netty-http component and the shared Netty HTTP
server -->
   <camelContext xmlns="http://camel.apache.org/schema/blueprint">
 
     <route id="http-route-one">
-      <from uri="netty-http:http://0.0.0.0/one?matchOnUriPrefix=true&amp;nettySharedHttpServer=#sharedNettyHttpServer"/>
+      <from uri="netty-http:http://localhost/one?matchOnUriPrefix=true&amp;nettySharedHttpServer=#sharedNettyHttpServer"/>
       <transform>
-        <simple>Response from camel one: ${body}</simple>
+        <simple>Response from Camel one using thread: ${threadName}</simple>
       </transform>
     </route>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-two/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/pom.xml b/examples/camel-example-netty-http/myapp-two/pom.xml
index 6e0ae27..9628fae 100644
--- a/examples/camel-example-netty-http/myapp-two/pom.xml
+++ b/examples/camel-example-netty-http/myapp-two/pom.xml
@@ -15,16 +15,41 @@
     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/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>camel-example-netty-http</artifactId>
-        <groupId>org.apache.camel</groupId>
-        <version>2.12-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>camel-example-netty-http</artifactId>
+    <groupId>org.apache.camel</groupId>
+    <version>2.12-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>camel-example-netty-myapp-two</artifactId>
-    <name>Camel :: Example :: Netty HTTP :: My Application Two</name>
-    <packaging>bundle</packaging>
+  <artifactId>camel-example-netty-myapp-two</artifactId>
+  <name>Camel :: Example :: Netty HTTP :: My Application Two</name>
+  <packaging>bundle</packaging>
+
+  <build>
+    <plugins>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <manifestLocation>target/META-INF</manifestLocation>
+          <instructions>
+            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+            <Import-Package>
+              org.apache.camel.component.netty,
+              org.apache.camel.component.netty.http,
+              org.osgi.service.blueprint
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
index b34a983..c83b6eb 100644
--- a/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
+++ b/examples/camel-example-netty-http/myapp-two/src/main/resources/OSGI-INF/blueprint/camel-two.xml
@@ -23,12 +23,13 @@
   <!-- reference the shared http server -->
   <reference id="sharedNettyHttpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
 
+  <!-- Camel application which uses the netty-http component and the shared Netty HTTP
server -->
   <camelContext xmlns="http://camel.apache.org/schema/blueprint">
 
     <route id="http-route-two">
-      <from uri="netty-http:http://0.0.0.0/two?matchOnUriPrefix=true&amp;nettySharedHttpServer=#sharedNettyHttpServer"/>
+      <from uri="netty-http:http://localhost/two?matchOnUriPrefix=true&amp;nettySharedHttpServer=#sharedNettyHttpServer"/>
       <transform>
-        <simple>Response from camel two: ${body}</simple>
+        <simple>Response from Camel one using thread: ${threadName}</simple>
       </transform>
     </route>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/pom.xml b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
index af85beb..97d3d7e 100644
--- a/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
+++ b/examples/camel-example-netty-http/shared-netty-http-server/pom.xml
@@ -49,7 +49,6 @@
         </configuration>
       </plugin>
 
-
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d7498cd1/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
index 54a7cf4..ba8f0631 100755
--- a/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
+++ b/examples/camel-example-netty-http/shared-netty-http-server/src/main/resources/OSGI-INF/blueprint/http-server.xml
@@ -21,11 +21,13 @@
            http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
 
   <!-- netty http bootstrap configuration -->
-  <!--<bean id="configuration" class="org.apache.camel.component.netty.http.NettySharedHttpServerBootstrapConfiguration">-->
-  <bean id="configuration" class="org.apache.camel.component.netty.NettyServerBootstrapConfiguration">
-     <!-- the port number is mandatory and must be set -->
+  <bean id="configuration" class="org.apache.camel.component.netty.http.NettySharedHttpServerBootstrapConfiguration">
+     <!-- the port and host is mandatory and must be set -->
     <property name="port" value="8888"/>
-    <property name="backlog" value="20"/>
+    <property name="host" value="0.0.0.0"/>
+    <!-- additional options -->
+    <property name="backlog" value="50"/>
+    <property name="compression" value="true"/>
   </bean>
 
   <!-- the netty http server -->
@@ -34,7 +36,7 @@
     <property name="nettyServerBootstrapConfiguration" ref="configuration"/>
   </bean>
 
-  <!-- and exported in the OSGi server registry so we can use it from the Camel application
bundles -->
-  <service id="sharedNettyHttpServer" ref="httpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
+  <!-- export in the OSGi server registry so we can use it from the Camel application
bundles -->
+  <service ref="httpServer" interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>
 
 </blueprint>


Mime
View raw message