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 early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
ServiceCall EIPAvailable as of Camel 2.18 The Maven users will need to add the dependency for the service registry supported from the following:
Each implementation has their own set of configuration. SyntaxWhen calling a service you may just refer to the name of the service in the EIP as shown below: from("direct:start") .serviceCall("foo") .to("mock:result"); And in XML DSL: <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:start"/> <serviceCall name="foo"/> <to uri="mock:result"/> </route> </camelContext> Camel will then lookup a service with the name By default Camel uses the HTTP component, so the example above will resolve into a Camel URI that is called by a dynamic toD("http://IP:PORT") <toD uri="http:IP:port"/> You can also call the service using URI parameters such as serviceCall("foo?beer=yes") <serviceCall name="foo?beer=yes"/> You can also provide a context-path such as shown: serviceCall("foo/beverage?beer=yes") <serviceCall name="foo/beverage?beer=yes"/> Service Name to Camel URI ExamplesSo as you can see above the service name is resolved as a Camel endpoint URI, and here is a few more examples (where serviceCall("myService") -> http://hostname:port serviceCall("myService/foo") -> http://hostname:port/foo serviceCall("http:myService/foo") -> http:hostname:port/foo <serviceCall name="myService"/> -> http://hostname:port <serviceCall name="myService/foo"/> -> http://hostname:port/foo <serviceCall name="http:myService/foo"/> -> http:hostname:port/foo If you want full control of the resolved URI you can provide an additional URI parameter where you specify the Camel URI as you want. In the URI you can use the service name which are then resolved to serviceCall("myService", "http:myService.host:myService.port/foo") -> http:hostname:port/foo serviceCall("myService", "netty4:tcp:myService?connectTimeout=1000") -> netty:tcp:hostname:port?connectTimeout=1000 <serviceCall name="myService" uri="http:myService.host:myService.port/foo"/> -> http:hostname:port/foo <serviceCall name="myService" uri="netty4:tcp:myService?connectTimeout=1000"/> -> netty:tcp:hostname:port?connectTimeout=1000 In the example above we want to call a service named Configuring Service CallBy default Camel will call the service using the HTTP component, but you can configure to use a different component such as HTTP4, Netty4 HTTP as shown: KubernetesConfigurationDefinition config = new KubernetesConfigurationDefinition(); config.setComponent("netty4-http"); // register the service call configuration context.setServiceCallConfiguration(config); from("direct:start") .serviceCall("foo") .to("mock:result"); In XML DSL: <camelContext xmlns="http://camel.apache.org/schema/spring"> <kubernetesConfiguration id="kubernetes" component="netty4-http"/> <route> <from uri="direct:start"/> <serviceCall name="foo"/> <to uri="mock:result"/> </route> </camelContext> Common ConfigurationThese are the common configuration that each implementation is sharing.
Kubernetes Configuration
Ribbon ConfigurationCurrently no ribbon specific options yet. |