Camel Spring Boot

Cli Connector

Spring Boot auto-configuration for the Camel CLI connector.

The connector lets developer tools manage a running Spring Boot application: the Camel CLI (camel get, camel trace, camel stop, …​) through files in ~/.camel, or a tool such as an IDE over a WebSocket the application dials out to.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-cli-connector-starter</artifactId>
</dependency>

Usage

Adding this starter to the classpath enables the connector with the file transport, used by the Camel CLI. It can be turned off with:

camel.cli.enabled = false

The stop action of the tooling (for example camel stop) closes the Spring application context, so the application exits.

WebSocket transport

With camel.cli.transport = websocket, the application connects to the tool at camel.cli.websocket.url. See the CLI Connector documentation of Camel for the protocol and the security rules: the tool gets full control of the application, so the transport is for development only. Set it in a development profile, for example in application-dev.properties:

camel.cli.transport = websocket
camel.cli.websocket.url = ws://127.0.0.1:8000/connect

The transport refuses to start when the Spring prod profile is active, as with the Camel prod profile (camel.main.profile = prod).

The WebSocket client of Spring is used when the application has spring-websocket and a Jakarta WebSocket client, for example with spring-boot-starter-websocket. Otherwise, the JDK client is used: the starter does not add any dependency for it. The log, and the transport field of the hello frame sent to the tool, say which client is used (spring or jdk). Set camel.cli.websocket.client = jdk to always use the JDK client.

For a wss:// URL, the Spring client can trust the tool with an SSL bundle:

spring.ssl.bundle.pem.tool.truststore.certificate = classpath:tool.crt
camel.cli.websocket.url = wss://tool.example.com/connect
camel.cli.websocket.token = ${TOOL_TOKEN}
camel.cli.websocket.ssl-bundle = tool

Spring Boot Auto-Configuration

The starter supports 11 options, which are listed below.

Name Description Default Type

camel.cli.enabled

Whether CLI connector is enabled.

true

Boolean

camel.cli.transport

How the connector talks to the tooling: file (exchanges files in ~/.camel with the Camel CLI) or websocket (dials out to a developer tool over a WebSocket, see camel.cli.websocket).

file

String

camel.cli.websocket.allow-insecure

Allow ws:// (unencrypted) to a host that is not a loopback address. Prefer wss:// or a tunnel.

false

Boolean

camel.cli.websocket.client

The WebSocket client: auto uses the Spring WebSocket client when the application has spring-websocket and a Jakarta WebSocket implementation (such as with spring-boot-starter-websocket), otherwise the JDK client; jdk always uses the JDK client.

auto

String

camel.cli.websocket.heartbeat-interval

How often the connection is checked with a ping, in millis. The connection is re-established when the tool does not answer for three intervals.

10000

Long

camel.cli.websocket.reconnect-delay

Delay before reconnecting, in millis. It doubles after each failed attempt (with some random jitter).

1000

Long

camel.cli.websocket.reconnect-max-delay

Maximum delay before reconnecting, in millis.

30000

Long

camel.cli.websocket.snapshot-interval

How often snapshots are sent, in millis.

1000

Long

camel.cli.websocket.ssl-bundle

The name of an SSL bundle (spring.ssl.bundle) to trust the tool with wss:// when using the Spring WebSocket client.

String

camel.cli.websocket.token

Sent as Authorization: Bearer token when connecting. Required unless the URL is a loopback address. Prefer the CAMEL_CLI_WEBSOCKET_TOKEN environment variable to keep it out of the process list.

String

camel.cli.websocket.url

The ws:// or wss:// URL of the tool. Required when camel.cli.transport=websocket.

String