Netty HTTP component
The
netty-httpcomponent serves HTTP requests on an address given in the URI, for routes written for Apache Camel's camel-netty-http.
Scheme: netty-http: · Crate: cameleer-http · Cargo feature: none, always included (build features) ·
Consumer: yes · Producer: no · Apache Camel: Netty HTTP
netty-http: endpoints run on Cameleer's embedded HTTP/1.1 server, the same one as
platform-http. There is no Netty: the scheme exists so Camel routes run
unchanged. For raw TCP and UDP use the netty component; for outgoing HTTP use http.
When to use it
- Run an existing Camel route that uses
netty-http:without changes. - A liveness probe for a container orchestrator on its own port.
URI format
netty-http:http://host:port/path[?options]
netty-http:https://host:port/path[?options]Example
A liveness probe that answers pong and echoes a probe query parameter, so a load balancer
or Kubernetes can check the integration.
- route:
id: liveness
from:
uri: "netty-http:http://0.0.0.0:{{env:PROBE_PORT:8083}}/ping"
steps:
- setBody:
simple: "pong ${header.probe}"Rust DSL
fn liveness_route(b: &mut RouteBuilder, port: u16) {
b.from(&format!("netty-http:http://0.0.0.0:{}/ping", port))
.route_id("liveness")
.set_body(simple("pong ${header.probe}"));
}Options
The options of platform-http apply: httpMethodRestrict,
matchOnUriPrefix, consumes, produces, muteException, chunked, mapHttpMessageBody,
mapHttpMessageHeaders, mapHttpMessageFormUrlEncodedBody, disableStreamCache,
sslContextParameters, useGlobalSslContextParameters, needClientAuth / clientAuth, and
host / port to override the URI. Netty tuning options (worker groups, codecs) are not
supported.
Message headers
The same as platform-http. Query parameters such as
?probe=lb become message headers.
Run it with Docker
docker run --rm -p 8083:8083 -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/liveness.camel.yaml
curl 'localhost:8083/ping?probe=lb'Common questions
Does netty-http need Netty?
No. It runs on the built-in server.
What happens to query parameters?
They become message headers (${header.probe}), and the whole query string is in
CamelHttpQuery.
Can I use netty-http as a client?
No. Use http.
Related
- platform-http, jetty, undertow.
- Apache Camel: Netty HTTP component.
Found a problem?
If something on this page doesn't match what Cameleer does, or you hit a bug while building
with it, please help fix it, whether you are a person or a coding agent:
open an issue that describes what you saw,
then fork the repository, fix it, add or update a test, run cargo test --workspace, and open
a pull request. CONTRIBUTING.md
explains the ground rules.