Chapter 2. Camel Quarkus extensions reference


This chapter provides usage information for Red Hat build of Apache Camel for Quarkus.

2.1. AMQP

Messaging with AMQP protocol using Apache QPid Client.

2.1.1. What’s inside

Refer to the above link for usage and configuration details.

2.1.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-amqp</artifactId>
</dependency>

2.1.3. Usage

2.1.3.1. Message mapping with org.w3c.dom.Node

The Camel AMQP component supports message mapping between jakarta.jms.Message and org.apache.camel.Message. When wanting to convert a Camel message body type of org.w3c.dom.Node, you must ensure that the camel-quarkus-xml-jaxp extension is present on the classpath.

2.1.3.2. Native mode support for jakarta.jms.ObjectMessage

When sending JMS message payloads as jakarta.jms.ObjectMessage, you must annotate the relevant classes to be registered for serialization with @RegisterForReflection(serialization = true). Note that this extension automatically sets quarkus.camel.native.reflection.serialization-enabled = true for you. Refer to the native mode user guide for more information.

2.1.3.3. Connection Pooling

You can use the quarkus-pooled-jms extension to get pooling support for the connections. Refer to the quarkus-pooled-jms extension documentation for more information.

Just add the following dependency to your pom.xml:

<dependency>
    <groupId>io.quarkiverse.messaginghub</groupId>
    <artifactId>quarkus-pooled-jms</artifactId>
</dependency>

To enable the pooling support, you need to add the following configuration to your application.properties:

quarkus.qpid-jms.wrap=true

2.1.4. transferException option in native mode

To use the transferException option in native mode, you must enable support for object serialization. Refer to the native mode user guide for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.

@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)

2.1.5. Additional Camel Quarkus configuration

The extension leverages the Quarkus Qpid JMS extension. A ConnectionFactory bean is automatically created and wired into the AMQP component for you. The connection factory can be configured via the Quarkus Qpid JMS configuration options.

2.2. Attachments

Support for attachments on Camel messages

2.2.1. What’s inside

Refer to the above link for usage and configuration details.

2.2.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-attachments</artifactId>
</dependency>

2.3. Avro

Serialize and deserialize messages using Apache Avro binary data format.

2.3.1. What’s inside

Refer to the above link for usage and configuration details.

2.3.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-avro</artifactId>
</dependency>

2.3.3. Additional Camel Quarkus configuration

Beyond standard usages known from vanilla Camel, Camel Quarkus adds the possibility to parse the Avro schema at build time both in JVM and Native mode.

The approach to generate Avro classes from Avro schema files is the one coined by the quarkus-avro extension. It requires the following:

  1. Store *.avsc files in a folder named src/main/avro or src/test/avro
  2. In addition to the usual build goal of quarkus-maven-plugin, add the generate-code goal:

    <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
            <execution>
                <id>generate-code-and-build</id>
                <goals>
                    <goal>generate-code</goal>
                    <goal>build</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

See a working configuration in Camel Quarkus Avro integration test and Quarkus Avro integration test.

2.4. AWS 2 CloudWatch

Sending metrics to AWS CloudWatch.

2.4.1. What’s inside

Refer to the above link for usage and configuration details.

2.4.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-cw</artifactId>
</dependency>

2.4.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.5. AWS 2 DynamoDB

Store and retrieve data from AWS DynamoDB service or receive messages from AWS DynamoDB Stream using AWS SDK version 2.x.

2.5.1. What’s inside

Refer to the above links for usage and configuration details.

2.5.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-ddb</artifactId>
</dependency>

2.5.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.5.4. Additional Camel Quarkus configuration

2.5.4.1. Optional integration with Quarkus Amazon DynamoDB

If desired, it is possible to use the Quarkus Amazon DynamoDB extension in conjunction with Camel Quarkus AWS 2 DynamoDB. Note that this is fully optional and not mandatory at all. Follow the Quarkus documentation but beware of the following caveats:

  1. The client type apache has to be selected by configuring the following property:

    quarkus.dynamodb.sync-client.type=apache
  2. The DynamoDbClient has to be made "unremovable" in the sense of Quarkus CDI reference so that Camel Quarkus is able to look it up at runtime. You can reach that e.g. by adding a dummy bean injecting DynamoDbClient:

    import jakarta.enterprise.context.ApplicationScoped;
    import io.quarkus.arc.Unremovable;
    import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
    
    @ApplicationScoped
    @Unremovable
    class UnremovableDynamoDbClient {
        @Inject
        DynamoDbClient dynamoDbClient;
    }

2.6. AWS 2 Kinesis

Consume and produce records from AWS Kinesis Streams using AWS SDK version 2.x.

2.6.1. What’s inside

Refer to the above links for usage and configuration details.

2.6.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-kinesis</artifactId>
</dependency>

2.6.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.7. AWS 2 Lambda

Manage and invoke AWS Lambda functions using AWS SDK version 2.x.

2.7.1. What’s inside

Refer to the above link for usage and configuration details.

2.7.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-lambda</artifactId>
</dependency>

2.7.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.7.4. Additional Camel Quarkus configuration

2.7.4.1. Not possible to leverage quarkus-amazon-lambda by Camel aws2-lambda extension

Quarkus-amazon-lambda extension allows you to use Quarkus to build your AWS Lambdas, whereas Camel component manages (deploy, undeploy, …​) existing functions. Therefore, it is not possible to use quarkus-amazon-lambda as a client for Camel aws2-lambda extension.

2.8. AWS 2 S3 Storage Service

Store and retrieve objects from AWS S3 Storage Service.

2.8.1. What’s inside

Refer to the above link for usage and configuration details.

2.8.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-s3</artifactId>
</dependency>

2.8.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.8.4. Additional Camel Quarkus configuration

2.8.4.1. Optional integration with Quarkus Amazon S3

If desired, it is possible to use the Quarkus Amazon S3 extension in conjunction with Camel Quarkus AWS 2 S3 Storage Service. Note that this is fully optional and not mandatory at all. Follow the Quarkus documentation but beware of the following caveats:

  1. The client type apache has to be selected by configuring the following property:

    quarkus.s3.sync-client.type=apache
  2. The S3Client has to be made "unremovable" in the sense of Quarkus CDI reference so that Camel Quarkus is able to look it up at runtime. You can reach that e.g. by adding a dummy bean injecting S3Client:

    import jakarta.enterprise.context.ApplicationScoped;
    import io.quarkus.arc.Unremovable;
    import software.amazon.awssdk.services.s3.S3Client;
    
    @ApplicationScoped
    @Unremovable
    class UnremovableS3Client {
        @Inject
        S3Client s3Client;
    }

2.9. AWS 2 Simple Notification System (SNS)

Send messages to AWS Simple Notification Topic.

2.9.1. What’s inside

Refer to the above link for usage and configuration details.

2.9.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-sns</artifactId>
</dependency>

2.9.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.9.4. Additional Camel Quarkus configuration

2.9.4.1. Optional integration with Quarkus Amazon SNS

If desired, it is possible to use the Quarkus Amazon SNS extension in conjunction with Camel Quarkus AWS 2 Simple Notification System (SNS). Note that this is fully optional and not mandatory at all. Follow the Quarkus documentation but beware of the following caveats:

  1. The client type apache has to be selected by configuring the following property:

    quarkus.sns.sync-client.type=apache
  2. The SnsClient has to be made "unremovable" in the sense of Quarkus CDI reference so that Camel Quarkus is able to look it up at runtime. You can reach that e.g. by adding a dummy bean injecting SnsClient:

    import jakarta.enterprise.context.ApplicationScoped;
    import io.quarkus.arc.Unremovable;
    import software.amazon.awssdk.services.sns.SnsClient;
    
    @ApplicationScoped
    @Unremovable
    class UnremovableSnsClient {
        @Inject
        SnsClient snsClient;
    }

2.10. AWS 2 Simple Queue Service (SQS)

Send and receive messages to/from AWS SQS.

2.10.1. What’s inside

Refer to the above link for usage and configuration details.

2.10.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws2-sqs</artifactId>
</dependency>

2.10.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.10.4. Additional Camel Quarkus configuration

2.10.4.1. Optional integration with Quarkus Amazon SQS

If desired, it is possible to use the Quarkus Amazon SQS extension in conjunction with Camel Quarkus AWS 2 Simple Queue Service (SQS). Note that this is fully optional and not mandatory at all. Follow the Quarkus documentation but beware of the following caveats:

  1. The client type apache has to be selected by configuring the following property:

    quarkus.sqs.sync-client.type=apache
  2. The SqsClient has to be made "unremovable" in the sense of Quarkus CDI reference so that Camel Quarkus is able to look it up at runtime. You can reach that e.g. by adding a dummy bean injecting SqsClient:

    import jakarta.enterprise.context.ApplicationScoped;
    import io.quarkus.arc.Unremovable;
    import software.amazon.awssdk.services.sqs.SqsClient;
    
    @ApplicationScoped
    @Unremovable
    class UnremovableSqsClient {
        @Inject
        SqsClient sqsClient;
    }

2.11. Azure Event Hubs

The azure-eventhubs component that integrates Azure Event Hubs using AMQP protocol. Azure EventHubs is a highly scalable publish-subscribe service that can ingest millions of events per second and stream them to multiple consumers.

2.11.1. What’s inside

Refer to the above link for usage and configuration details.

2.11.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-azure-eventhubs</artifactId>
</dependency>

2.11.3. Usage

2.11.3.1. Micrometer metrics support

If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on quarkus-micrometer to ensure that they are available via the Quarkus metrics HTTP endpoint.

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-micrometer</artifactId>
</dependency>

2.11.4. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.12. Azure Key Vault

Manage secrets and keys in Azure Key Vault Service

2.12.1. What’s inside

Refer to the above link for usage and configuration details.

2.12.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-azure-key-vault</artifactId>
</dependency>

2.12.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.13. Azure ServiceBus

Send and receive messages to/from Azure Event Bus.

2.13.1. What’s inside

Refer to the above link for usage and configuration details.

2.13.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-azure-servicebus</artifactId>
</dependency>

2.14. Azure Storage Blob Service

Store and retrieve blobs from Azure Storage Blob Service using SDK v12.

2.14.1. What’s inside

Refer to the above link for usage and configuration details.

2.14.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-azure-storage-blob</artifactId>
</dependency>

2.14.3. Usage

2.14.3.1. Micrometer metrics support

If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on quarkus-micrometer to ensure that they are available via the Quarkus metrics HTTP endpoint.

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-micrometer</artifactId>
</dependency>

2.14.4. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.15. Azure Storage Queue Service

The azure-storage-queue component is used for storing and retrieving the messages to/from Azure Storage Queue using Azure SDK v12.

2.15.1. What’s inside

Refer to the above link for usage and configuration details.

2.15.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-azure-storage-queue</artifactId>
</dependency>

2.15.3. Usage

2.15.3.1. Micrometer metrics support

If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on quarkus-micrometer to ensure that they are available via the Quarkus metrics HTTP endpoint.

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-micrometer</artifactId>
</dependency>

2.15.4. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.16. Bean Validator

Validate the message body using the Java Bean Validation API.

2.16.1. What’s inside

Refer to the above link for usage and configuration details.

2.16.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean-validator</artifactId>
</dependency>

2.16.3. Usage

2.16.3.1. Configuring the ValidatorFactory

Implementation of this extension leverages the Quarkus Hibernate Validator extension.

Therefore it is not possible to configure the ValidatorFactory by Camel’s properties (constraintValidatorFactory, messageInterpolator, traversableResolver, validationProviderResolver and validatorFactory).

You can configure the ValidatorFactory by the creation of beans which will be injected into the default ValidatorFactory (created by Quarkus). See the Quarkus CDI documentation for more information.

2.16.3.2. Custom validation groups in native mode

When using custom validation groups in native mode, all the interfaces need to be registered for reflection (see the documentation).

Example:

@RegisterForReflection
public interface OptionalChecks {
}

2.16.4. Camel Quarkus limitations

It is not possible to describe your constraints as XML (by providing the file META-INF/validation.xml), only Java annotations are supported. This is caused by the limitation of the Quarkus Hibernate Validator extension (see the issue).

2.17. Bean

Invoke methods of Java beans

2.17.1. What’s inside

Refer to the above links for usage and configuration details.

2.17.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean</artifactId>
</dependency>

2.17.3. Usage

Except for invoking methods of beans available in Camel registry, Bean component and Bean method language can also invoke Quarkus CDI beans. For more details, Refer to the CDI and the Camel Bean component section of the User guide.

2.18. BeanIO

Marshal and unmarshal Java beans to and from flat files (such as CSV, delimited, or fixed length formats).

2.18.1. What’s inside

Refer to the above link for usage and configuration details.

2.18.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-beanio</artifactId>
</dependency>

2.19. Bindy

Marshal and unmarshal between POJOs on one side and Comma separated values (CSV), fixed field length or key-value pair (KVP) formats on the other side using Camel Bindy

2.19.1. What’s inside

Refer to the above links for usage and configuration details.

2.19.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bindy</artifactId>
</dependency>

2.19.3. Camel Quarkus limitations

When using camel-quarkus-bindy in native mode, only the build machine’s locale is supported.

For instance, on build machines with french locale, the code below:

BindyDataFormat dataFormat = new BindyDataFormat();
dataFormat.setLocale("ar");

formats numbers the arabic way in JVM mode as expected. However, it formats numbers the french way in native mode.

Without further tuning, the build machine’s default locale would be used. Another locale could be specified with the quarkus.native.user-language and quarkus.native.user-country configuration properties.

2.20. Browse

Inspect the messages received on endpoints supporting BrowsableEndpoint.

2.20.1. What’s inside

Refer to the above link for usage and configuration details.

2.20.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-browse</artifactId>
</dependency>

2.21. Cassandra CQL

Integrate with Cassandra 2.0 using the CQL3 API (not the Thrift API). Based on Cassandra Java Driver provided by DataStax.

2.21.1. What’s inside

Refer to the above link for usage and configuration details.

2.21.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-cassandraql</artifactId>
</dependency>

2.21.3. Additional Camel Quarkus configuration

2.21.3.1. Cassandra aggregation repository in native mode

In order to use Cassandra aggregation repositories like CassandraAggregationRepository in native mode, you must enable native serialization support.

In addition, if your exchange bodies are custom types, then they must be registered for serialization by annotating their class declaration with @RegisterForReflection(serialization = true).

2.22. CLI Connector

Runtime adapter connecting with Camel CLI

2.22.1. What’s inside

Refer to the above link for usage and configuration details.

2.22.2. Maven coordinates

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

2.22.3. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.cli.enabled

Sets whether to enable Camel CLI Connector support.

boolean

true

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.23. Control Bus

Manage and monitor Camel routes.

2.23.1. What’s inside

Refer to the above link for usage and configuration details.

2.23.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-controlbus</artifactId>
</dependency>

2.23.3. Usage

2.23.3.1. Statistics

When using the stats command endpoint, the camel-quarkus-management extension must be added as a project dependency to enable JMX. Maven users will have to add the following to their pom.xml:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-management</artifactId>
</dependency>

2.23.3.2. Languages

The following languages are supported for use in the Control Bus extension in Red Hat build of Apache Camel for Quarkus:

2.23.3.2.1. Bean

The Bean language can be used to invoke a method on a bean to control the state of routes. The org.apache.camel.quarkus:camel-quarkus-bean extension must be added to the classpath. Maven users must add the following dependency to the POM:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-bean</artifactId>
</dependency>

In native mode, the bean class must be annotated with @RegisterForReflection.

2.23.3.2.2. Simple

The Simple language can be used to control the state of routes. The following example uses a ProducerTemplate to stop a route with the id foo:

template.sendBody(
    "controlbus:language:simple",
    "${camelContext.getRouteController().stopRoute('foo')}"
);

To use the OGNL notation, the org.apache.camel.quarkus:camel-quarkus-bean extension must be added as a dependency.

In native mode, the classes used in the OGNL notation must be registered for reflection. In the above code snippet, the org.apache.camel.spi.RouteController class returned from camelContext.getRouteController() must be registered. As this is a third-party class, it cannot be annotated with @RegisterForReflection directly - instead you can annotate a different class and specifying the target classes to register. For example, the class defining the Camel routes could be annotated with @RegisterForReflection(targets = { org.apache.camel.spi.RouteController.class }).

Alternatively, add the following line to your src/main/resources/application.properties:

quarkus.camel.native.reflection.include-patterns = org.apache.camel.spi.RouteController

2.23.4. Camel Quarkus limitations

2.23.4.1. Statistics

The stats action is not available in native mode as JMX is not supported on GraalVM. Therefore, attempting to build a native image with the camel-quarkus-management extension on the classpath will result in a build failure.

This feature is not supported in Red Hat build of Apache Camel for Quarkus.

2.24. Core

Camel core functionality and basic Camel languages: Constant, ExchangeProperty, Header, Ref, Simple and Tokenize

2.24.1. What’s inside

Refer to the above links for usage and configuration details.

2.24.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-core</artifactId>
</dependency>

2.24.3. Additional Camel Quarkus configuration

2.24.3.1. Simple language

2.24.3.1.1. Using the OGNL notation

When using the OGNL notation from the simple language, the camel-quarkus-bean extension should be used.

For instance, the simple expression below is accessing the getAddress() method on the message body of type Client.

---
simple("${body.address}")
---

In such a situation, one should take an additional dependency on the camel-quarkus-bean extension as described here. Note that in native mode, some classes may need to be registered for reflection. In the example above, the Client class needs to be registered for reflection.

2.24.3.1.2. Using dynamic type resolution in native mode

When dynamically resolving a type from simple expressions like:

  • simple("${mandatoryBodyAs(TYPE)}")
  • simple("${type:package.Enum.CONSTANT}")
  • from("…​").split(bodyAs(TYPE.class))
  • simple("${body} is TYPE")

It may be needed to register some classes for reflection manually.

For instance, the simple expression below is dynamically resolving the type java.nio.ByteBuffer at runtime:

---
simple("${body} is 'java.nio.ByteBuffer'")
---

As such, the class java.nio.ByteBuffer needs to be registered for reflection.

2.24.3.1.3. Using the simple language with classpath resources in native mode

If your route is supposed to load a Simple script from classpath, like in the following example

from("direct:start").transform().simple("resource:classpath:mysimple.txt");

then you need to use Quarkus quarkus.native.resources.includes property to include the resource in the native executable as demonstrated below:

quarkus.native.resources.includes = mysimple.txt

More information about selecting resources for inclusion in the native executable can be found at Embedding resource in native executable.

2.24.3.1.4. Configuring a custom bean via properties in native mode

When specifying a custom bean via properties in native mode with configuration like #class:* or #type:*, it may be needed to register some classes for reflection manually.

For instance, the custom bean definition below involves the use of reflection for bean instantiation and setter invocation:

---
camel.beans.customBeanWithSetterInjection = #class:org.example.PropertiesCustomBeanWithSetterInjection
camel.beans.customBeanWithSetterInjection.counter = 123
---

As such, the class PropertiesCustomBeanWithSetterInjection needs to be registered for reflection, note that field access could be omitted in this case.

Configuration propertyTypeDefault

quarkus.camel.bootstrap.enabled

When set to true, the CamelRuntime will be started automatically.

boolean

true

quarkus.camel.service.discovery.exclude-patterns

A comma-separated list of Ant-path style patterns to match Camel service definition files in the classpath. The services defined in the matching files will not be discoverable via the **org.apache.camel.spi.FactoryFinder mechanism.

The excludes have higher precedence than includes. The excludes defined here can also be used to veto the discoverability of services included by Camel Quarkus extensions.

Example values: META-INF/services/org/apache/camel/foo/*,META-INF/services/org/apache/camel/foo/**/bar

List of string

 

quarkus.camel.service.discovery.include-patterns

A comma-separated list of Ant-path style patterns to match Camel service definition files in the classpath. The services defined in the matching files will be discoverable via the org.apache.camel.spi.FactoryFinder mechanism unless the given file is excluded via exclude-patterns.

Note that Camel Quarkus extensions may include some services by default. The services selected here added to those services and the exclusions defined in exclude-patterns are applied to the union set.

Example values: META-INF/services/org/apache/camel/foo/*,META-INF/services/org/apache/camel/foo/**/bar

List of string

 

quarkus.camel.service.registry.exclude-patterns

A comma-separated list of Ant-path style patterns to match Camel service definition files in the classpath. The services defined in the matching files will not be added to Camel registry during application’s static initialization.

The excludes have higher precedence than includes. The excludes defined here can also be used to veto the registration of services included by Camel Quarkus extensions.

Example values: META-INF/services/org/apache/camel/foo/*,META-INF/services/org/apache/camel/foo/**/bar**

List of string

 

quarkus.camel.service.registry.include-patterns

A comma-separated list of Ant-path style patterns to match Camel service definition files in the classpath. The services defined in the matching files will be added to Camel registry during application’s static initialization unless the given file is excluded via exclude-patterns.

Note that Camel Quarkus extensions may include some services by default. The services selected here added to those services and the exclusions defined in exclude-patterns are applied to the union set.

Example values: META-INF/services/org/apache/camel/foo/*,META-INF/services/org/apache/camel/foo/**/bar

List of string

 

quarkus.camel.runtime-catalog.components

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel components available in the application; otherwise component JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.runtime-catalog.languages

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel languages available in the application; otherwise language JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.runtime-catalog.dataformats

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel data formats available in the application; otherwise data format JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.runtime-catalog.devconsoles

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel dev consoles available in the application; otherwise dev console JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.runtime-catalog.models

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel EIP models available in the application; otherwise EIP model JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.runtime-catalog.transformers

If true the Runtime Camel Catalog embedded in the application will contain JSON schemas of Camel transformers available in the application; otherwise transformer JSON schemas will not be available in the Runtime Camel Catalog and any attempt to access those will result in a RuntimeException.

Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to false except for making the behavior consistent with native mode.

boolean

true

quarkus.camel.routes-discovery.enabled

Enable automatic discovery of routes during static initialization.

boolean

true

quarkus.camel.routes-discovery.exclude-patterns

Used for exclusive filtering scanning of RouteBuilder classes. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma. For example to exclude all classes starting with Bar use: **/Bar* To exclude all routes form a specific package use: com/mycompany/bar/* To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/*

List of string

 

quarkus.camel.routes-discovery.include-patterns

Used for inclusive filtering scanning of RouteBuilder classes. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma. For example to include all classes starting with Foo use: **/Foo* To include all routes form a specific package use: com/mycompany/foo/* To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/*

List of string

 

quarkus.camel.native.reflection.exclude-patterns

A comma separated list of Ant-path style patterns to match class names that should be excluded from registering for reflection. Use the class name format as returned by the java.lang.Class.getName() method: package segments delimited by period . and inner classes by dollar sign $.

This option narrows down the set selected by include-patterns. By default, no classes are excluded.

This option cannot be used to unregister classes which have been registered internally by Quarkus extensions.

List of string

 

quarkus.camel.native.reflection.include-patterns

A comma separated list of Ant-path style patterns to match class names that should be registered for reflection. Use the class name format as returned by the java.lang.Class.getName() method: package segments delimited by period . and inner classes by dollar sign $.

By default, no classes are included. The set selected by this option can be narrowed down by exclude-patterns.

Note that Quarkus extensions typically register the required classes for reflection by themselves. This option is useful in situations when the built in functionality is not sufficient.

Note that this option enables the full reflective access for constructors, fields and methods. If you need a finer grained control, consider using io.quarkus.runtime.annotations.RegisterForReflection annotation in your Java code.

For this option to work properly, at least one of the following conditions must be satisfied:

- There are no wildcards (* or /) in the patterns - The artifacts containing the selected classes contain a Jandex index (META-INF/jandex.idx) - The artifacts containing the selected classes are registered for indexing using the quarkus.index-dependency.* family of options in application.properties - e.g.

` quarkus.index-dependency.my-dep.group-id = org.my-group quarkus.index-dependency.my-dep.artifact-id = my-artifact `

where my-dep is a label of your choice to tell Quarkus that org.my-group and with my-artifact belong together.

List of string

 

quarkus.camel.native.reflection.serialization-enabled

If true, basic classes are registered for serialization; otherwise basic classes won’t be registered automatically for serialization in native mode. The list of classes automatically registered for serialization can be found in CamelSerializationProcessor.BASE_SERIALIZATION_CLASSES. Setting this to false helps to reduce the size of the native image. In JVM mode, there is no real benefit of setting this flag to true except for making the behavior consistent with native mode.

boolean

false

quarkus.camel.csimple.on-build-time-analysis-failure

What to do if it is not possible to extract CSimple expressions from a route definition at build time.

fail, warn, ignore

warn

quarkus.camel.expression.on-build-time-analysis-failure

What to do if it is not possible to extract expressions from a route definition at build time.

fail, warn, ignore

warn

quarkus.camel.expression.extraction-enabled

Indicates whether the expression extraction from the route definitions at build time must be done. If disabled, the expressions are compiled at runtime.

boolean

true

quarkus.camel.event-bridge.enabled

Whether to enable the bridging of Camel events to CDI events.

This allows CDI observers to be configured for Camel events. E.g. those belonging to the org.apache.camel.quarkus.core.events, org.apache.camel.quarkus.main.events & org.apache.camel.impl.event packages.

Note that this configuration item only has any effect when observers configured for Camel events are present in the application.

boolean

true

quarkus.camel.source-location-enabled

Build time configuration options for enable/disable camel source location.

boolean

false

quarkus.camel.trace.enabled

Enables tracer in your Camel application.

boolean

false

quarkus.camel.trace.standby

To set the tracer in standby mode, where the tracer will be installed, but not automatically enabled. The tracer can then be enabled explicitly later from Java, JMX or tooling.

boolean

false

quarkus.camel.trace.backlog-size

Defines how many of the last messages to keep in the tracer.

int

1000

quarkus.camel.trace.remove-on-dump

Whether all traced messages should be removed when the tracer is dumping. By default, the messages are removed, which means that dumping will not contain previous dumped messages.

boolean

true

quarkus.camel.trace.body-max-chars

To limit the message body to a maximum size in the traced message. Use 0 or negative value to use unlimited size.

int

131072

quarkus.camel.trace.body-include-streams

Whether to include the message body of stream based messages. If enabled then beware the stream may not be re-readable later. See more about Stream Caching.

boolean

false

quarkus.camel.trace.body-include-files

Whether to include the message body of file based messages. The overhead is that the file content has to be read from the file.

boolean

true

quarkus.camel.trace.include-exchange-properties

Whether to include the exchange properties in the traced message.

boolean

true

quarkus.camel.trace.include-exchange-variables

Whether to include the exchange variables in the traced message.

boolean

true

quarkus.camel.trace.include-exception

Whether to include the exception in the traced message in case of failed exchange.

boolean

true

quarkus.camel.trace.trace-rests

Whether to trace routes that is created from Rest DSL.

boolean

false

quarkus.camel.trace.trace-templates

Whether to trace routes that is created from route templates or kamelets.

boolean

false

quarkus.camel.trace.trace-pattern

Filter for tracing by route or node id.

string

 

quarkus.camel.trace.trace-filter

Filter for tracing messages.

string

 

quarkus.camel.type-converter.statistics-enabled

Whether type converter statistics are enabled. By default, type converter utilization statistics are disabled. Note that enabling statistics incurs a minor performance impact under very heavy load.

boolean

false

quarkus.camel.main.shutdown.timeout

A timeout (with millisecond precision) to wait for CamelMain#stop() to finish

Duration image::icons/circle-question.svg[title=More information about the Duration format]

PT3S

quarkus.camel.main.arguments.on-unknown

The action to take when CamelMain encounters an unknown argument. fail - Prints the CamelMain usage statement and throws a RuntimeException ignore - Suppresses any warnings and the application startup proceeds as normal warn - Prints the CamelMain usage statement but allows the application startup to proceed as normal

fail, warn, ignore

warn

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

About the Duration format

To write duration values, use the standard java.time.Duration format. See the Duration#parse() Java API documentation for more information.

You can also use a simplified format, starting with a number:

  • If the value is only a number, it represents time in seconds.
  • If the value is a number followed by ms, it represents time in milliseconds.

In other cases, the simplified format is translated to the java.time.Duration format for parsing:

  • If the value is a number followed by h, m, or s, it is prefixed with PT.
  • If the value is a number followed by d, it is prefixed with P.

2.25. Cron

A generic interface for triggering events at times specified through the Unix cron syntax.

2.25.1. What’s inside

Refer to the above link for usage and configuration details.

2.25.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-cron</artifactId>
</dependency>

2.25.3. Additional Camel Quarkus configuration

The cron component is a generic interface component, as such Camel Quarkus users will need to use the cron extension together with another extension offering an implementation. For instance, one can use the Quartz Extension and cron extension together in its project.

2.26. Crypto (JCE)

Sign and verify exchanges using the Signature Service of the Java Cryptographic Extension (JCE).

2.26.1. What’s inside

Refer to the above links for usage and configuration details.

2.26.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-crypto</artifactId>
</dependency>

2.26.3. Usage

2.26.3.1. Security Provider

Extension requires BouncyCastle provider and also utilizes the quarkus security extension (see security providers registration doc) If there is no BC* provider registered (by quarkus.security.security-providers property). The BC provider is registered.

2.26.3.2. FIPS

When running the crypto extension on FIPS enabled system any FIPS-compliant Java Security Provider (such as BCFIPS) has to be used.

  • In the case of BCFIPS, add BCFIPS dependency and quarkus-security (see the guide for more information)
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bc-fips</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-security</artifactId>
</dependency>

and register BCFIPS provider with following proprerty:

quarkus.security.security-providers=BCFIPS
  • Alternatively, you can add different FIPS compliant provider. Make Sure that the provider is registered.

2.26.4. Camel Quarkus limitations

2.26.5. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.27. CXF

Expose SOAP WebServices using Apache CXF or connect to external WebServices using CXF WS client.

2.27.1. What’s inside

Refer to the above link for usage and configuration details.

2.27.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-cxf-soap</artifactId>
</dependency>

2.27.3. Usage

2.27.3.1. General

camel-quarkus-cxf-soap uses extensions from the CXF Extensions for Quarkus project - quarkus-cxf. This means the set of supported use cases and WS specifications is largely given by quarkus-cxf.

Important

To learn about supported use cases and WS specifications, see the Quarkus CXF Reference.

2.27.3.2. Dependency management

The CXF and quarkus-cxf versions are managed by {project-name}. You do not need select compatible versions for those projects.

2.27.3.3. Client

With camel-quarkus-cxf-soap (no additional dependencies required), you can use CXF clients as producers in Camel routes:

import org.apache.camel.builder.RouteBuilder;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.SessionScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Named;

@ApplicationScoped
public class CxfSoapClientRoutes extends RouteBuilder {

    @Override
    public void configure() {

        /* You can either configure the client inline */
        from("direct:cxfUriParamsClient")
                .to("cxf://http://localhost:8082/calculator-ws?wsdlURL=wsdl/CalculatorService.wsdl&dataFormat=POJO&serviceClass=org.foo.CalculatorService");

        /* Or you can use a named bean produced below by beanClient() method */
        from("direct:cxfBeanClient")
                .to("cxf:bean:beanClient?dataFormat=POJO");

    }

    @Produces
    @SessionScoped
    @Named
    CxfEndpoint beanClient() {
        final CxfEndpoint result = new CxfEndpoint();
        result.setServiceClass(CalculatorService.class);
        result.setAddress("http://localhost:8082/calculator-ws");
        result.setWsdlURL("wsdl/CalculatorService.wsdl"); // a resource in the class path
        return result;
    }
}

The CalculatorService may look like the following:

import jakarta.jws.WebMethod;
import jakarta.jws.WebService;

@WebService(targetNamespace = CalculatorService.TARGET_NS) 1
public interface CalculatorService {

    public static final String TARGET_NS = "http://acme.org/wscalculator/Calculator";

    @WebMethod 2
    public int add(int intA, int intB);

    @WebMethod 3
    public int subtract(int intA, int intB);

    @WebMethod 4
    public int divide(int intA, int intB);

    @WebMethod 5
    public int multiply(int intA, int intB);
}
1 2 3 4 5
NOTE: JAX-WS annotations are required. The Simple CXF Frontend is not supported. Complex parameter types require JAXB annotations to work in properly in native mode.
Tip

You can test this client application against the quay.io/l2x6/calculator-ws:1.2 container that implements this service endpoint interface:

docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.2
Note

quarkus-cxf supports injecting SOAP clients using @io.quarkiverse.cxf.annotation.CXFClient annotation. Refer to the SOAP Clients chapter of quarkus-cxf user guide for more details.

2.27.3.4. Server

With camel-quarkus-cxf-soap, you can expose SOAP endpoints as consumers in Camel routes. No additional dependencies are required for this use case.

import org.apache.camel.builder.RouteBuilder;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Named;

@ApplicationScoped
public class CxfSoapRoutes extends RouteBuilder {

    @Override
    public void configure() {
        /* A CXF Service configured through a CDI bean */
        from("cxf:bean:helloBeanEndpoint")
                .setBody().simple("Hello ${body} from CXF service");

        /* A CXF Service configured through Camel URI parameters */
        from("cxf:///hello-inline?wsdlURL=wsdl/HelloService.wsdl&serviceClass=org.foo.HelloService")
                        .setBody().simple("Hello ${body} from CXF service");
    }

    @Produces
    @ApplicationScoped
    @Named
    CxfEndpoint helloBeanEndpoint() {
        final CxfEndpoint result = new CxfEndpoint();
        result.setServiceClass(HelloService.class);
        result.setAddress("/hello-bean");
        result.setWsdlURL("wsdl/HelloService.wsdl");
        return result;
    }
}

The path under which these two services will be served depends on the value of quarkus.cxf.pathconfiguration property which can for example be set in application.properties:

application.properties

quarkus.cxf.path = /soap-services

With this configuration in place, our two services can be reached under http://localhost:8080/soap-services/hello-bean and http://localhost:8080/soap-services/hello-inline respectively.

The WSDL can be accessed by adding ?wsdl to the above URLs.

Important

Do not use quarkus.cxf.path = / in your application unless you are 100% sure that no other extension will want to expose HTTP endpoints.

Before quarkus-cxf 2.0.0 (i.e. before {project-name} 3.0.0), the default value of quarkus.cxf.path was /. The default was changed because it prevented other Quarkus extensions from exposing any further HTTP endpoints. Among others, RESTEasy, Vert.x, SmallRye Health (no health endpoints exposed!) were impacted by this.

Note

quarkus-cxf supports alternative ways of exposing SOAP endpoints. Refer to the SOAP Services chapter of quarkus-cxf user guide for more details.

2.27.3.5. Logging of requests and responses

You can enable verbose logging of SOAP messages for both clients and servers with org.apache.cxf.ext.logging.LoggingFeature:

import org.apache.camel.builder.RouteBuilder;
import org.apache.cxf.ext.logging.LoggingFeature;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.SessionScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Named;

@ApplicationScoped
public class MyBeans {

    @Produces
    @ApplicationScoped
    @Named("prettyLoggingFeature")
    public LoggingFeature prettyLoggingFeature() {
        final LoggingFeature result = new LoggingFeature();
        result.setPrettyLogging(true);
        return result;
    }

    @Inject
    @Named("prettyLoggingFeature")
    LoggingFeature prettyLoggingFeature;

    @Produces
    @SessionScoped
    @Named
    CxfEndpoint cxfBeanClient() {
        final CxfEndpoint result = new CxfEndpoint();
        result.setServiceClass(CalculatorService.class);
        result.setAddress("https://acme.org/calculator");
        result.setWsdlURL("wsdl/CalculatorService.wsdl");
        result.getFeatures().add(prettyLoggingFeature);
        return result;
    }

    @Produces
    @ApplicationScoped
    @Named
    CxfEndpoint helloBeanEndpoint() {
        final CxfEndpoint result = new CxfEndpoint();
        result.setServiceClass(HelloService.class);
        result.setAddress("/hello-bean");
        result.setWsdlURL("wsdl/HelloService.wsdl");
        result.getFeatures().add(prettyLoggingFeature);
        return result;
    }
}
Note

The support for org.apache.cxf.ext.logging.LoggingFeature is provided by io.quarkiverse.cxf:quarkus-cxf-rt-features-logging as a camel-quarkus-cxf-soap dependency. You do not need to add it explicitly to your application.

2.27.3.6. WS Specifications

The extent of supported WS specifications is given by the Quarkus CXF project.

camel-quarkus-cxf-soap covers only the following specifications via the io.quarkiverse.cxf:quarkus-cxf extension:

  • JAX-WS
  • JAXB
  • WS-Addressing
  • WS-Policy
  • MTOM

If your application requires some other WS specification, such as WS-Security or WS-Trust, you must add an additional Quarkus CXF dependency covering it. Refer to Quarkus CXF Reference page to see which WS specifications are covered by which Quarkus CXF extensions.

Tip

Both {project-name} and Quarkus CXF contain a number of integration tests which can serve as executable examples of applications that implement various WS specifications.

2.27.3.7. Tooling

quarkus-cxf wraps the following two CXF tools:

Important

For wsdl2Java to work properly, your application will have to directly depend on io.quarkiverse.cxf:quarkus-cxf.

Tip

While wsdlvalidator is not supported, you can use wsdl2Java with the following configuration in application.properties to validate your WSDLs:

application.properties

quarkus.cxf.codegen.wsdl2java.additional-params = -validate

2.27.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.cxf.class-generation.exclude-patterns

For CXF service interfaces to work properly, some ancillary classes (such as request and response wrappers) need to be generated at build time. Camel Quarkus lets the quarkus-cxf extension to do this for all service interfaces found in the class path except the ones matching the patterns in this property.

org.apache.cxf.ws.security.sts.provider.SecurityTokenService is excluded by default due to https://issues.apache.org/jira/browse/CXF-8834

List of string

org.apache.cxf.ws.security.sts.provider.SecurityTokenService

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.28. Data Format

Use a Camel Data Format as a regular Camel Component. For more details of the supported data formats in {project-name}, see Supported Data Formats.

2.28.1. What’s inside

Refer to the above link for usage and configuration details.

2.28.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-dataformat</artifactId>
</dependency>

2.29. Dataset

Provide data for load and soak testing of your Camel application.

2.29.1. What’s inside

Refer to the above links for usage and configuration details.

2.29.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-dataset</artifactId>
</dependency>

2.30. Direct

Call another endpoint from the same Camel Context synchronously.

2.30.1. What’s inside

Refer to the above link for usage and configuration details.

2.30.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-direct</artifactId>
</dependency>

2.31. Elasticsearch

Send requests to ElasticSearch via Java Client API.

2.31.1. What’s inside

Refer to the above link for usage and configuration details.

2.31.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-elasticsearch</artifactId>
</dependency>

2.32. Elasticsearch Low level Rest Client

Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client).

2.32.1. What’s inside

Refer to the above link for usage and configuration details.

2.32.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-elasticsearch-rest-client</artifactId>
</dependency>

2.33. FHIR

Exchange information in the healthcare domain using the FHIR (Fast Healthcare Interoperability Resources) standard. Marshall and unmarshall FHIR objects to/from JSON. Marshall and unmarshall FHIR objects to/from XML.

2.33.1. What’s inside

Refer to the above links for usage and configuration details.

2.33.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-fhir</artifactId>
</dependency>

2.33.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.33.4. Additional Camel Quarkus configuration

By default, only FHIR versions R4 & DSTU3 are enabled in native mode, since they are the default values on the FHIR component and DataFormat.

Configuration propertyTypeDefault

quarkus.camel.fhir.enable-dstu2

Enable FHIR DSTU2 Specs in native mode.

boolean

false

quarkus.camel.fhir.enable-dstu2_hl7org

Enable FHIR DSTU2_HL7ORG Specs in native mode.

boolean

false

quarkus.camel.fhir.enable-dstu2_1

Enable FHIR DSTU2_1 Specs in native mode.

boolean

false

quarkus.camel.fhir.enable-dstu3

Enable FHIR DSTU3 Specs in native mode.

boolean

false

quarkus.camel.fhir.enable-r4

Enable FHIR R4 Specs in native mode.

boolean

true

quarkus.camel.fhir.enable-r5

Enable FHIR R5 Specs in native mode.

boolean

false

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.34. File

Read and write files.

2.34.1. What’s inside

Refer to the above link for usage and configuration details.

2.34.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-file</artifactId>
</dependency>

2.35. File Cluster Service

Provides a FileLock implementation of the Camel Cluster Service SPI

2.35.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-file-cluster-service</artifactId>
</dependency>

2.35.2. Additional Camel Quarkus configuration

2.35.2.1. Having only a single consumer in a cluster consuming from a given endpoint

When the same route is deployed on multiple JVMs, it could be interesting to use this extension in conjunction with the Master one. In such a setup, a single consumer will be active at a time across the whole camel master namespace.

For instance, having the route below deployed on multiple JVMs:

from("master:ns:timer:test?period=100").log("Timer invoked on a single JVM at a time");

It’s possible to configure the file cluster service with a property like below:

quarkus.camel.cluster.file.root = target/cluster-folder-where-lock-file-will-be-held

As a result, a single consumer will be active across the ns camel master namespace. It means that, at a given time, only a single timer will generate exchanges across all JVMs. In other words, messages will be logged every 100ms on a single JVM at a time.

The file cluster service could further be tuned by tweaking quarkus.camel.cluster.file.* properties.

Configuration propertyTypeDefault

quarkus.camel.cluster.file.enabled

Whether a File Lock Cluster Service should be automatically configured according to 'quarkus.camel.cluster.file.*' configurations.

boolean

true

quarkus.camel.cluster.file.id

The cluster service ID (defaults to null).

string

 

quarkus.camel.cluster.file.root

The root path (defaults to null).

string

 

quarkus.camel.cluster.file.order

The service lookup order/priority (defaults to 2147482647).

int

 

[[quarkus-camel-cluster-file-attributes—​attributes]] quarkus.camel.cluster.file.attributes."attributes"

The custom attributes associated to the service (defaults to empty map).

Map<String,String>

 

quarkus.camel.cluster.file.acquire-lock-delay

The time to wait before starting to try to acquire lock (defaults to 1000ms).

string

 

quarkus.camel.cluster.file.acquire-lock-interval

The time to wait between attempts to try to acquire lock (defaults to 10000ms).

string

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.37. FTP

Upload and download files to/from SFTP, FTP or SFTP servers

2.37.1. What’s inside

Refer to the above links for usage and configuration details.

2.37.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-ftp</artifactId>
</dependency>

2.38. Google BigQuery

Access Google Cloud BigQuery service using SQL queries or Google Client Services API

2.38.1. What’s inside

Refer to the above links for usage and configuration details.

2.38.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-google-bigquery</artifactId>
</dependency>

2.38.3. Usage

If you want to read SQL scripts from the classpath with google-bigquery-sql in native mode, then you will need to ensure that they are added to the native image via the quarkus.native.resources.includes configuration property. Check Quarkus documentation for more details.

2.39. Google Pubsub

Send and receive messages to/from Google Cloud Platform PubSub Service.

2.39.1. What’s inside

Refer to the above link for usage and configuration details.

2.39.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-google-pubsub</artifactId>
</dependency>

2.39.3. Camel Quarkus limitations

By default, the Camel PubSub component uses JDK object serialization via ObjectOutputStream whenever the message body is anything other than String or byte[].

Since such serialization is not yet supported by GraalVM, this extension provides a custom Jackson based serializer to serialize complex message payloads as JSON.

If your payload contains binary data, then you will need to handle that by creating a custom Jackson Serializer / Deserializer. Refer to the Quarkus Jackson guide for information on how to do this.

2.40. Google Secret Manager

Manage Google Secret Manager Secrets

2.40.1. What’s inside

Refer to the above link for usage and configuration details.

2.40.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-google-secret-manager</artifactId>
</dependency>

2.41. GraphQL

Send GraphQL queries and mutations to external systems.

2.41.1. What’s inside

Refer to the above link for usage and configuration details.

2.41.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-graphql</artifactId>
</dependency>

2.41.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.41.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.graphql.query-files

A comma separated list of paths to files containing GraphQL queries for use by GraphQL endpoints. Query files that only need to be accessible from the classpath should be specified on this property. Paths can either be schemeless (E.g graphql/my-query.graphql) or be prefixed with the classpath: URI scheme (E.g classpath:graphql/my-query.graphql). Other URI schemes are not supported.

List of string

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.42. gRPC

Expose gRPC endpoints and access external gRPC endpoints.

2.42.1. What’s inside

Refer to the above link for usage and configuration details.

2.42.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-grpc</artifactId>
</dependency>

2.42.3. Usage

2.42.3.1. Protobuf generated code

Camel Quarkus gRPC can generate gRPC service stubs for .proto files. When using Maven, ensure that you have enabled the generate-code goals of the quarkus-maven-plugin in your project build.

<build>
    <plugins>
        <plugin>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-maven-plugin</artifactId>
            <version>${quarkus.platform.version}</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <goals>
                        <goal>build</goal>
                        <goal>generate-code</goal>
                        <goal>generate-code-tests</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

With this configuration, you can put your service and message definitions into the src/main/proto directory and the quarkus-maven-plugin will generate code from your .proto files.

2.42.3.1.1. Scanning proto files with imports

The Protocol Buffers specification provides a way to import proto files. You can control the scope of dependencies to scan by adding configuration property quarkus.camel.grpc.codegen.scan-for-imports property to application.properties. The available options are outlined below.

  • all - Scan all dependencies
  • none - Disable dependency scanning. Use only the proto definitions defined in src/main/proto or src/test/proto
  • groupId1:artifactId1,groupId2:artifactId2 - Scan only the dependencies matching the groupId and artifactId list

The default value is com.google.protobuf:protobuf-java.

2.42.3.1.2. Scanning proto files from dependencies

If you have proto files shared across multiple dependencies, you can generate gRPC service stubs for them by adding configuration property quarkus.camel.grpc.codegen.scan-for-proto to application.properties.

First add a dependency for the artifact(s) containing proto files to your project. Next, enable proto file dependency scanning.

quarkus.camel.grpc.codegen.scan-for-proto=org.my.groupId1:my-artifact-id-1,org.my.groupId2:my-artifact-id-2

It is possible to include / exclude specific proto files from dependency scanning via configuration properties.

The configuration property name suffix is the Maven groupId / artifactId for the dependency to configure includes / excludes on. Paths are relative to the classpath location of the proto files within the dependency. Paths can be an explicit path to a proto file, or as glob patterns to include / exclude multiple files.

