REST API Component

Available as of Camel version 2.16

The REST API component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.

URI Options

The REST API component supports 1 options, which are listed below.

Name Description Default Type

basicPropertyBinding (advanced)

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

boolean

The REST API endpoint is configured using URI syntax:

rest-api:path/contextIdPattern

with the following path and query parameters:

Path Parameters (2 parameters):

Name Description Default Type

path

Required The base path

String

contextIdPattern

Optional CamelContext id pattern to only allow Rest APIs from rest services within CamelContext’s which name matches the pattern.

String

Query Parameters (7 parameters):

Name Description Default Type

apiComponentName (consumer)

The Camel Rest API component to use for generating the API of the REST services, such as swagger.

String

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

consumerComponentName (consumer)

The Camel Rest component to use for (consumer) the REST transport, such as jetty, servlet, undertow. 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.

String

exceptionHandler (consumer)

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

ExceptionHandler

exchangePattern (consumer)

Sets the exchange pattern when the consumer creates an exchange.

ExchangePattern

basicPropertyBinding (advanced)

Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

boolean

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

Spring Boot Auto-Configuration

When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-rest-starter</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>

The component supports 2 options, which are listed below.

Name Description Default Type

camel.component.rest-api.basic-property-binding

Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

Boolean

camel.component.rest-api.enabled

Whether to enable auto configuration of the rest-api component. This is enabled by default.

Boolean