<commit_before>= Camel Console

The `camel-console` is available from *Camel 3.15* and newer versions.

The Camel Developer Console is intended assisting developers and can display
various information about a running Camel application.

Camel comes with a set of consoles out of the box from `camel-console` and `camel-catalog-console` JARs.
These consoles can display general information about the running JVM and the OS Environment, and of course
Camel related information such as runtime metrics of the Camel routes, and a lot more.

== Using Camel Console

The `camel-console` must be added to the classpath, and enabled either via

[source,java]
----
CamelContext context = ...
context.setDevConsole(true);
----

If using Camel Main / Spring Boot / Quarkus etc then the console can be enabled via
configuration:

[source,properties]
----
camel.main.dev-console-enabled = true
----

=== Dev Console and Camel JBang

The Developer Console is easily available when using xref:camel-jbang.adoc[Camel JBang],
by the `--console` argument when running JBang.

For example to run a Camel route from `foo.yaml` and additional configurations from `myapp.properties` you can run as follows
and have the console started and accessible from `http://localhost:8080/dev`

[source,bash]
----
$ jbang camel@apache/camel run foo.yaml myapp.properties --console
----

== Writing Custom Dev Consoles

To write a custom console, you need to add `camel-console` as dependency, as it comes with the
base class `AbstractDevConsole` which we extend for our console.

[source,java]
----
@DevConsole("foo")
public class FooConsole extends AbstractDevConsole {

    public FooConsole() {
        super("acme", "foo", "Foolish", "A foolish console that outputs something");
    }

    @Override<commit_msg>CAMEL-18149: camel-spring-boot - Add camel developer console as actuator that can be enabled.<commit_after>= Camel Console

The `camel-console` is available from *Camel 3.15* and newer versions.

The Camel Developer Console is intended assisting developers and can display
various information about a running Camel application.

Camel comes with a set of consoles out of the box from `camel-console` and `camel-catalog-console` JARs.
These consoles can display general information about the running JVM and the OS Environment, and of course
Camel related information such as runtime metrics of the Camel routes, and a lot more.

== Using Camel Console

The `camel-console` must be added to the classpath, and enabled either via

[source,java]
----
CamelContext context = ...
context.setDevConsole(true);
----

If using Camel Main / Spring Boot / Quarkus etc then the console can be enabled via
configuration:

[source,properties]
----
camel.main.dev-console-enabled = true
----

=== Using Dev Console in Camel Spring Boot

The Camel developer console is available in Spring Boot as an _actuator_. To enable the console
you need to add dependency:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-console-starter</artifactId>
</dependency>
----

To include more details such as route metrics you need to include JMX management:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-management-starter</artifactId>
</dependency>
----

And finally you **must** enable `camel` in the exposed list of HTTP actuator endpoints in `application.properties` as shown:

[source,properties]
----
management.endpoints.web.exposure.include=info,health,camel
----

The console is then available on HTTP (using default port):

[source,text]
----
http://localhost:8080/actuator/camel
----

This will list the available consoles, and you can then call a console by its id, such as `routes`:

[source,text]
----
http://localhost:8080/actuator/camel/routes
----


=== Dev Console and Camel JBang

The Developer Console is easily available when using xref:camel-jbang.adoc[Camel JBang],
by the `--console` argument when running JBang.

For example to run a Camel route from `foo.yaml` and additional configurations from `myapp.properties` you can run as follows
and have the console started and accessible from `http://localhost:8080/dev`

[source,bash]
----
$ jbang camel@apache/camel run foo.yaml myapp.properties --console
----

== Writing Custom Dev Consoles

To write a custom console, you need to add `camel-console` as dependency, as it comes with the
base class `AbstractDevConsole` which we extend for our console.

[source,java]
----
@DevConsole("foo")
public class FooConsole extends AbstractDevConsole {

    public FooConsole() {
        super("acme", "foo", "Foolish", "A foolish console that outputs something");
    }

    @Override
{'fraction_non_alphanumeric': 0.0960559796437659, 'fraction_numerical': 0.0057251908396946565, 'mean_word_length': 4.132752992383025, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1082614', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1294, 'n_words': 561}