...
Tip |
title |
Configuring route options |
|
In the embedded route you can configure the route settings such as routeId, autoStartup and various other options you can set on routes today. .get().route().routeId("myRestRoute").autoStartup(false).transform().constant("Hello World"); |
Managing Rest services
Each of the rest service becomes a Camel route, so in the first example we have 2 x get and 1 x post REST service, which each become a Camel route. This makes it the same from Camel to manage and run these services - as they are just Camel routes. This means any tooling and API today that deals with Camel routes, also work with the REST services.
This means you can use JMX to stop/start routes, and also get the JMX metrics about the routes, such as number of message processed, and their performance statistics.
There is also a Rest Registry JMX MBean that contains a registry of all REST services which has been defined.
Binding to POJOs using
The Rest DSL supports automatic binding json/xml contents to/from POJOs using Camels Data Format. By default the binding mode is off, meaning there is no automatic binding happening for incoming and outgoing messages.
...
Option |
Default |
Description |
component |
|
The Camel Rest component to use for the REST transport, such as restlet, spark-rest. If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry. If either one is found, then that is being used. |
scheme |
http |
The scheme to use for exposing the REST service. Usually http or https is supported |
hostname |
0.0.0.0 |
The hostname to use for exposing the REST service. |
port |
|
The port number to use for exposing the REST service. |
restHostNameResolver |
localHostName |
If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using. The resolver supports localHostName or localIp . |
bindingMode |
off |
Whether binding is in use. See further above for more details. |
jsonDataFormat |
|
Name of specific json data format to use. By default json-jackson will be used. Notice: Currently Jackson is what we recommend and are using for testing. |
xmlDataFormat |
|
Name of specific XML data format to use. By default jaxb will be used. Notice: Currently only jaxb is supported. |
componentProperty |
|
Allows to configure as many additional properties. This is used to configure component specific options such as for Restlet / Spark-Rest etc. |
endpointProperty |
|
Allows to configure as many additional properties. This is used to configure endpoint specific options for Restlet / Spark-Rest etc. |
consumerProperty |
|
Allows to configure as many additional properties. This is used to configure consumer specific options for Restlet / Spark-Rest etc. |
dataFormatProperty |
|
Allows to configure as many additional properties. This is used to configure the data format specific options. For example set property prettyPrint to true to have json outputted in pretty mode. |
...