Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc
Netty HTTP Server Example
Available as of Camel 2.12
This example is located in the
If you use maven then you can easily package the example from the command line:
This example shows how to use a shared Netty HTTP Server in an OSGi environment.
There is 3 modules in this example
Then we define the shared Netty HTTP server using the
And finally we need to enlist the shared Netty HTTP server in the OSGi Service Registry, so we can refer and use it from other bundles.
The Camel route
In the two Camel applications, each have a Camel route that uses the shared Netty HTTP server. The Camel application is defined in an OSGi blueprint file, for example from myapp-one its the
First we need to refer to the shared Netty HTTP server which was enlisted in the OSGi service registry using the reference tag as shown below.
In the Camel route, we then use the
Must use unique context-path in Camel routes
When using the
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.
To install Apache Camel in Karaf you type in the shell (we use version 2.12.0):
First you need to install the following features in Karaf/ServiceMix with:
In the Apache Karaf / ServiceMix shell type:
Then you can install the Camel applications:
From a web browser you can then try the example by accessing the followign URLs: