Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
           http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

  <!-- 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://localhost/one?matchOnUriPrefix=true&amp;nettySharedHttpServer=#sharedNettyHttpServer"/>
      <transform>
        <simple>Response from Camel one using thread: ${threadName}</simple>
      </transform>
    </route>

  </camelContext>

</blueprint>
Note
titleMust use unique context-path in Camel routes

When using the nettySharedHttpServer option in Camel routes, then each context-path must be unique. For example in this example we have 2 Camel applications, where they use unique context-path names:

  • /one
  • /two

This is because the shared Netty HTTP server needs to know exactly which Camel application that should route the incoming message. And therefore the context-path must be unique among all the Camel routes.

Running the example

This example runs in Apache Karaf / ServiceMix container.

...