quarkus.camel.grpc.codegen.scan-for-proto-includes."<groupId>\:<artifactId>"=foo/**,bar/**,baz/a-proto.proto
quarkus.camel.grpc.codegen.scan-for-proto-excludes."<groupId>\:<artifactId>"=foo/private/**,baz/another-proto.proto
Note

The : character within property keys must be escaped with \.

2.42.3.2. Accessing classpath resources in native mode

The gRPC component has various options where resources are resolved from the classpath:

  • keyCertChainResource
  • keyResource
  • serviceAccountResource
  • trustCertCollectionResource

When using these options in native mode, you must ensure that any such resources are included in the native image.

This can be accomplished by adding the configuration property quarkus.native.resources.includes to application.properties. For example, to include SSL / TLS keys and certificates.

quarkus.native.resources.includes = certs/*.pem,certs.*.key

More information about selecting resources for inclusion in the native executable can be found in the native mode guide.

2.42.4. Camel Quarkus limitations

2.42.4.1. Integration with Quarkus gRPC is not supported

At present there is no support for integrating Camel Quarkus gRPC with Quarkus gRPC. If you have both the camel-quarkus-grpc and quarkus-grpc extension dependency on the classpath, you are likely to encounter problems at build time when compiling your application.

2.42.5. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.grpc.codegen.enabled

If true, Camel Quarkus gRPC code generation is run for .proto files discovered from the proto directory, or from dependencies specified in the scan-for-proto or scan-for-imports options. When false, code generation for .proto files is disabled.

boolean

true

quarkus.camel.grpc.codegen.scan-for-proto

Camel Quarkus gRPC code generation can scan application dependencies for .proto files to generate Java stubs from them. This property sets the scope of the dependencies to scan. Applicable values:

- none - default - don’t scan dependencies - a comma separated list of groupId:artifactId coordinates to scan - all - scan all dependencies

string

none

quarkus.camel.grpc.codegen.scan-for-imports

Camel Quarkus gRPC code generation can scan dependencies for .proto files that can be imported by protos in this applications. Applicable values:

- none - default - don’t scan dependencies - a comma separated list of groupId:artifactId coordinates to scan - all - scan all dependencies The default is com.google.protobuf:protobuf-java.

string

com.google.protobuf:protobuf-java

[[quarkus-camel-grpc-codegen-scan-for-proto-includes—​scan-for-proto-includes]] quarkus.camel.grpc.codegen.scan-for-proto-includes."scan-for-proto-includes"

Package path or file glob pattern includes per dependency containing .proto files to be considered for inclusion.

Map<String,List<String>>

 

[[quarkus-camel-grpc-codegen-scan-for-proto-excludes—​scan-for-proto-excludes]] quarkus.camel.grpc.codegen.scan-for-proto-excludes."scan-for-proto-excludes"

Package path or file glob pattern includes per dependency containing .proto files to be considered for exclusion.

Map<String,List<String>>

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.43. Gson

Marshal POJOs to JSON and back using Gson

2.43.1. What’s inside

Refer to the above link for usage and configuration details.

2.43.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-gson</artifactId>
</dependency>

2.43.3. Additional Camel Quarkus configuration

2.43.3.1. Marshaling/Unmarshaling objects in native mode

When marshaling/unmarshaling objects in native mode, all the serialized classes need to be registered for reflection. As such, when using GsonDataFormat.setUnmarshalType(…​), GsonDataFormat.setUnmarshalTypeName(…​) and even GsonDataFormat.setUnmarshalGenericType(…​), the unmarshal type as well as sub field types should be registered for reflection. See a working example in this integration test.

2.44. HL7

Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec.

2.44.1. What’s inside

Refer to the above links for usage and configuration details.

2.44.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-hl7</artifactId>
</dependency>

2.44.3. Camel Quarkus limitations

For MLLP with TCP, Netty is the only supported means of running an Hl7 MLLP listener. Mina is not supported since it has no GraalVM native support at present.

Optional support for HL7MLLPNettyEncoderFactory & HL7MLLPNettyDecoderFactory codecs can be obtained by adding a dependency in your project pom.xml to camel-quarkus-netty.

2.45. HTTP

Send requests to external HTTP servers using Apache HTTP Client 5.x.

2.45.1. What’s inside

Refer to the above links for usage and configuration details.

2.45.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-http</artifactId>
</dependency>

2.45.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.45.4. Additional Camel Quarkus configuration

  • Check the Character encodings section of the Native mode guide if you expect your application to send or receive requests using non-default encodings.

2.46. Hashicorp Vault

Manage secrets in Hashicorp Vault Service

2.46.1. What’s inside

Refer to the above link for usage and configuration details.

2.46.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-hashicorp-vault</artifactId>
</dependency>

2.46.3. Usage

2.46.3.1. Using a POJO for the createSecret operation in native mode

It is possible to use a POJO as the message body for the createSecret operation. In native mode, you must register any such POJO classes for reflection. E.g. via the @RegisterForReflection annotation or configuration property quarkus.camel.native.reflection.include-patterns.

For example.

@RegisterForReflection
public class Credentials {
    private String username;
    private String password;

    // Getters & setters
}
from("direct:createSecret")
    .process(new Processor() {
        @Override
        public void process(Exchange exchange) {
            Credentials credentials = new Credentials();
            credentials.setUsername("admin");
            credentials.setPassword("2s3cr3t");
            exchange.getMessage().setBody(credentials);
        }
    })
    .to("hashicorp-vault:secret?operation=createSecret&token=my-token&secretPath=my-secret")

Refer to the Native mode user guide for more information.

2.47. Infinispan

Read and write from/to Infinispan distributed key/value store and data grid.

2.47.1. What’s inside

Refer to the above link for usage and configuration details.

2.47.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-infinispan</artifactId>
</dependency>

2.47.3. Usage

2.47.3.1. Infinispan client configuration

You can configure Camel Infinispan in one of two ways.

More details about these two configuration methods is described below.

2.47.3.2. Camel Infinispan component and endpoint configuration

When using 'pure' Camel Infinispan component and endpoint configuration (I.e where’s there’s no quarkus.infinispan-client configuration set), you must disable generation of the default Quarkus Infinispan RemoteCacheManager bean by adding the following configuration to application.properties.

quarkus.infinispan-client.devservices.create-default-client=false

If you wish to take advantage of Quarkus Dev Services for Infinispan, the Camel Infinispan component can be configured as follows in application.properties.

# dev / test mode Quarkus Infinispan Dev services configuration
quarkus.infinispan-client.devservices.port=31222
%dev,test.camel.component.infinispan.username=admin
%dev,test.camel.component.infinispan.password=password
%dev,test.camel.component.infinispan.secure=true
%dev,test.camel.component.infinispan.hosts=localhost:31222

# Example prod mode configuration
%prod.camel.component.infinispan.username=prod-user
%prod.camel.component.infinispan.password=prod-password
%prod.camel.component.infinispan.secure=true
%prod.camel.component.infinispan.hosts=infinispan.prod:11222

2.47.3.3. Quarkus Infinispan configuration

When using the Quarkus Infinispan extension configuration properties, the Quarkus Infinispan extensions creates and manages a RemoteCacheManager bean.

The bean will get automatically autowired into the Camel Infinispan component on application startup.

Note that to materialize the RemoteCacheManager beans, you must add injection points for them. For example:

public class Routes extends RouteBuilder {
    // Injects the default unnamed RemoteCacheManager
    @Inject
    RemoteCacheManager cacheManager;

    // If configured, injects an optional named RemoteCacheManager
    @Inject
    @InfinispanClientName("myNamedClient")
    RemoteCacheManager namedCacheManager;

    @Override
    public void configure() {
        // Route configuration here...
    }
}

2.47.4. Additional Camel Quarkus configuration

2.47.4.1. Camel Infinispan InfinispanRemoteAggregationRepository in native mode

If you chose to use the InfinispanRemoteAggregationRepository in native mode, then you must enable native serialization support.

2.48. Avro Jackson

Marshal POJOs to Avro and back using Jackson.

2.48.1. What’s inside

Refer to the above link for usage and configuration details.

2.48.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jackson-avro</artifactId>
</dependency>

2.49. Protobuf Jackson

Marshal POJOs to Protobuf and back using Jackson.

2.49.1. What’s inside

Refer to the above link for usage and configuration details.

2.49.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jackson-protobuf</artifactId>
</dependency>

2.50. Jackson

Marshal POJOs to JSON and back using Jackson

2.50.1. What’s inside

Refer to the above link for usage and configuration details.

2.50.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jackson</artifactId>
</dependency>

2.50.3. Usage

2.50.3.1. Configuring the Jackson ObjectMapper

There are a few ways of configuring the ObjectMapper that the JacksonDataFormat uses. These are outlined below.

2.50.3.1.1. ObjectMapper created internally by JacksonDataFormat

By default, JacksonDataFormat will create its own ObjectMapper and use the various configuration options on the DataFormat to configure additional Jackson modules, pretty printing and other features.

2.50.3.1.2. Custom ObjectMapper for JacksonDataFormat

You can pass a custom ObjectMapper instance to JacksonDataFormat as follows.

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jackson.JacksonDataFormat;

public class Routes extends RouteBuilder {
    public void configure() {
        ObjectMapper mapper = new ObjectMapper();
        JacksonDataFormat dataFormat = new JacksonDataFormat();
        dataFormat.setObjectMapper(mapper);
        // Use the dataFormat instance in a route definition
        from("direct:my-direct").marshal(dataFormat)
    }
}
2.50.3.1.3. Using the Quarkus Jackson ObjectMapper with JacksonDataFormat

The Quarkus Jackson extension exposes an ObjectMapper CDI bean which can be discovered by the JacksonDataFormat.

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jackson.JacksonDataFormat;

public class Routes extends RouteBuilder {
    public void configure() {
        JacksonDataFormat dataFormat = new JacksonDataFormat();
        // Make JacksonDataFormat discover the Quarkus Jackson `ObjectMapper` from the Camel registry
        dataFormat.setAutoDiscoverObjectMapper(true);
        // Use the dataFormat instance in a route definition
        from("direct:my-direct").marshal(dataFormat)
    }
}

If you are using the JSON binding mode in the Camel REST DSL and want to use the Quarkus Jackson ObjectMapper, it can be achieved as follows.

import org.apache.camel.builder.RouteBuilder;

@ApplicationScoped
public class Routes extends RouteBuilder {
    public void configure() {
        restConfiguration().dataFormatProperty("autoDiscoverObjectMapper", "true");
        // REST definition follows...
    }
}

You can perform customizations on the Quarkus ObjectMapper with a ObjectMapperCustomizer.

import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.jackson.ObjectMapperCustomizer;

@Singleton
public class RegisterCustomModuleCustomizer implements ObjectMapperCustomizer {
    public void customize(ObjectMapper mapper) {
        mapper.registerModule(new CustomModule());
    }
}

It’s also possible to @Inject the Quarkus ObjectMapper and pass it to the JacksonDataFormat.

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jackson.JacksonDataFormat;

@ApplicationScoped
public class Routes extends RouteBuilder {
    @Inject
    ObjectMapper mapper;

    public void configure() {
        JacksonDataFormat dataFormat = new JacksonDataFormat();
        dataFormat.setObjectMapper(mapper);
        // Use the dataFormat instance in a route definition
        from("direct:my-direct").marshal(dataFormat)
    }
}

2.51. JacksonXML

Unmarshal an XML payloads to POJOs and back using XMLMapper extension of Jackson.

2.51.1. What’s inside

Refer to the above link for usage and configuration details.

2.51.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jacksonxml</artifactId>
</dependency>

2.52. Jasypt

Security using Jasypt

2.52.1. What’s inside

Refer to the above link for usage and configuration details.

2.52.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jasypt</artifactId>
</dependency>

2.52.3. Usage

The configuration of Jasypt in Camel Quarkus is driven by configuration properties.

The minimum expectation is that you provide a master password for Jasypt decryption with configuration property quarkus.camel.jasypt.password.

You can choose the encryption algorithm and other aspects of the Jasypt configuration via the quarkus.camel.jasypt options described below.

By default, you do not need to write custom code to configure the Camel JasyptPropertiesParser or PropertiesComponent. This is done for you automatically.

Any Camel configuration property added to application.properties can be secured with Jasypt. To encrypt a value, there is a utility that can be run with JBang.

jbang org.apache.camel:camel-jasypt:{camel-version} -c encrypt -p secret-password -i "Some secret content"
Important

If you choose to use a different Jasypt algorithm to the default (PBEWithMD5AndDES), you must provide -a (algorithm), -riga (IV generator algorithm) & -rsga (Salt generator algorithm) arguments to set the correct algorithms used in encryption. Else your application will not be able to decrypt configuration values.

Alternatively, when running in dev mode, open the Dev UI and click the 'utilities' link in the Camel Jasypt pane. Next, select either the 'Decrypt' or 'Encrypt' action, enter some text and click the submit button. The result of the action is output together with a button to copy it to the clipboard.

Configuration properties can be added to application.properties with the encrypted value enclosed within ENC() For example.

my.secret = ENC(BoDSRQfdBME4V/AcugPOkaR+IcyKufGz)

In your Camel routes, you can refer to the property name using the standard placeholder syntax and its value will get decrypted.

public class MySecureRoute extends RouteBuilder {
    @Override
    public void configure() {
        from("timer:tick?period=5s")
            .to("{{my.secret}}");
    }
}
Tip

You can use the ability to mask security sensitive configuration in Camel by suffixing property values with .secret. You can also disable the startup configuration summary with the configuration camel.main.autoConfigurationLogSummary = false.

2.52.3.1. Injecting encrypted configuration

You can use the @ConfigProperty annotation to inject encrypted configuration into your Camel routes or CDI beans.

@ApplicationScoped
public class MySecureRoute extends RouteBuilder {
    @ConfigInject("my.secret")
    String mySecret;

    @Override
    public void configure() {
        from("timer:tick?period=5s")
            .to(mySecret);
    }
}
2.52.3.1.1. Securing alternate configuration sources

If you prefer to keep your secret configuration in a file separate to application.properties, you can use the quarkus.config.locations configuration option to specify additional configuration files.

In native mode you must also add any additional configuration file resource paths to quarkus.native.resources.includes.

2.52.3.1.2. Finer control of Jasypt configuration

If you require finer control of the Jasypt configuration than that provided by the default configuration, the following options are available.

2.52.3.1.2.1. JasyptConfigurationCustomizer

Implement a JasyptConfigurationCustomizer class to customize any aspect of the Jasypt EnvironmentStringPBEConfig.

package org.acme;

import org.apache.camel.quarkus.component.jasypt.JasyptConfigurationCustomizer;
import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig;
import org.jasypt.iv.RandomIvGenerator;
import org.jasypt.salt.RandomSaltGenerator;

public class JasyptConfigurationCustomizer implements JasyptConfigurationCustomizer {
    public void customize(EnvironmentStringPBEConfig config) {
        // Custom algorithms
        config.setAlgorithm("PBEWithHmacSHA256AndAES_256");
        config.setSaltGenerator(new RandomSaltGenerator("PKCS11"));
        config.setIvGenerator(new RandomIvGenerator("PKCS11"));
        // Additional customizations...
    }
}

In application.properties add the quarkus.camel.jasypt.configuration-customizer-class-name configuration property.

quarkus.camel.jasypt.configuration-customizer-class-name = org.acme.MyJasyptEncryptorCustomizer
2.52.3.1.2.2. Disabling automatic Jasypt configuration

If you prefer to use the 'classic' Java DSL way of configuring Camel Jasypt, you can disable the automatic configuration with quarkus.camel.jasypt.enabled = false.

This allows you to configure the Camel JasyptPropertiesParser and PropertiesComponent manually.

Note

In this mode, you cannot use the @ConfigProperty annotation to inject encrypted configuration properties.

import org.apache.camel.CamelContext;
import org.apache.camel.component.jasypt.JasyptPropertiesParser;
import org.apache.camel.component.properties.PropertiesComponent;

public class MySecureRoute extends RouteBuilder {
    @Override
    public void configure() {
        JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
        jasypt.setPassword("secret");

        PropertiesComponent component = (PropertiesComponent) getContext().getPropertiesComponent();
        jasypt.setPropertiesComponent(component);
        component.setPropertiesParser(jasypt);

        from("timer:tick?period=5s")
            .to("{{my.secret}}");
    }
}
Note

If you call setLocation(…​) on the PropertiesComponent to specify a custom configuration file location using the classpath: prefix, you must add the file to quarkus.native.resources.includes so that it can be loaded in native mode.

2.52.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.jasypt.enabled

Setting this option to false will disable Jasypt integration with Quarkus SmallRye configuration. You can however, manually configure Jasypt with Camel in the 'classic' way of manually configuring JasyptPropertiesParser and PropertiesComponent. Refer to the usage section for more details.

boolean

true

quarkus.camel.jasypt.algorithm

The algorithm to be used for decryption.

string

PBEWithMD5AndDES

quarkus.camel.jasypt.password

The master password used by Jasypt for decrypting configuration values. This option supports prefixes which influence the master password lookup behaviour.

sys: will to look up the value from a JVM system property. sysenv: will look up the value from the OS system environment with the given key.

string

 

quarkus.camel.jasypt.random-iv-generator-algorithm

Configures the Jasypt StandardPBEStringEncryptor with a RandomIvGenerator using the given algorithm.

string

SHA1PRNG

quarkus.camel.jasypt.random-salt-generator-algorithm

Configures the Jasypt StandardPBEStringEncryptor with a RandomSaltGenerator using the given algorithm.

string

SHA1PRNG

quarkus.camel.jasypt.configuration-customizer-class-name

The fully qualified class name of an org.apache.camel.quarkus.component.jasypt.JasyptConfigurationCustomizer implementation. This provides the optional capability of having full control over the Jasypt configuration.

string

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.53. Java jOOR DSL

Support for parsing Java route definitions at runtime

2.53.1. What’s inside

Refer to the above link for usage and configuration details.

2.53.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-java-joor-dsl</artifactId>
</dependency>

2.53.3. Camel Quarkus limitations

The annotations added to the classes to be compiled by the component are ignored by Quarkus. The only annotation that is partially supported by the extension is the annotation RegisterForReflection to ease the configuration of the reflection for the native mode however, note that the element registerFullHierarchy is not supported.

2.54. JAXB

Unmarshal XML payloads to POJOs and back using JAXB2 XML marshalling standard.

2.54.1. What’s inside

Refer to the above link for usage and configuration details.

2.54.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jaxb</artifactId>
</dependency>

2.54.3. Usage

2.54.3.1. Native mode ObjectFactory instantiation of non-JAXB annotated classes

When performing JAXB marshal operations with a custom ObjectFactory to instantiate POJO classes that do not have JAXB annotations, you must register those POJO classes for reflection in order for them to be instantiated in native mode. E.g via the @RegisterForReflection annotation or configuration property quarkus.camel.native.reflection.include-patterns.

Refer to the Native mode user guide for more information.

2.55. JDBC

Access databases through SQL and JDBC.

2.55.1. What’s inside

Refer to the above link for usage and configuration details.

2.55.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jdbc</artifactId>
</dependency>

2.55.3. Additional Camel Quarkus configuration

2.55.3.1. Configuring a DataSource

This extension leverages Quarkus Agroal for DataSource support. Setting up a DataSource can be achieved via configuration properties. It is recommended that you explicitly name the datasource so that it can be referenced in the JDBC endpoint URI. E.g like to("jdbc:camel").

quarkus.datasource.camel.db-kind=postgresql
quarkus.datasource.camel.username=your-username
quarkus.datasource.camel.password=your-password
quarkus.datasource.camel.jdbc.url=jdbc:postgresql://localhost:5432/your-database
quarkus.datasource.camel.jdbc.max-size=16

If you choose to not name the datasource, you can resolve the default DataSource by defining your endpoint like to("jdbc:default").

2.55.3.1.1. Zero configuration with Quarkus Dev Services

In dev and test mode you can take advantage of Configuration Free Databases. All you need to do is reference the default database in your routes. E.g to("jdbc:default").

2.56. Jira

Interact with JIRA issue tracker.

2.56.1. What’s inside

Refer to the above link for usage and configuration details.

2.56.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jira</artifactId>
</dependency>

2.56.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.57. JMS

Sent and receive messages to/from a JMS Queue or Topic.

2.57.1. What’s inside

Refer to the above link for usage and configuration details.

2.57.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jms</artifactId>
</dependency>

2.57.3. Usage

2.57.3.1. Message mapping with org.w3c.dom.Node

The Camel JMS component supports message mapping between jakarta.jms.Message and org.apache.camel.Message. When wanting to convert a Camel message body type of org.w3c.dom.Node, you must ensure that the camel-quarkus-xml-jaxp extension is present on the classpath.

2.57.3.2. Native mode support for jakarta.jms.ObjectMessage

When sending JMS message payloads as jakarta.jms.ObjectMessage, you must annotate the relevant classes to be registered for serialization with @RegisterForReflection(serialization = true). Note that this extension automatically sets quarkus.camel.native.reflection.serialization-enabled = true for you. Refer to the native mode user guide for more information.

2.57.3.3. Support for Connection pooling and X/Open XA distributed transactions

Note

Connection pooling is a Technical Preview feature in this release of {project-name}.

To use connection pooling in the camel-quarkus-jms components, you must add io.quarkiverse.artemis:quarkus-artemis and io.quarkiverse.messaginghub:quarkus-pooled-jms to your pom.xml and set the following configuration:

quarkus.pooled-jms.max-connections = 8

You can use the quarkus-pooled-jms extension to get pooling and XA support for JMS connections. Refer to the quarkus-pooled-jms extension documentation for more information. Currently, it can work with quarkus-artemis-jms, quarkus-qpid-jms and ibmmq-client. Just add the dependency to your pom.xml:

<dependency>
    <groupId>io.quarkiverse.messaginghub</groupId>
    <artifactId>quarkus-pooled-jms</artifactId>
</dependency>

Pooling is enabled by default.

Note

clientID and durableSubscriptionName are not supported in pooling connections. If setClientID is called on a reused connection from the pool, an IllegalStateException will be thrown. You will get some error messages such like Cause: setClientID can only be called directly after the connection is created

To enable XA, you need to add quarkus-narayana-jta extension:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-narayana-jta</artifactId>
</dependency>

and add the following configuration to your application.properties:

quarkus.pooled-jms.transaction=xa
quarkus.transaction-manager.enable-recovery=true

XA support is only available with quarkus-artemis-jms and ibmmq-client. Also We highly recommend to enable transaction recovery.

Since there is no quarkus extension for ibmmq-client currently, you need to create a custom ConnectionFactory and wrap it by yourself. Here is an example:

@Produces
public ConnectionFactory createXAConnectionFactory(PooledJmsWrapper wrapper) {
    MQXAConnectionFactory mq = new MQXAConnectionFactory();
    try {
        mq.setHostName(ConfigProvider.getConfig().getValue("ibm.mq.host", String.class));
        mq.setPort(ConfigProvider.getConfig().getValue("ibm.mq.port", Integer.class));
        mq.setChannel(ConfigProvider.getConfig().getValue("ibm.mq.channel", String.class));
        mq.setQueueManager(ConfigProvider.getConfig().getValue("ibm.mq.queueManagerName", String.class));
        mq.setTransportType(WMQConstants.WMQ_CM_CLIENT);
        mq.setStringProperty(WMQConstants.USERID,
            ConfigProvider.getConfig().getValue("ibm.mq.user", String.class));
        mq.setStringProperty(WMQConstants.PASSWORD,
            ConfigProvider.getConfig().getValue("ibm.mq.password", String.class));
    } catch (Exception e) {
        throw new RuntimeException("Unable to create new IBM MQ connection factory", e);
    }
    return wrapper.wrapConnectionFactory(mq);
}
Note

If you use ibmmq-client to consume messages and enable XA, you need to configure TransactionManager in the camel route like this:

@Inject
TransactionManager transactionManager;

@Override
public void configure() throws Exception {
    from("jms:queue:DEV.QUEUE.XA?transactionManager=#jtaTransactionManager");
}

@Named("jtaTransactionManager")
public PlatformTransactionManager getTransactionManager() {
    return new JtaTransactionManager(transactionManager);
}

Otherwise, you will get an exception like MQRC_SYNCPOINT_NOT_AVAILABLE.

Note

When you are using ibmmq-client and rollback a transaction, there will be a WARN message like:

WARN  [com.arj.ats.jta] (executor-thread-1) ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a86510:aed3:650915d7:16, node_name=quarkus, branch_uid=0:ffffc0a86510:aed3:650915d7:1f, subordinatenodename=null, eis_name=0 > (com.ibm.mq.jmqi.JmqiXAResource@79786dde) failed with exception code XAException.XAER_NOTA: javax.transaction.xa.XAException: The method 'xa_rollback' has failed with errorCode '-4'.
it may be ignored and can be assumed that MQ has discarded the transaction's work. Refer to https://access.redhat.com/solutions/1250743[Red Hat Knowledgebase] for more information.

2.57.4. transferException option in native mode

To use the transferException option in native mode, you must enable support for object serialization. Refer to the native mode user guide for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.

@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)

2.58. JPA

Store and retrieve Java objects from databases using Java Persistence API (JPA).

2.58.1. What’s inside

Refer to the above link for usage and configuration details.

2.58.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jpa</artifactId>
</dependency>

2.58.3. Additional Camel Quarkus configuration

The extension leverages Quarkus Hibernate ORM to provide the JPA implementation via Hibernate.

Refer to the Quarkus Hibernate ORM documentation to see how to configure Hibernate and your datasource.

Also, it leverages Quarkus TX API to provide TransactionStrategy implementation.

When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a EntityManagerFactory and TransactionStrategy.

2.58.3.1. Configuring JpaMessageIdRepository

It needs to use EntityManagerFactory and TransactionStrategy from the CDI container to configure the JpaMessageIdRepository:

@Inject
EntityManagerFactory entityManagerFactory;

@Inject
TransactionStrategy transactionStrategy;

from("direct:idempotent")
    .idempotentConsumer(
        header("messageId"),
        new JpaMessageIdRepository(entityManagerFactory, transactionStrategy, "idempotentProcessor"));
Note

Since it excludes the spring-orm dependency, some options such as sharedEntityManager, transactionManager are not supported.

2.59. JSLT

Query or transform JSON payloads using an JSLT.

2.59.1. What’s inside

Refer to the above link for usage and configuration details.

2.59.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jslt</artifactId>
</dependency>

2.59.3. allowContextMapAll option in native mode

The allowContextMapAll option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as CamelContext & Exchange. This is considered a security risk and thus access to the feature is not provided by default.

2.59.4. Additional Camel Quarkus configuration

2.59.4.1. Loading JSLT templates from classpath in native mode

This component typically loads the templates from classpath. To make it work also in native mode, you need to explicitly embed the templates files in the native executable by using the quarkus.native.resources.includes property.

For instance, the route below would load the JSLT schema from a classpath resource named transformation.json:

from("direct:start").to("jslt:transformation.json");

To include this (an possibly other templates stored in .json files) in the native image, you would have to add something like the following to your application.properties file:

quarkus.native.resources.includes = *.json

More information about selecting resources for inclusion in the native executable can be found at Embedding resource in native executable.

2.59.4.2. Using JSLT functions in native mode

When using JSLT functions from camel-quarkus in native mode, the classes hosting the functions would need to be registered for reflection. When registering the target function is not possible, one may end up writing a stub as below.

@RegisterForReflection
public class MathFunctionStub {
    public static double pow(double a, double b) {
        return java.lang.Math.pow(a, b);
    }
}

The target function Math.pow(…​) is now accessible through the MathFunctionStub class that could be registered in the component as below:

@Named
JsltComponent jsltWithFunction() throws ClassNotFoundException {
    JsltComponent component = new JsltComponent();
    component.setFunctions(singleton(wrapStaticMethod("power", "org.apache.cq.example.MathFunctionStub", "pow")));
    return component;
}

2.60. JSON Path

Evaluate a JSONPath expression against a JSON message body

2.60.1. What’s inside

Refer to the above link for usage and configuration details.

2.60.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jsonpath</artifactId>
</dependency>

2.61. JTA

Enclose Camel routes in transactions using Java Transaction API (JTA) and Narayana transaction manager

2.61.1. What’s inside

Refer to the above link for usage and configuration details.

2.61.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jta</artifactId>
</dependency>

2.61.3. Usage

This extension should be added when you need to use the transacted() EIP in the router. It leverages the transaction capabilities provided by the narayana-jta extension in Quarkus.

Refer to the Quarkus Transaction guide for the more details about transaction support. For a simple usage:

from("direct:transaction")
    .transacted()
    .to("sql:INSERT INTO A TABLE ...?dataSource=#ds1")
    .to("sql:INSERT INTO A TABLE ...?dataSource=#ds2")
    .log("all data are in the ds1 and ds2")

Support is provided for various transaction policies.

PolicyDescription

PROPAGATION_MANDATORY

Support a current transaction; throw an exception if no current transaction exists.

PROPAGATION_NEVER

Do not support a current transaction; throw an exception if a current transaction exists.

PROPAGATION_NOT_SUPPORTED

Do not support a current transaction; rather always execute non-transactionally.

PROPAGATION_REQUIRED

Support a current transaction; create a new one if none exists.

PROPAGATION_REQUIRES_NEW

Create a new transaction, suspending the current transaction if one exists.

PROPAGATION_SUPPORTS

Support a current transaction; execute non-transactionally if none exists.

2.62. JT400

Exchanges messages with an IBM i system using data queues, message queues, or program call. IBM i is the replacement for AS/400 and iSeries servers.

2.62.1. What’s inside

  • JT400 component, URI syntax: jt400:userID:password@systemName/QSYS.LIB/objectPath.type

Refer to the above link for usage and configuration details.

2.62.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jt400</artifactId>
</dependency>

2.63. JQ

Evaluates a JQ expression against a JSON message body.

2.63.1. What’s inside

Refer to the above link for usage and configuration details.

2.63.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jq</artifactId>
</dependency>

2.63.3. Usage

2.63.3.1. JQ transformations to custom result types in native mode

If you choose to perform JQ transformations that specify the result class as some custom type in native mode, then you must register that type for reflection.

E.g via the @RegisterForReflection annotation or configuration property quarkus.camel.native.reflection.include-patterns. For example:

@RegisterForReflection
public class Book {
    ...
}
public class MyJQRoutes extends RouteBuilder {
    @Override
    public void configure() {
        from("direct:jq")
            .transform().jq(".book", Book.class);
    }
}

Refer to the Native mode user guide for more information.

2.64. Kafka

Sent and receive messages to/from an Apache Kafka broker.

2.64.1. What’s inside

Refer to the above link for usage and configuration details.

2.64.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-kafka</artifactId>
</dependency>

2.64.3. Usage

2.64.3.1. Quarkus Kafka Dev Services

Camel Quarkus Kafka can take advantage of Quarkus Kafka Dev services to simplify development and testing with a local containerized Kafka broker.

Kafka Dev Services is enabled by default in dev & test mode. The Camel Kafka component is automatically configured so that the brokers component option is set to point at the local containerized Kafka broker. Meaning that there’s no need to configure this option yourself.

This functionality can be disabled with the configuration property quarkus.kafka.devservices.enabled=false.

2.64.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.kafka.kubernetes-service-binding.merge-configuration

If true then any Kafka configuration properties discovered by the Quarkus Kubernetes Service Binding extension (if configured) will be merged with those set via Camel Kafka component or endpoint options. If false then any Kafka configuration properties discovered by the Quarkus Kubernetes Service Binding extension are ignored, and all of the Kafka component configuration is driven by Camel.

boolean

true

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.65. Kamelet

Materialize route templates

2.65.1. What’s inside

Refer to the above link for usage and configuration details.

2.65.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-kamelet</artifactId>
</dependency>

2.65.3. Usage

2.65.3.1. Using the Kamelet Catalog

A set of pre-made Kamelets can be found in the Kamelet Catalog. To use a Kamelet from the catalog, you need to copy its YAML definition (that you can find in the camel-kamelets repository) to your project.

Alternatively, you can add the camel-kamelets dependency to your application.

<dependency>
    <groupId>org.apache.camel.kamelets</groupId>
    <artifactId>camel-kamelets</artifactId>
</dependency>

If the Kamelet requires the camel-kamelets-utils dependency, then this should also be added to your application.

<dependency>
    <groupId>org.apache.camel.kamelets</groupId>
    <artifactId>camel-kamelets-utils</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.apache.camel</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>

2.66. Kubernetes

Perform operations against Kubernetes API

2.66.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-kubernetes</artifactId>
</dependency>

2.66.2. Additional Camel Quarkus configuration

Important

In this release of Red Hat build of Apache Camel for Quarkus, the camel-quarkus-kubernetes extension is only supported when used with the camel-quarkus-master extension as a cluster service. Additionally, in order for the camel-quarkus-kubernetes extension to be supported, you must explicitly add a dependency on the quarkus-openshift-client extension in your application.

2.66.2.1. Automatic registration of a Kubernetes Client instance

The extension automatically registers a Kubernetes Client bean named kubernetesClient. You can reference the bean in your routes like this:

from("direct:pods")
    .to("kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=listPods")

By default the client is configured from the local kubeconfig file. You can customize the client configuration via properties within application.properties:

quarkus.kubernetes-client.master-url=https://my.k8s.host
quarkus.kubernetes-client.namespace=my-namespace

The full set of configuration options are documented in the Quarkus Kubernetes Client guide.

2.67. Kubernetes Cluster Service

Provides a Kubernetes implementation of the Camel Cluster Service SPI

2.67.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-kubernetes-cluster-service</artifactId>
</dependency>

2.67.2. Additional Camel Quarkus configuration

2.67.2.1. Having only a single consumer in a cluster consuming from a given endpoint

When the same route is deployed on multiple pods, it could be interesting to use this extension in conjunction with the Master one. In such a setup, a single consumer will be active at a time across the whole camel master namespace.

For instance, having the route below deployed on multiple pods:

from("master:ns:timer:test?period=100").log("Timer invoked on a single pod at a time");

As a result, a single consumer will be active across the ns camel master namespace. It means that, at a given time, only a single timer will generate exchanges across the whole cluster. In other words, messages will be logged every 100ms on a single pod at a time.

The kubernetes cluster service could further be tuned by tweaking quarkus.camel.cluster.kubernetes.* properties.

Configuration propertyTypeDefault

quarkus.camel.cluster.kubernetes.enabled

Whether a Kubernetes Cluster Service should be automatically configured according to 'quarkus.camel.cluster.kubernetes.*' configurations.

boolean

true

quarkus.camel.cluster.kubernetes.rebalancing

Whether the camel master namespace leaders should be distributed evenly across all the camel contexts in the cluster.

boolean

true

quarkus.camel.cluster.kubernetes.id

The cluster service ID (defaults to null).

string

 

quarkus.camel.cluster.kubernetes.master-url

The URL of the Kubernetes master (read from Kubernetes client properties by default).

string

 

quarkus.camel.cluster.kubernetes.connection-timeout-millis

The connection timeout in milliseconds to use when making requests to the Kubernetes API server.

int

 

quarkus.camel.cluster.kubernetes.namespace

The name of the Kubernetes namespace containing the pods and the configmap (autodetected by default).

string

 

quarkus.camel.cluster.kubernetes.pod-name

The name of the current pod (autodetected from container host name by default).

string

 

quarkus.camel.cluster.kubernetes.jitter-factor

The jitter factor to apply in order to prevent all pods to call Kubernetes APIs in the same instant (defaults to 1.2).

double

 

quarkus.camel.cluster.kubernetes.lease-duration-millis

The default duration of the lease for the current leader (defaults to 15000).

long

 

quarkus.camel.cluster.kubernetes.renew-deadline-millis

The deadline after which the leader must stop its services because it may have lost the leadership (defaults to 10000).

long

 

quarkus.camel.cluster.kubernetes.retry-period-millis

The time between two subsequent attempts to check and acquire the leadership. It is randomized using the jitter factor (defaults to 2000).

long

 

quarkus.camel.cluster.kubernetes.order

Service lookup order/priority (defaults to 2147482647).

int

 

quarkus.camel.cluster.kubernetes.resource-name

The name of the lease resource used to do optimistic locking (defaults to 'leaders'). The resource name is used as prefix when the underlying Kubernetes resource can manage a single lock.

string

 

quarkus.camel.cluster.kubernetes.lease-resource-type

The lease resource type used in Kubernetes, either 'config-map' or 'lease' (defaults to 'lease').

config-map, lease

 

[[quarkus-camel-cluster-kubernetes-labels—​labels]] quarkus.camel.cluster.kubernetes.labels."labels"

The labels key/value used to identify the pods composing the cluster, defaults to empty map.

Map<String,String>

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.68. Kudu

Interact with Apache Kudu, a free and open source column-oriented data store of the Apache Hadoop ecosystem.

2.68.1. What’s inside

Refer to the above link for usage and configuration details.

2.68.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-kudu</artifactId>
</dependency>

2.68.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.69. Language

Execute scripts in any of the languages supported by Camel.

2.69.1. What’s inside

Refer to the above link for usage and configuration details.

2.69.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-language</artifactId>
</dependency>

2.69.3. Usage

2.69.3.1. Required Dependencies

The Language extension only handles the passing of an Exchange to a script for execution. The extension implementing the language must be added as a dependency. The following list of languages are implemented in Core:

  • Constant
  • ExchangeProperty
  • File
  • Header
  • Ref
  • Simple
  • Tokenize

To use any other language, you must add the corresponding dependency. Consult the Languages Guide for details.

2.69.3.2. Native Mode

When loading scripts from the classpath in native mode, the path to the script file must be specified in the quarkus.native.resources.includes property of the application.properties file. For example:

quarkus.native.resources.includes=script.txt

2.69.4. allowContextMapAll option in native mode

The allowContextMapAll option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as CamelContext & Exchange. This is considered a security risk and thus access to the feature is not provided by default.

2.70. LDAP

Perform searches on LDAP servers.

2.70.1. What’s inside

Refer to the above link for usage and configuration details.

2.70.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-ldap</artifactId>
</dependency>

2.70.3. Usage

2.70.3.1. Using SSL in Native Mode

When using a custom SSLSocketFactory in native mode, such as the one in the Configuring SSL section, you need to register the class for reflection otherwise the class will not be made available on the classpath. Add the @RegisterForReflection annotation above the class definition, as follows:

@RegisterForReflection
public class CustomSSLSocketFactory extends SSLSocketFactory {
    // The class definition is the same as in the above link.
}

2.71. LRA

Camel saga binding for Long-Running-Action framework

2.71.1. What’s inside

Refer to the above link for usage and configuration details.

2.71.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-lra</artifactId>
</dependency>

2.72. Log

Prints data form the routed message (such as body and headers) to the logger.

2.72.1. What’s inside

Refer to the above link for usage and configuration details.

2.72.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-log</artifactId>
</dependency>

2.73. Mail

Send and receive emails using imap, pop3 and smtp protocols. Marshal Camel messages with attachments into MIME-Multipart messages and back.

2.73.1. What’s inside

Refer to the above links for usage and configuration details.

2.73.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mail</artifactId>
</dependency>

2.74. Management

JMX management strategy and associated managed resources.

2.74.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-management</artifactId>
</dependency>

2.74.2. Usage

For information on using Managed Beans in Camel, consult the JMX section of the Camel Manual.

2.74.2.1. Enabling and Disabling JMX

JMX can be enabled or disabled in Camel-Quarkus by any of the following methods:

  1. Adding or removing the camel-quarkus-management extension.
  2. Setting the camel.main.jmxEnabled configuration property to a boolean value.
  3. Setting the system property -Dorg.apache.camel.jmx.disabled to a boolean value.

2.74.2.2. Native mode

Experimental JMX support was added for native executables in GraalVM for JDK 17/20 / Mandrel 23.0. You can enable this feature by adding the following configuration property to application.properties.

quarkus.native.monitoring=jmxserver

If you want the native application to be discoverable by tools such as JConsole and VisualVM, append the jvmstat option to the above mentioned configuration.

For more information, refer to the Quarkus native guide.

2.75. MapStruct

Type Conversion using Mapstruct

2.75.1. What’s inside

Refer to the above link for usage and configuration details.

2.75.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mapstruct</artifactId>
</dependency>

2.75.3. Usage

2.75.3.1. Annotation Processor

To use MapStruct, you must configure your build to use an annotation processor.

2.75.3.1.1. Maven
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <annotationProcessorPaths>
                <path>
                    <groupId>org.mapstruct</groupId>
                    <artifactId>mapstruct-processor</artifactId>
                    <version>{mapstruct-version}</version>
                </path>
            </annotationProcessorPaths>
        </configuration>
    </plugin>
</plugins>
2.75.3.1.2. Gradle
dependencies {
    annotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}'
    testAnnotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}'
}

2.75.3.2. Mapper definition discovery

By default, {project-name} will automatically discover the package paths of your @Mapper annotated interfaces or abstract classes and pass them to the Camel MapStruct component.

If you want finer control over the specific packages that are scanned, then you can set a configuration property in application.properties.

camel.component.mapstruct.mapper-package-name = com.first.package,org.second.package

2.76. Master

Have only a single consumer in a cluster consuming from a given endpoint; with automatic failover if the JVM dies.

2.76.1. What’s inside

Refer to the above link for usage and configuration details.

2.76.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-master</artifactId>
</dependency>

2.76.3. Additional Camel Quarkus configuration

This extension can be used in conjunction with extensions below:

2.77. Micrometer

Collect various metrics directly from Camel routes using the Micrometer library.

2.77.1. What’s inside

Refer to the above link for usage and configuration details.

2.77.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-micrometer</artifactId>
</dependency>

2.77.3. Usage

This extension leverages Quarkus Micrometer. Quarkus supports a variety of Micrometer metric registry implementations.

Your application should declare the following dependency or one of the dependencies listed in the quarkiverse documentation, depending on the monitoring solution you want to work with.

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-micrometer-registry-prometheus</artifactId>
</dependency>

If no dependency is declared, the Micrometer extension creates a SimpleMeterRegistry instance, suitable mainly for testing.

2.77.4. Camel Quarkus limitations

2.77.4.1. Exposing Micrometer statistics in JMX

Exposing Micrometer statistics in JMX is not available in native mode as quarkus-micrometer-registry-jmx does not have native support at present.

2.77.4.2. Decrement header for Counter is ignored by Prometheus

Prometheus backend ignores negative values during increment of Counter metrics.

2.77.4.3. Exposing statistics in JMX

In {project-name}, registering a JmxMeterRegistry is simplified. Add a dependency for io.quarkiverse.micrometer.registry:quarkus-micrometer-registry-jmx and a JmxMeterRegistry will automatically get created for you.

2.77.5. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.metrics.enable-route-policy

Set whether to enable the MicrometerRoutePolicyFactory for capturing metrics on route processing times.

boolean

true

quarkus.camel.metrics.enable-message-history

Set whether to enable the MicrometerMessageHistoryFactory for capturing metrics on individual route node processing times. Depending on the number of configured route nodes, there is the potential to create a large volume of metrics. Therefore, this option is disabled by default.

boolean

false

quarkus.camel.metrics.enable-exchange-event-notifier

Set whether to enable the MicrometerExchangeEventNotifier for capturing metrics on exchange processing times.

boolean

true

quarkus.camel.metrics.enable-route-event-notifier

Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total number of routes running.

boolean

true

quarkus.camel.metrics.enable-instrumented-thread-pool-factory

Set whether to gather performance information about Camel Thread Pools by injecting an InstrumentedThreadPoolFactory.

boolean

false

quarkus.camel.metrics.naming-strategy

Controls the naming style to use for metrics. The available values are default and legacy. default uses the default Micrometer naming convention. legacy uses the legacy camel-case naming style.

default, legacy

default

quarkus.camel.metrics.route-policy-level

Sets the level of metrics to capture. The available values are all ,context and route. all captures metrics for both the camel context and routes. route captures metrics for routes only. context captures metrics for the camel context only.

all, context, route

all

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.78. Microprofile Fault Tolerance

Circuit Breaker EIP using Microprofile Fault Tolerance

2.78.1. What’s inside

Refer to the above link for usage and configuration details.

2.78.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-microprofile-fault-tolerance</artifactId>
</dependency>

2.79. MicroProfile Health

Expose Camel health checks via MicroProfile Health

2.79.1. What’s inside

Refer to the above link for usage and configuration details.

2.79.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-microprofile-health</artifactId>
</dependency>

2.79.3. Usage

You can register health checks for your applications with the Camel health check API.

By default, classes extending AbstractHealthCheck are registered as both liveness and readiness checks. You can override the isReadiness method to control this behaviour.

Any checks provided by your application are automatically discovered and bound to the Camel registry. They will be available via the Quarkus health endpoints /q/health/live and /q/health/ready.

You can also provide custom HealthCheckRepository implementations and these are also automatically discovered and bound to the Camel registry for you.

Refer to the Quarkus health guide for further information.

2.79.3.1. Provided health checks

Some checks are automatically registered for your application.

2.79.3.1.1. Camel Context Health

Inspects the Camel Context status and causes the health check status to be DOWN if the status is anything other than 'Started'.

2.79.3.1.2. Camel Route Health

Inspects the status of each route and causes the health check status to be DOWN if any route status is not 'Started'.

2.79.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.health.enabled

Set whether to enable Camel health checks

boolean

true

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.80. Minio

Store and retrieve objects from Minio Storage Service using Minio SDK.

2.80.1. What’s inside

Refer to the above link for usage and configuration details.

2.80.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-minio</artifactId>
</dependency>

2.80.3. Additional Camel Quarkus configuration

Depending on Minio configuration, this extension may require SSL encryption on its connections. In such cases, you will need to add quarkus.ssl.native=true to your application.properties. See also Quarkus native SSL guide and Native mode section of Camel Quarkus user guide.

There are two different configuration approaches:

  • Minio client can be defined via quarkus properties leveraging the Quarkiverse Minio (see documentation). Camel will autowire client into the Minio component. This configuration allows definition of only one minio client, therefore it isn’t possible to define several different minio endpoints, which run together.
  • Provide client/clients for camel registry (e.g. CDI producer/bean) and reference them from endpoint.
minio:foo?minioClient=#minioClient

2.81. MLLP

Communicate with external systems using the MLLP protocol.

2.81.1. What’s inside

Refer to the above link for usage and configuration details.

2.81.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mllp</artifactId>
</dependency>

2.81.3. Additional Camel Quarkus configuration

2.82. Mock

Test routes and mediation rules using mocks.

2.82.1. What’s inside

Refer to the above link for usage and configuration details.

2.82.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mock</artifactId>
</dependency>

2.82.3. Usage

To use camel-mock capabilities in tests it is required to get access to MockEndpoint instances.

CDI injection could be used for accessing instances (see Quarkus documentation). You can inject camelContext into test using @Inject annotation. Camel context can be then used for obtaining mock endpoints. See the following example:

import jakarta.inject.Inject;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
public class MockJvmTest {

    @Inject
    CamelContext camelContext;

    @Inject
    ProducerTemplate producerTemplate;

    @Test
    public void test() throws InterruptedException {

        producerTemplate.sendBody("direct:start", "Hello World");

        MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:result", MockEndpoint.class);
        mockEndpoint.expectedBodiesReceived("Hello World");

        mockEndpoint.assertIsSatisfied();
    }
}

Route used for the example test:

import jakarta.enterprise.context.ApplicationScoped;

import org.apache.camel.builder.RouteBuilder;

@ApplicationScoped
public class MockRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("direct:start").to("mock:result");
    }
}

2.82.4. Camel Quarkus limitations

Injection of CDI beans (described in Usage) does not work in native mode.

In the native mode the test and the application under test are running in two different processes and it is not possible to share a mock bean between them (see Quarkus documentation).

2.83. MongoDB

Perform operations on MongoDB documents and collections.

2.83.1. What’s inside

Refer to the above link for usage and configuration details.

2.83.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mongodb</artifactId>
</dependency>

2.83.3. Additional Camel Quarkus configuration

The extension leverages the Quarkus MongoDB Client extension. The Mongo client can be configured via the Quarkus MongoDB Client configuration options.

The Camel Quarkus MongoDB extension automatically registers a MongoDB client bean named camelMongoClient. This can be referenced in the mongodb endpoint URI connectionBean path parameter. For example:

from("direct:start")
.to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll")

If your application needs to work with multiple MongoDB servers, you can create a "named" client and reference in your route by injecting a client and the related configuration as explained in the Quarkus MongoDB extension client injection. For example:

//application.properties
quarkus.mongodb.mongoClient1.connection-string = mongodb://root:example@localhost:27017/
//Routes.java

    @ApplicationScoped
    public class Routes extends RouteBuilder {
        @Inject
        @MongoClientName("mongoClient1")
        MongoClient mongoClient1;

        @Override
        public void configure() throws Exception {
            from("direct:defaultServer")
                .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll")

            from("direct:otherServer")
                .to("mongodb:mongoClient1?database=myOtherDb&collection=myOtherCollection&operation=findAll");
        }
    }

Note that when using named clients, the "default" camelMongoClient bean will still be produced. Refer to the Quarkus documentation on Multiple MongoDB Clients for more information.

2.84. MyBatis

Performs a query, poll, insert, update or delete in a relational database using MyBatis.

2.84.1. What’s inside

Refer to the above links for usage and configuration details.

2.84.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-mybatis</artifactId>
</dependency>

2.84.3. Additional Camel Quarkus configuration

Refer to Quarkus MyBatis for configuration. It must enable the following options

quarkus.mybatis.xmlconfig.enable=true
quarkus.mybatis.xmlconfig.path=SqlMapConfig.xml
Tip

quarkus.mybatis.xmlconfig.path must be the same with configurationUri param in the mybatis endpoint.

2.85. Netty HTTP

The Netty HTTP extension provides HTTP transport on top of the Netty extension.

2.85.1. What’s inside

Refer to the above link for usage and configuration details.

2.85.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-netty-http</artifactId>
</dependency>

2.85.3. transferException option in native mode

To use the transferException option in native mode, you must enable support for object serialization. Refer to the native mode user guide for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.

@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)

2.85.4. Additional Camel Quarkus configuration

  • Check the Character encodings section of the Native mode guide if you expect your application to send or receive requests using non-default encodings.

2.86. Netty

Socket level networking using TCP or UDP with Netty 4.x.

2.86.1. What’s inside

Refer to the above link for usage and configuration details.

2.86.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-netty</artifactId>
</dependency>

2.87. OpenAPI Java

Expose OpenAPI resources defined in Camel REST DSL

2.87.1. What’s inside

Refer to the above link for usage and configuration details.

2.87.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-openapi-java</artifactId>
</dependency>

2.87.3. Usage

You can use this extension to expose REST DSL services to Quarkus OpenAPI. With quarkus-smallrye-openapi, you can access them by /q/openapi?format=json.

Refer to the Quarkus OpenAPI guide for further information.

This is an experimental feature. You can enable it by

quarkus.camel.openapi.expose.enabled=true
Warning

It’s the user’s responsibility to use @RegisterForReflection to register all model classes for reflection.

It doesn’t support the rest services used in org.apache.camel.builder.LambdaRouteBuilder right now. Also, it can not use CDI injection in the RouteBuilder configure() since we get the rest definitions at build time while CDI is unavailable.

2.87.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.openapi.expose.enabled

Expose the Camel REST DSL services to quarkus openapi at build time if 'quarkus.smallrye-openapi' is available.

boolean

false

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.88. OpenTelemetry

Distributed tracing using OpenTelemetry

2.88.1. What’s inside

Refer to the above link for usage and configuration details.

2.88.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-opentelemetry</artifactId>
</dependency>

2.88.3. Usage

The extension automatically creates a Camel OpenTelemetryTracer and binds it to the Camel registry.

In order to send the captured traces to a tracing system, you need to configure some properties within application.properties like those below.

# Identifier for the origin of spans created by the application
quarkus.application.name=my-camel-application

# OTLP exporter endpoint
quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:4317

Refer to the Quarkus OpenTelemetry guide for a full list of configuration options.

Route endpoints can be excluded from tracing by configuring a property named quarkus.camel.opentelemetry.exclude-patterns in application.properties. For example:

# Exclude all direct & netty-http endpoints from tracing
quarkus.camel.opentelemetry.exclude-patterns=direct:*,netty-http:*

2.88.3.1. Exporters

Quarkus OpenTelemetry defaults to the standard OTLP exporter defined in OpenTelemetry. Additional exporters will be available in the Quarkiverse quarkus-opentelemetry-exporter project.

2.88.3.2. Tracing CDI bean method execution

When instrumenting the execution of CDI bean methods from Camel routes, you should annotate such methods with io.opentelemetry.extension.annotations.WithSpan. Methods annotated with @WithSpan will create a new Span and establish any required relationships with the current Trace context.

For example, to instrument a CDI bean from a Camel route, first ensure the appropriate methods are annotated with @WithTrace.

@ApplicationScoped
@Named("myBean")
public class MyBean {
    @WithSpan
    public String greet() {
        return "Hello World!";
    }
}

Next, use the bean in your Camel route.

Important

To ensure that the sequence of recorded spans is correct, you must use the full to("bean:") endpoint URI and not the shortened .bean() EIP DSL method.

public class MyRoutes extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("direct:executeBean")
                .to("bean:myBean?method=greet");
    }
}

There is more information about CDI instrumentation in the Quarkus OpenTelemetry guide.

2.88.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.opentelemetry.encoding

Sets whether header names need to be encoded. Can be useful in situations where OpenTelemetry propagators potentially set header name values in formats that are not compatible with the target system. E.g for JMS where the specification mandates header names are valid Java identifiers.

boolean

false

quarkus.camel.opentelemetry.exclude-patterns

Sets whether to disable tracing for endpoint URIs or Processor ids that match the given comma separated patterns. The pattern can take the following forms:

1. An exact match on the endpoint URI. E.g platform-http:/some/path

2. A wildcard match. E.g platform-http:*

3. A regular expression matching the endpoint URI. E.g platform-http:/prefix/.*

string

 

quarkus.camel.opentelemetry.trace-processors

Sets whether to create new OpenTelemetry spans for each Camel Processor. Use the excludePatterns property to filter out Processors.

boolean

false

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.89. Paho MQTT5

Communicate with MQTT message brokers using Eclipse Paho MQTT v5 Client.

2.89.1. What’s inside

Refer to the above link for usage and configuration details.

2.89.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-paho-mqtt5</artifactId>
</dependency>

2.90. Paho

Communicate with MQTT message brokers using Eclipse Paho MQTT Client.

2.90.1. What’s inside

Refer to the above link for usage and configuration details.

2.90.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-paho</artifactId>
</dependency>

2.91. Platform HTTP

This extension allows for creating HTTP endpoints for consuming HTTP requests.

It is built on top of the Eclipse Vert.x HTTP server provided by the quarkus-vertx-http extension.

2.91.1. What’s inside

Refer to the above link for usage and configuration details.

2.91.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-platform-http</artifactId>
</dependency>

2.91.3. Usage

2.91.3.1. Basic Usage

Serve all HTTP methods on the /hello endpoint:

from("platform-http:/hello").setBody(simple("Hello ${header.name}"));

Serve only GET requests on the /hello endpoint:

from("platform-http:/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}"));

2.91.3.2. Using platform-http via Camel REST DSL

To be able to use Camel REST DSL with the platform-http component, add camel-quarkus-rest to your pom.xml:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest</artifactId>
</dependency>

Then you can use the Camel REST DSL:

rest()
    .get("/my-get-endpoint")
        .to("direct:handleGetRequest");

    .post("/my-post-endpoint")
        .to("direct:handlePostRequest");

2.91.3.3. Handling multipart/form-data file uploads

You can restrict the uploads to certain file extensions by white listing them:

from("platform-http:/upload/multipart?fileNameExtWhitelist=adoc,txt&httpMethodRestrict=POST")
    .to("log:multipart")
    .process(e -> {
        final AttachmentMessage am = e.getMessage(AttachmentMessage.class);
        if (am.hasAttachments()) {
            am.getAttachments().forEach((fileName, dataHandler) -> {
                try (InputStream in = dataHandler.getInputStream()) {
                    // do something with the input stream
                } catch (IOException ioe) {
                    throw new RuntimeException(ioe);
                }
            });
        }
    });

2.91.3.4. Securing platform-http endpoints

Quarkus provides a variety of security and authentication mechanisms which can be used to secure platform-http endpoints. Refer to the Quarkus Security documentation for further details.

Within a route, it is possible to obtain the authenticated user and its associated SecurityIdentity and Principal:

from("platform-http:/secure")
    .process(e -> {
        Message message = e.getMessage();
        QuarkusHttpUser user = message.getHeader(VertxPlatformHttpConstants.AUTHENTICATED_USER, QuarkusHttpUser.class);
        SecurityIdentity securityIdentity = user.getSecurityIdentity();
        Principal principal = securityIdentity.getPrincipal();
        // Do something useful with SecurityIdentity / Principal. E.g check user roles etc.
    });

Also check the quarkus.http.body.* configuration options in Quarkus documentation, esp. quarkus.http.body.handle-file-uploads, quarkus.http.body.uploads-directory and quarkus.http.body.delete-uploaded-files-on-end.

2.91.3.5. Implementing a reverse proxy

Platform HTTP component can act as a reverse proxy, in that case Exchange.HTTP_URI, Exchange.HTTP_HOST headers are populated from the absolute URL received on the request line of the HTTP request.

Here’s an example of a HTTP proxy that simply redirects the Exchange to the origin server.

from("platform-http:proxy")
    .toD("http://"
        + "${headers." + Exchange.HTTP_HOST + "}");

2.91.3.6. Error handling

If you need to customize the reponse returned to the client when exceptions are thrown from your routes, then you can use Camel error handling constucts like doTry, doCatch and onException.

For example, to configure a global exception handler in response to a specific Exception type being thrown.

onException(InvalidOrderTotalException.class)
    .handled(true)
    .setHeader(Exchange.HTTP_RESPONSE_CODE).constant(500)
    .setHeader(Exchange.CONTENT_TYPE).constant("text/plain")
    .setBody().constant("The order total was not greater than 100");

from("platform-http:/orders")
    .choice().when().xpath("//order/total > 100")
        .to("direct:processOrder")
    .otherwise()
        .throwException(new InvalidOrderTotalException());

You can implement more fine-grained error handling by hooking into the Vert.x Web router initialization with a CDI observer.

void initRouter(@Observes Router router) {
    // Custom 404 handler
    router.errorHandler(404, new Handler<RoutingContext>() {
        @Override
        public void handle(RoutingContext event) {
            event.response()
                .setStatusCode(404)
                .putHeader("Content-Type", "text/plain")
                .end("Sorry - resource not found");
        }
    });
}

Note that care should be taken when modifying the router configuration when extensions such as RestEASY are present, since they may register their own error handling logic.

2.91.4. Additional Camel Quarkus configuration

2.91.4.1. Platform HTTP server configuration

Configuration of the platform HTTP server is managed by Quarkus. Refer to the Quarkus HTTP configuration guide for the full list of configuration options.

To configure SSL for the Platform HTTP server, follow the secure connections with SSL guide. Note that configuring the server for SSL with SSLContextParameters is not currently supported.

2.91.4.2. Character encodings

Check the Character encodings section of the Native mode guide if you expect your application to send or receive requests using non-default encodings.

2.92. Quartz

Schedule sending of messages using the Quartz 2.x scheduler.

2.92.1. What’s inside

Refer to the above link for usage and configuration details.

2.92.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-quartz</artifactId>
</dependency>

2.92.3. Usage

2.92.3.1. Clustering

Support for Quartz clustering is provided by the Quarkus Quartz extension. The following steps outline how to configure Quarkus Quartz for use with Camel.

  1. Enable Quartz clustered mode and configure a DataSource as a persistence Quartz job store. An example configuration is as follows.

    # Quartz configuration
    quarkus.quartz.clustered=true
    quarkus.quartz.store-type=jdbc-cmt
    quarkus.scheduler.start-mode=forced
    
    # Datasource configuration
    quarkus.datasource.db-kind=postgresql
    quarkus.datasource.username=quarkus_test
    quarkus.datasource.password=quarkus_test
    quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_test
    
    # Optional automatic creation of Quartz tables
    quarkus.flyway.connect-retries=10
    quarkus.flyway.table=flyway_quarkus_history
    quarkus.flyway.migrate-at-start=true
    quarkus.flyway.baseline-on-migrate=true
    quarkus.flyway.baseline-version=1.0
    quarkus.flyway.baseline-description=Quartz
  2. Add the correct JDBC driver extension to your application that corresponds to the value of quarkus.datasource.db-kind. In the above example postgresql is used, therefore the following JDBC dependency would be required. Adjust as necessary for your needs. Agroal is also required for DataSource support.

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-jdbc-postgresql</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-agroal</artifactId>
    </dependency>
  3. Quarkus Flyway can automatically create the necessary Quartz database tables for you. Add quarkus-flyway to your application (optional).

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-flyway</artifactId>
    </dependency>

    Also add a Quartz database creation script for your chosen database kind. The Quartz project provides ready made scripts that can be copied from here. Add the SQL script to src/main/resources/db/migration/V1.0.0__QuarkusQuartz.sql. Quarkus Flyway will detect it on startup and will proceed to create the Quartz database tables.

  4. Configure the Camel Quartz component to use the Quarkus Quartz scheduler.

    @Produces
    @Singleton
    @Named("quartz")
    public QuartzComponent quartzComponent(Scheduler scheduler) {
        QuartzComponent component = new QuartzComponent();
        component.setScheduler(scheduler);
        return component;
    }

Further customization of the Quartz scheduler can be done via various configuration properties. Refer to to the Quarkus Quartz Configuration guide for more information.

2.93. Qute

Transform messages using Quarkus Qute templating engine

2.93.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-qute</artifactId>
</dependency>

2.93.2. Usage

For more information about Qute, Refer to the Quarkus Qute documentation.

2.93.3. Camel Quarkus limitations

2.93.4. allowContextMapAll option in native mode

The allowContextMapAll option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as CamelContext & Exchange. This is considered a security risk and thus access to the feature is not provided by default.

2.93.5. Additional Camel Quarkus configuration

By default, all files located in the src/main/resources/templates directory and its subdirectories are registered as templates. Templates are validated during startup and watched for changes in the development mode.

2.94. Ref

Route messages to an endpoint looked up dynamically by name in the Camel Registry.

2.94.1. What’s inside

Refer to the above link for usage and configuration details.

2.94.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-ref</artifactId>
</dependency>

2.94.3. Usage

CDI producer methods can be harnessed to bind endpoints to the Camel registry, so that they can be resolved using the ref URI scheme in Camel routes.

For example, to produce endpoint beans:

@ApplicationScoped
public class MyEndpointProducers {
    @Inject
    CamelContext context;

    @Singleton
    @Produces
    @Named("endpoint1")
    public Endpoint directStart() {
        return context.getEndpoint("direct:start");
    }

    @Singleton
    @Produces
    @Named("endpoint2")
    public Endpoint logEnd() {
        return context.getEndpoint("log:end");
    }
}

Use ref: to refer to the names of the CDI beans that were bound to the Camel registry:

public class MyRefRoutes extends RouteBuilder {
    @Override
    public void configure() {
        // direct:start -> log:end
        from("ref:endpoint1")
            .to("ref:endpoint2");
    }
}

2.95. REST OpenApi

To call REST services using OpenAPI specification as contract.

2.95.1. What’s inside

Refer to the above link for usage and configuration details.

2.95.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest-openapi</artifactId>
</dependency>

2.95.3. Usage

2.95.3.1. Required Dependencies

A RestProducerFactory implementation must be available when using the rest-openapi extension. The currently known extensions are:

  • camel-quarkus-http
  • camel-quarkus-netty-http

Maven users will need to add one of these dependencies to their pom.xml, for example:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-http</artifactId>
</dependency>

Depending on which mechanism is used to load the OpenApi specification, additional dependencies may be required. When using the file resource locator, the org.apache.camel.quarkus:camel-quarkus-file extension must be added as a project dependency. When using ref or bean to load the specification, not only must the org.apache.camel.quarkus:camel-quarkus-bean dependency be added, but the bean itself must be annotated with @RegisterForReflection.

When using the classpath resource locator with native code, the path to the OpenAPI specification must be specified in the quarkus.native.resources.includes property of the application.properties file. For example:

quarkus.native.resources.includes=openapi.json

2.95.3.2. Contract First Development

The model classes generation has been integrated with the quarkus-maven-plugin. So there’s no need to use the swagger-codegen-maven-plugin, instead put your contract files in src/main/openapi with a .json suffix. And add the generate-code goal to the quarkus-maven-plugin like:

<plugin>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>generate-code</goal>
            </goals>
        </execution>
    </executions>
</plugin>

It requires a specific package name for the model classes by using the quarkus.camel.openapi.codegen.model-package property of the application.properties file. For example:

quarkus.camel.openapi.codegen.model-package=org.acme

This package name should be added in camel.rest.bindingPackageScan as well.

The contract files in src/main/openapi needs to be added in the classpath since they could be used in Camel Rest DSL. So you can add src/main/openapi in pom.xml

<build>
    <resources>
        <resource>
            <directory>src/main/openapi</directory>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>
</build>

When running in the native mode, the contract files must be specified the quarkus.native.resources.include like

quarkus.native.resources.includes=contract.json

2.95.4. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.openapi.codegen.enabled

If true, Camel Quarkus OpenAPI code generation is run for .json files discovered from the openapi directory. When false, code generation for .json files is disabled.

boolean

true

quarkus.camel.openapi.codegen.model-package

The package to use for generated model classes.

string

org.apache.camel.quarkus

quarkus.camel.openapi.codegen.models

A comma separated list of models to generate. All models is the default.

string

 

quarkus.camel.openapi.codegen.use-bean-validation

If true, use bean validation annotations in the generated model classes.

boolean

false

quarkus.camel.openapi.codegen.not-null-jackson

If true, use NON_NULL Jackson annotation in the generated model classes.

boolean

false

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.96. Rest

Expose REST services and their OpenAPI Specification or call external REST services.

2.96.1. What’s inside

Refer to the above links for usage and configuration details.

2.96.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest</artifactId>
</dependency>

2.96.3. Additional Camel Quarkus configuration

This extension depends on the Platform HTTP extension and configures it as the component that provides the REST transport.

2.96.3.1. Path parameters containing special characters with platform-http

When using the platform-http REST transport, some characters are not allowed within path parameter names. This includes the '-' and '$' characters.

In order to make the below example REST /dashed/param route work correctly, a system property is required io.vertx.web.route.param.extended-pattern=true.

import org.apache.camel.builder.RouteBuilder;

public class CamelRoute extends RouteBuilder {

    @Override
    public void configure() {
        rest("/api")
            // Dash '-' is not allowed by default
            .get("/dashed/param/{my-param}")
            .to("direct:greet")

            // The non-dashed path parameter works by default
            .get("/undashed/param/{myParam}")
            .to("direct:greet");

            from("direct:greet")
                .setBody(constant("Hello World"));
    }
}

There is some more background to this in the Vert.x Web documentation.

2.96.3.2. Configuring alternate REST transport providers

To use another REST transport provider, such as netty-http or servlet, you need to add the respective extension as a dependency to your project and set the provider in your RouteBuilder. E.g. for servlet, you’d have to add the org.apache.camel.quarkus:camel-quarkus-servlet dependency and the set the provider as follows:

import org.apache.camel.builder.RouteBuilder;

public class CamelRoute extends RouteBuilder {

    @Override
    public void configure() {
        restConfiguration()
                .component("servlet");
        ...
    }
}

2.97. Salesforce

Communicate with Salesforce using Java DTOs.

2.97.1. What’s inside

Refer to the above link for usage and configuration details.

2.97.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-salesforce</artifactId>
</dependency>

2.97.3. Usage

2.97.3.1. Generating Salesforce DTOs with the salesforce-maven-plugin

iinclude::camel-quarkus-extensions/maven-plugin-unsupported.adoc[]

To generate Salesforce DTOs for your project, use the salesforce-maven-plugin. The example code snippet below creates a single DTO for the Account object.

<plugin>
    <groupId>org.apache.camel.maven</groupId>
    <artifactId>camel-salesforce-maven-plugin</artifactId>
    <version>{camel-version}</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <clientId>${env.SALESFORCE_CLIENTID}</clientId>
                <clientSecret>${env.SALESFORCE_CLIENTSECRET}</clientSecret>
                <userName>${env.SALESFORCE_USERNAME}</userName>
                <password>${env.SALESFORCE_PASSWORD}</password>
                <loginUrl>https://login.salesforce.com</loginUrl>
                <packageName>org.apache.camel.quarkus.component.salesforce.generated</packageName>
                <outputDirectory>src/main/java</outputDirectory>
                <includes>
                    <include>Account</include>
                </includes>
            </configuration>
        </execution>
    </executions>
</plugin>

2.97.3.2. Native mode support for Pub / Sub API with POJO pubSubDeserializeType

When using the Camel Salesforce Pub / Sub API and pubSubDeserializeType is configured as POJO, you must register any classes configured on the pubSubPojoClass option for reflection.

For example, given the following route.

from("salesforce:pubSubSubscribe:/event/TestEvent__e?pubSubDeserializeType=POJO&pubSubPojoClass=org.foo.TestEvent")
    .log("Received Salesforce POJO topic message: ${body}");

Class org.foo.TestEvent would need to be registered for reflection.

package org.foo;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public class TestEvent {
    // Getters / setters etc
}

Refer to the Native mode user guide for more information.

2.97.4. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.98. Saga

Execute custom actions within a route using the Saga EIP.

2.98.1. What’s inside

Refer to the above link for usage and configuration details.

2.98.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-saga</artifactId>
</dependency>

2.99. SAP

Provides SAP Camel Component

2.99.1. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-sap</artifactId>
</dependency>

2.99.2. Camel Quarkus limitations

The SAP extension does not support the packaging type uber-jar which causes the application to throw a runtime exception similar to this:

Caused by: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.ExceptionInInitializerError: Illegal JCo archive "sap-1.0.0-SNAPSHOT-runner.jar". It is not allowed to rename or repackage the original archive "sapjco3.jar".

2.100. XQuery

Query and/or transform XML payloads using XQuery and Saxon.

2.100.1. What’s inside

Refer to the above links for usage and configuration details.

2.100.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-saxon</artifactId>
</dependency>

2.100.3. Additional Camel Quarkus configuration

This component is able to load XQuery definitions from classpath. To make it work also in native mode, you need to explicitly embed the queries in the native executable by using the quarkus.native.resources.includes property.

For instance, the two routes below load an XQuery script from two classpath resources named myxquery.txt and another-xquery.txt respectively:

from("direct:start").transform().xquery("resource:classpath:myxquery.txt", String.class);
from("direct:start").to("xquery:another-xquery.txt");

To include these (an possibly other queries stored in .txt files) in the native image, you would have to add something like the following to your application.properties file:

quarkus.native.resources.includes = *.txt

More information about selecting resources for inclusion in the native executable can be found at Embedding resource in native executable.

2.101. AWS Secrets Manager

Manage AWS Secrets Manager services using AWS SDK version 2.x.

2.101.1. What’s inside

Refer to the above link for usage and configuration details.

2.101.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-aws-secrets-manager</artifactId>
</dependency>

2.101.3. AWS Secrets Manager Limitation in Camel 4.8

With Camel 4.8, the camel context reload is not triggered by executing updateSecret via Camel.

If you want to use the AWS Secrets Manager feature Automatic Camel context reloading on secret refresh, you must do one of the following:

  • update the secret via UI,

    or

  • make an API call with operation PutSecretValue.

2.102. Scheduler

Generate messages in specified intervals using java.util.concurrent.ScheduledExecutorService.

2.102.1. What’s inside

Refer to the above link for usage and configuration details.

2.102.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-scheduler</artifactId>
</dependency>

2.103. SEDA

Asynchronously call another endpoint from any Camel Context in the same JVM.

2.103.1. What’s inside

Refer to the above link for usage and configuration details.

2.103.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-seda</artifactId>
</dependency>

2.104. Servlet

Serve HTTP requests by a Servlet.

2.104.1. What’s inside

Refer to the above link for usage and configuration details.

2.104.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-servlet</artifactId>
</dependency>

2.104.3. Usage

2.104.3.1. Configuring CamelHttpTransportServlet

2.104.3.1.1. Minimal configuration

The simplest way to configure CamelHttpTransportServlet is with configuration properties. The most minimal setup requires that you define one or more URL patterns for the Servlet with quarkus.camel.servlet.url-patterns.

For example with configuration like the following.

quarkus.camel.servlet.url-patterns = /*

And a Camel route.

from("servlet://greet")
    .setBody().constant("Hello World");

Produces the message Hello World.

2.104.3.1.2. Advanced configuration

Servlet name

To give a specific name to the Servlet you can use the quarkus.camel.servlet.servlet-name configuration option.

quarkus.camel.servlet.servlet-name = My Custom Name

Servlet class

You may use a custom Servlet class (E.g one that extends CamelHttpTransportServlet) in your Camel routes.

quarkus.camel.servlet.servlet-class = org.acme.MyCustomServlet

Multiple named Servlets

For more advanced use cases you can configure multiple 'named' Servlets.

quarkus.camel.servlet.my-servlet-a.servlet-name = my-custom-a
quarkus.camel.servlet.my-servlet-a.url-patterns = /custom/a/*

quarkus.camel.servlet.my-servlet-b.servlet-name = my-custom-b
quarkus.camel.servlet.my-servlet-b.servlet-class = org.acme.CustomServletB
quarkus.camel.servlet.my-servlet-b.url-patterns = /custom/b/*
from("servlet://greet?servletName=my-custom-a")
    .setBody().constant("Hello World");

from("servlet://goodbye?servletName=my-custom-b")
    .setBody().constant("Goodbye World");

Finer control of Servlet configuration

If you need more control of the Servlet configuration, for example to configure custom init parameters, then you can do this with a custom Servlet class through the jakarta.servlet.annotation.WebServlet annotation options.

import jakarta.servlet.annotation.WebServlet;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;

@WebServlet(
    urlPatterns = {"/*"},
    initParams = {
        @WebInitParam(name = "myParam", value = "myValue")
    }
)
public class MyCustomServlet extends CamelHttpTransportServlet {
}

Or you can configure the CamelHttpTransportServlet using a web-app descriptor placed into src/main/resources/META-INF/web.xml.

<web-app>
  <servlet>
    <servlet-name>CamelServlet</servlet-name>
    <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CamelServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
</web-app>

2.104.4. transferException option in native mode

To use the transferException option in native mode, you must enable support for object serialization. Refer to the native mode user guide for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.

@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)

2.104.5. Additional Camel Quarkus configuration

Configuration propertyTypeDefault

quarkus.camel.servlet.url-patterns

A comma separated list of path patterns under which the CamelServlet should be accessible. Example path patterns: /*, /services/*

List of string

 

quarkus.camel.servlet.servlet-class

A fully qualified name of a servlet class to serve paths that match url-patterns

string

org.apache.camel.component.servlet.CamelHttpTransportServlet

quarkus.camel.servlet.servlet-name

A servletName as it would be defined in a web.xml file or in the jakarta.servlet.annotation.WebServlet#name() annotation.

string

CamelServlet

quarkus.camel.servlet.load-on-startup

Sets the loadOnStartup priority on the Servlet. A loadOnStartup is a value greater than or equal to zero, indicates to the container the initialization priority of the Servlet. If loadOnStartup is a negative integer, the Servlet is initialized lazily.

int

-1

quarkus.camel.servlet.async

Enables Camel to benefit from asynchronous Servlet support.

boolean

false

quarkus.camel.servlet.force-await

When set to true used in conjunction with quarkus.camel.servlet.async = true, this will force route processing to run synchronously.

boolean

false

quarkus.camel.servlet.executor-ref

The name of a bean to configure an optional custom thread pool for handling Camel Servlet processing.

string

 

quarkus.camel.servlet.multipart.location

An absolute path to a directory on the file system to store files temporarily while the parts are processed or when the size of the file exceeds the specified file-size-threshold configuration value.

string

${java.io.tmpdir}

quarkus.camel.servlet.multipart.max-file-size

The maximum size allowed in bytes for uploaded files. The default size (-1) allows an unlimited size.

long

-1

quarkus.camel.servlet.multipart.max-request-size

The maximum size allowed in bytes for a multipart/form-data request. The default size (-1) allows an unlimited size.

long

-1

quarkus.camel.servlet.multipart.file-size-threshold

The file size in bytes after which the file will be temporarily stored on disk.

int

0

[[quarkus-camel-servlet—​named-servlets—​url-patterns]] quarkus.camel.servlet."named-servlets".url-patterns

A comma separated list of path patterns under which the CamelServlet should be accessible. Example path patterns: /*, /services/*

List of string

 

[[quarkus-camel-servlet—​named-servlets—​servlet-class]] quarkus.camel.servlet."named-servlets".servlet-class

A fully qualified name of a servlet class to serve paths that match url-patterns

string

org.apache.camel.component.servlet.CamelHttpTransportServlet

[[quarkus-camel-servlet—​named-servlets—​servlet-name]] quarkus.camel.servlet."named-servlets".servlet-name

A servletName as it would be defined in a web.xml file or in the jakarta.servlet.annotation.WebServlet#name() annotation.

string

CamelServlet

[[quarkus-camel-servlet—​named-servlets—​load-on-startup]] quarkus.camel.servlet."named-servlets".load-on-startup

Sets the loadOnStartup priority on the Servlet. A loadOnStartup is a value greater than or equal to zero, indicates to the container the initialization priority of the Servlet. If loadOnStartup is a negative integer, the Servlet is initialized lazily.

int

-1

quarkus.camel.servlet."named-servlets".async

Enables Camel to benefit from asynchronous Servlet support.

boolean

false

[[quarkus-camel-servlet—​named-servlets—​force-await]] quarkus.camel.servlet."named-servlets".force-await

When set to true used in conjunction with quarkus.camel.servlet.async = true, this will force route processing to run synchronously.

boolean

false

[[quarkus-camel-servlet—​named-servlets—​executor-ref]] quarkus.camel.servlet."named-servlets".executor-ref

The name of a bean to configure an optional custom thread pool for handling Camel Servlet processing.

string

 

[[quarkus-camel-servlet—​named-servlets—​multipart-location]] quarkus.camel.servlet."named-servlets".multipart.location

An absolute path to a directory on the file system to store files temporarily while the parts are processed or when the size of the file exceeds the specified file-size-threshold configuration value.

string

${java.io.tmpdir}

[[quarkus-camel-servlet—​named-servlets—​multipart-max-file-size]] quarkus.camel.servlet."named-servlets".multipart.max-file-size

The maximum size allowed in bytes for uploaded files. The default size (-1) allows an unlimited size.

long

-1

[[quarkus-camel-servlet—​named-servlets—​multipart-max-request-size]] quarkus.camel.servlet."named-servlets".multipart.max-request-size

The maximum size allowed in bytes for a multipart/form-data request. The default size (-1) allows an unlimited size.

long

-1

[[quarkus-camel-servlet—​named-servlets—​multipart-file-size-threshold]] quarkus.camel.servlet."named-servlets".multipart.file-size-threshold

The file size in bytes after which the file will be temporarily stored on disk.

int

0

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.105. Slack

Send and receive messages to/from Slack.

2.105.1. What’s inside

Refer to the above link for usage and configuration details.

2.105.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-slack</artifactId>
</dependency>

2.105.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.106. SMB

SMB component which consumes natively from file shares using the Server Message Block (SMB, also known as Common Internet File System - CIFS) protocol

2.106.1. What’s inside

Refer to the above link for usage and configuration details.

2.106.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-smb</artifactId>
</dependency>

2.107. SNMP

Receive traps and poll SNMP (Simple Network Management Protocol) capable devices.

2.107.1. What’s inside

Refer to the above link for usage and configuration details.

2.107.2. Maven coordinates

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-snmp</artifactId>
</dependency>

2.108. SOAP dataformat

Marshal Java objects to SOAP messages and back.

2.108.1. What’s inside

Refer to the above link for usage and configuration details.

2.108.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-soap</artifactId>
</dependency>

2.109. Splunk

Publish or search for events in Splunk.

2.109.1. What’s inside

Refer to the above link for usage and configuration details.

2.109.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-splunk</artifactId>
</dependency>

2.109.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.110. Splunk HEC

The splunk component allows to publish events in Splunk using the HTTP Event Collector.

2.110.1. What’s inside

Refer to the above link for usage and configuration details.

2.110.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-splunk-hec</artifactId>
</dependency>

2.110.3. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.111. Spring RabbitMQ

Send and receive messages from RabbitMQ using Spring RabbitMQ client.

2.111.1. What’s inside

Refer to the above link for usage and configuration details.

2.111.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-spring-rabbitmq</artifactId>
</dependency>

2.111.3. Camel Quarkus limitations

You can use this extension without any special configuration in JVM mode.

In native mode you need to add

quarkus.native.additional-build-args = -H:+InlineBeforeAnalysis

to your application.properties. This is to allow inlining of some static methods that would otherwise cause build failures (see this GraalVM issue).

2.112. SQL

Perform SQL queries.

2.112.1. What’s inside

Refer to the above links for usage and configuration details.

2.112.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-sql</artifactId>
</dependency>

2.112.3. Additional Camel Quarkus configuration

2.112.3.1. Configuring a DataSource

This extension leverages Quarkus Agroal for DataSource support. Setting up a DataSource can be achieved via configuration properties.

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=your-username
quarkus.datasource.password=your-password
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/your-database
quarkus.datasource.jdbc.max-size=16

The Camel SQL component will automatically resolve the DataSource bean from the registry. When configuring multiple datasources, you can specify which one is to be used on an SQL endpoint via the URI options datasource or dataSourceRef. Refer to the SQL component documentation for more details.

2.112.3.1.1. Zero configuration with Quarkus Dev Services

In dev and test mode you can take advantage of Configuration Free Databases. The Camel SQL component will be automatically configured to use a DataSource that points to a local containerized instance of the database matching the JDBC driver type that you have selected.

2.112.3.2. SQL scripts

When configuring sql or sql-stored endpoints to reference script files from the classpath, set the following configuration property to ensure that they are available in native mode.

quarkus.native.resources.includes = queries.sql, sql/*.sql

2.112.3.3. SQL aggregation repository in native mode

In order to use SQL aggregation repositories like JdbcAggregationRepository in native mode, you must enable native serialization support.

In addition, if your exchange bodies are custom types, they must be registered for serialization by annotating their class declaration with @RegisterForReflection(serialization = true).

2.113. Telegram

Send and receive messages using the Telegram Bot API.

2.113.1. What’s inside

Refer to the above link for usage and configuration details.

2.113.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-telegram</artifactId>
</dependency>

2.113.3. Usage

2.113.4. Webhook Mode

The Telegram extension supports usage in the webhook mode.

In order to enable webhook mode, users need first to add a REST implementation to their application. Maven users, for example, can add camel-quarkus-rest extension to their pom.xml file:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-rest</artifactId>
</dependency>

2.113.4.1. Webhook

Important

In this release of Red Hat build of Apache Camel for Quarkus, webhook mode is not supported.

2.113.5. SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add quarkus.ssl.native=true to your application.properties yourself. See also Quarkus SSL guide.

2.114. Timer

Generate messages in specified intervals using java.util.Timer.

2.114.1. What’s inside

Refer to the above link for usage and configuration details.

2.114.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-timer</artifactId>
</dependency>

2.115. Validator

Validate the payload using XML Schema and JAXP Validation.

2.115.1. What’s inside

Refer to the above link for usage and configuration details.

2.115.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-validator</artifactId>
</dependency>

2.116. Velocity

Transform messages using a Velocity template.

2.116.1. What’s inside

Refer to the above link for usage and configuration details.

2.116.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-velocity</artifactId>
</dependency>

2.116.3. Usage

2.116.3.1. Custom body as domain object in the native mode

When using a custom object as message body and referencing its properties in the template in the native mode, all the classes need to be registered for reflection (see the documentation).

Example:

@RegisterForReflection
public interface CustomBody {
}

2.116.4. allowContextMapAll option in native mode

The allowContextMapAll option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as CamelContext & Exchange. This is considered a security risk and thus access to the feature is not provided by default.

2.116.5. Additional Camel Quarkus configuration

This component typically loads Velocity templates from classpath. To make it work also in native mode, you need to explicitly embed the templates in the native executable by using the quarkus.native.resources.includes property.

For instance, the route below would load the Velocity template from a classpath resource named template/simple.vm:

from("direct:start").to("velocity://template/simple.vm");

To include this (an possibly other templates stored in .vm files in the template directory) in the native image, you would have to add something like the following to your application.properties file:

quarkus.native.resources.includes = template/*.vm

More information about selecting resources for inclusion in the native executable can be found at Embedding resource in native executable.

2.117. Vert.x HTTP Client

Camel HTTP client support with Vert.x

2.117.1. What’s inside

Refer to the above link for usage and configuration details.

2.117.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-vertx-http</artifactId>
</dependency>

2.117.3. transferException option in native mode

To use the transferException option in native mode, you must enable support for object serialization. Refer to the native mode user guide for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.

@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)

2.117.4. Additional Camel Quarkus configuration

2.117.5. allowJavaSerializedObject option in native mode

When using the allowJavaSerializedObject option in native mode, the support of serialization might need to be enabled. Please, refer to the native mode user guide for more information.

2.117.5.1. Character encodings

Check the Character encodings section of the Native mode guide if the application is expected to send and receive requests using non-default encodings.

2.118. Vert.x WebSocket

This extension enables you to create WebSocket endpoints to that act as either a WebSocket server, or as a client to connect an existing WebSocket .

It is built on top of the Eclipse Vert.x HTTP server provided by the quarkus-vertx-http extension.

2.118.1. What’s inside

Refer to the above link for usage and configuration details.

2.118.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-vertx-websocket</artifactId>
</dependency>

2.118.3. Usage

2.118.3.1. Vert.x WebSocket consumers

When you create a Vert.x WebSocket consumer (E.g with from("vertx-websocket")), the host and port configuration in the URI are redundant since the WebSocket will always be hosted on the Quarkus HTTP server.

The configuration of the consumer can be simplified to only include the resource path of the WebSocket. For example.

from("vertx-websocket:/my-websocket-path")
    .setBody().constant("Hello World");
Note

While you do not need to explicitly configure the host/port on the vertx-websocket consumer. If you choose to, the host & port must exactly match the value of the Quarkus HTTP server configuration values for quarkus.http.host and quarkus.http.port. Otherwise an exception will be thrown at runtime.

2.118.3.2. Vert.x WebSocket producers

Similar to above, if you want to produce messages to the internal Vert.x WebSocket consumer, then you can omit the host and port from the endpoint URI.

from("vertx-websocket:/my-websocket-path")
    .log("Got body: ${body}");

from("direct:sendToWebSocket")
    .log("vertx-websocket:/my-websocket-path");

Or alternatively, you can refer to the full host & port configuration for the Quarkus HTTP server.

from("direct:sendToWebSocket")
    .log("vertx-websocket:{{quarkus.http.host}}:{{quarkus.http.port}}/my-websocket-path");

When producing messages to an external WebSocket server, then you must always provide the host name and port (if required).

2.118.4. Additional Camel Quarkus configuration

2.118.4.1. Vert.x WebSocket server configuration

Configuration of the Vert.x WebSocket server is managed by Quarkus. Refer to the Quarkus HTTP configuration guide for the full list of configuration options.

To configure SSL for the Vert.x WebSocket server, follow the secure connections with SSL guide. Note that configuring the server for SSL with SSLContextParameters is not currently supported.

2.118.4.2. Character encodings

Check the Character encodings section of the Native mode guide if you expect your application to send or receive requests using non-default encodings.

2.119. XJ

Transform JSON and XML message using a XSLT.

2.119.1. What’s inside

Refer to the above link for usage and configuration details.

2.119.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xj</artifactId>
</dependency>

2.120. XML IO DSL

An XML stack for parsing XML route definitions

2.120.1. What’s inside

Refer to the above link for usage and configuration details.

2.120.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xml-io-dsl</artifactId>
</dependency>

2.120.3. Additional Camel Quarkus configuration

2.120.3.1. XML file encodings

By default, some XML file encodings may not work out of the box in native mode. Please, check the Character encodings section to learn how to fix.

2.121. XML JAXP

XML JAXP type converters and parsers

2.121.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xml-jaxp</artifactId>
</dependency>

2.122. XPath

Evaluates an XPath expression against an XML payload

2.122.1. What’s inside

Refer to the above link for usage and configuration details.

2.122.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xpath</artifactId>
</dependency>

2.122.3. Additional Camel Quarkus configuration

This component is able to load xpath expressions from classpath resources. To make it work also in native mode, you need to explicitly embed the expression files in the native executable by using the quarkus.native.resources.includes property.

For instance, the route below would load an XPath expression from a classpath resource named myxpath.txt:

from("direct:start").transform().xpath("resource:classpath:myxpath.txt");

To include this (an possibly other expressions stored in .txt files) in the native image, you would have to add something like the following to your application.properties file:

quarkus.native.resources.includes = *.txt

More information about selecting resources for inclusion in the native executable can be found at Embedding resource in native executable.

2.123. XSLT Saxon

Transform XML payloads using an XSLT template using Saxon.

2.123.1. What’s inside

Refer to the above link for usage and configuration details.

2.123.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xslt-saxon</artifactId>
</dependency>

2.124. XSLT

Transforms XML payload using an XSLT template.

2.124.1. What’s inside

Refer to the above link for usage and configuration details.

2.124.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-xslt</artifactId>
</dependency>

2.124.3. Additional Camel Quarkus configuration

To optimize XSLT processing, the extension needs to know the locations of the XSLT templates at build time. The XSLT source URIs have to be passed via the quarkus.camel.xslt.sources property. Multiple URIs can be separated by comma.

quarkus.camel.xslt.sources = transform.xsl, classpath:path/to/my/file.xsl

Scheme-less URIs are interpreted as classpath: URIs.

Only classpath: URIs are supported on Quarkus native mode. file:, http: and other kinds of URIs can be used on JVM mode only.

<xsl:include> and <xsl:messaging> XSLT elements are also supported in JVM mode only right now.

If aggregate DSL is used, XsltSaxonAggregationStrategy has to be used such as

from("file:src/test/resources?noop=true&sortBy=file:name&antInclude=*.xml")
   .routeId("aggregate").noAutoStartup()
   .aggregate(new XsltSaxonAggregationStrategy("xslt/aggregate.xsl"))
   .constant(true)
   .completionFromBatchConsumer()
   .log("after aggregate body: ${body}")
   .to("mock:transformed");

Also, it’s only supported on JVM mode.

2.124.3.1. Configuration

TransformerFactory features can be configured using following property:

quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing"=false

2.124.3.2. Extension functions support

Xalan’s extension functions do work properly only when:

  1. Secure-processing is disabled
  2. Functions are defined in a separate jar
  3. Functions are augmented during native build phase. For example, they can be registered for reflection:
@RegisterForReflection(targets = { my.Functions.class })
public class FunctionsConfiguration {
}
Note

The content of the XSLT source URIs is parsed and compiled into Java classes at build time. These Java classes are the only source of XSLT information at runtime. The XSLT source files may not be included in the application archive at all.

Configuration propertyTypeDefault

quarkus.camel.xslt.sources

A comma separated list of templates to compile.

List of string

 

quarkus.camel.xslt.package-name

The package name for the generated classes.

string

org.apache.camel.quarkus.component.xslt.generated

[[quarkus-camel-xslt-features—​features]] quarkus.camel.xslt.features."features"

TransformerFactory features.

Map<String,Boolean>

 

Configuration property fixed at build time. All other configuration properties are overridable at runtime.

2.125. YAML DSL

An YAML stack for parsing YAML route definitions

2.125.1. What’s inside

Refer to the above link for usage and configuration details.

2.125.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-yaml-dsl</artifactId>
</dependency>

2.125.3. Usage

2.125.3.1. Native mode

The following constructs when defined within Camel YAML DSL markup, require you to register classes for reflection. Refer to the Native mode guide for details.

2.125.3.1.1. Bean definitions

The YAML DSL provides the capability to define beans as follows.

- beans:
    - name: "greetingBean"
      type: "org.acme.GreetingBean"
      properties:
        greeting: "Hello World!"
- route:
    id: "my-yaml-route"
    from:
      uri: "timer:from-yaml?period=1000"
      steps:
        - to: "bean:greetingBean"

In this example, the GreetingBean class needs to be registered for reflection. This applies to any types that you refer to under the beans key in your YAML routes.

@RegisterForReflection
public class GreetingBean {
}
2.125.3.1.2. Exception handling

Camel provides various methods of handling exceptions. Some of these require that any exception classes referenced in their DSL definitions are registered for reflection.

on-exception

- on-exception:
    handled:
      constant: "true"
    exception:
      - "org.acme.MyHandledException"
    steps:
      - transform:
          constant: "Sorry something went wrong"
@RegisterForReflection
public class MyHandledException {
}

throw-exception

- route:
    id: "my-yaml-route"
    from:
      uri: "direct:start"
      steps:
        - choice:
            when:
              - simple: "${body} == 'bad value'"
                steps:
                  - throw-exception:
                      exception-type: "org.acme.ForcedException"
                      message: "Forced exception"
            otherwise:
              steps:
                - to: "log:end"
@RegisterForReflection
public class ForcedException {
}

do-catch

- route:
    id: "my-yaml-route2"
    from:
      uri: "direct:tryCatch"
      steps:
        - do-try:
            steps:
              - to: "direct:readFile"
            do-catch:
              - exception:
                  - "java.io.FileNotFoundException"
                steps:
                  - transform:
                      constant: "do-catch caught an exception"
@RegisterForReflection(targets = FileNotFoundException.class)
public class MyClass {
}

2.126. YAML IO

Dump routes in YAML format

2.126.1. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-yaml-io</artifactId>
</dependency>

2.126.2. Usage

This an auxiliary extension that provides support for Camel route dumping in YAML.

For example, when the application is configured to dump routes on startup with the following configuration in application.properties.

camel.main.dump-routes = yaml

2.127. Zip Deflate Compression

Compress and decompress streams using java.util.zip.Deflater, java.util.zip.Inflater or java.util.zip.GZIPStream.

2.127.1. What’s inside

Refer to the above links for usage and configuration details.

2.127.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-zip-deflater</artifactId>
</dependency>

2.128. Zip File

Compression and decompress streams using java.util.zip.ZipStream.

2.128.1. What’s inside

Refer to the above link for usage and configuration details.

2.128.2. Maven coordinates

Create a new project with this extension on https://code.quarkus.io

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-zipfile</artifactId>
</dependency>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.