Questo contenuto non è disponibile nella lingua selezionata.
Chapter 2. Camel Quarkus extensions reference
This chapter provides usage information for Red Hat build of Apache Camel for Quarkus.
2.1. AMQP Copia collegamentoCollegamento copiato negli appunti!
Messaging with AMQP protocol using Apache QPid Client.
2.1.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AMQP component, URI syntax:
amqp:destinationType:destinationName
Refer to the above link for usage and configuration details.
2.1.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
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 Copia collegamentoCollegamento copiato negli appunti!
2.1.3.1. Message mapping with org.w3c.dom.Node Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
Support for attachments on Camel messages
2.2.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.2.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-attachments</artifactId>
</dependency>
2.3. Avro Copia collegamentoCollegamento copiato negli appunti!
Serialize and deserialize messages using Apache Avro binary data format.
2.3.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.3.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
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 Copia collegamentoCollegamento copiato negli appunti!
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:
-
Store
*.avscfiles in a folder namedsrc/main/avroorsrc/test/avro In addition to the usual
buildgoal ofquarkus-maven-plugin, add thegenerate-codegoal:<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 Secrets Manager Copia collegamentoCollegamento copiato negli appunti!
Manage AWS Secrets Manager services using AWS SDK version 2.x.
2.4.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS Secrets Manager component, URI syntax:
aws-secrets-manager:label
Refer to the above link for usage and configuration details.
2.4.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws-secrets-manager</artifactId>
</dependency>
2.5. AWS 2 CloudWatch Copia collegamentoCollegamento copiato negli appunti!
Sending metrics to AWS CloudWatch.
2.5.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS CloudWatch component, URI syntax:
aws2-cw:namespace
Refer to the above link for usage and configuration details.
2.5.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-cw</artifactId>
</dependency>
2.5.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.6. AWS 2 DynamoDB Copia collegamentoCollegamento copiato negli appunti!
Store and retrieve data from AWS DynamoDB service or receive messages from AWS DynamoDB Stream using AWS SDK version 2.x.
2.6.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS DynamoDB component, URI syntax:
aws2-ddb:tableName -
AWS DynamoDB Streams component, URI syntax:
aws2-ddbstream:tableName
Refer to the above links for usage and configuration details.
2.6.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-ddb</artifactId>
</dependency>
2.6.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.6.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.6.4.1. Optional integration with Quarkus Amazon DynamoDB Copia collegamentoCollegamento copiato negli appunti!
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:
The client type
apachehas to be selected by configuring the following property:quarkus.dynamodb.sync-client.type=apacheThe
DynamoDbClienthas 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 injectingDynamoDbClient: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.7. AWS 2 Kinesis Copia collegamentoCollegamento copiato negli appunti!
Consume and produce records from AWS Kinesis Streams using AWS SDK version 2.x.
2.7.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS Kinesis component, URI syntax:
aws2-kinesis:streamName -
AWS Kinesis Firehose component, URI syntax:
aws2-kinesis-firehose:streamName
Refer to the above links for usage and configuration details.
2.7.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-kinesis</artifactId>
</dependency>
2.7.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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. AWS 2 Lambda Copia collegamentoCollegamento copiato negli appunti!
Manage and invoke AWS Lambda functions using AWS SDK version 2.x.
2.8.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS Lambda component, URI syntax:
aws2-lambda:function
Refer to the above link for usage and configuration details.
2.8.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-lambda</artifactId>
</dependency>
2.8.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
2.8.4.1. Not possible to leverage quarkus-amazon-lambda by Camel aws2-lambda extension Copia collegamentoCollegamento copiato negli appunti!
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.9. AWS 2 S3 Storage Service Copia collegamentoCollegamento copiato negli appunti!
Store and retrieve objects from AWS S3 Storage Service.
2.9.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS S3 Storage Service component, URI syntax:
aws2-s3://bucketNameOrArn
Refer to the above link for usage and configuration details.
2.9.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-s3</artifactId>
</dependency>
2.9.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
2.9.4.1. Optional integration with Quarkus Amazon S3 Copia collegamentoCollegamento copiato negli appunti!
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:
The client type
apachehas to be selected by configuring the following property:quarkus.s3.sync-client.type=apacheThe
S3Clienthas 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 injectingS3Client: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.10. AWS 2 Simple Notification System (SNS) Copia collegamentoCollegamento copiato negli appunti!
Send messages to AWS Simple Notification Topic.
2.10.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS Simple Notification System (SNS) component, URI syntax:
aws2-sns:topicNameOrArn
Refer to the above link for usage and configuration details.
2.10.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-sns</artifactId>
</dependency>
2.10.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
2.10.4.1. Optional integration with Quarkus Amazon SNS Copia collegamentoCollegamento copiato negli appunti!
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:
The client type
apachehas to be selected by configuring the following property:quarkus.sns.sync-client.type=apacheThe
SnsClienthas 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 injectingSnsClient: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.11. AWS 2 Simple Queue Service (SQS) Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from AWS SQS.
2.11.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
AWS Simple Queue Service (SQS) component, URI syntax:
aws2-sqs:queueNameOrArn
Refer to the above link for usage and configuration details.
2.11.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-sqs</artifactId>
</dependency>
2.11.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.11.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.11.4.1. Optional integration with Quarkus Amazon SQS Copia collegamentoCollegamento copiato negli appunti!
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:
The client type
apachehas to be selected by configuring the following property:quarkus.sqs.sync-client.type=apacheThe
SqsClienthas 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 injectingSqsClient: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.12. Azure Event Hubs Copia collegamentoCollegamento copiato negli appunti!
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.12.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Azure Event Hubs component, URI syntax:
azure-eventhubs:namespace/eventHubName
Refer to the above link for usage and configuration details.
2.12.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-eventhubs</artifactId>
</dependency>
2.12.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.12.3.1. Micrometer metrics support Copia collegamentoCollegamento copiato negli appunti!
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.12.4. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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 Key Vault Copia collegamentoCollegamento copiato negli appunti!
Manage secrets and keys in Azure Key Vault Service
2.13.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Azure Key Vault component, URI syntax:
azure-key-vault:vaultName
Refer to the above link for usage and configuration details.
2.13.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-key-vault</artifactId>
</dependency>
2.13.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.14. Azure ServiceBus Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from Azure Event Bus.
2.14.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Azure ServiceBus component, URI syntax:
azure-servicebus:topicOrQueueName
Refer to the above link for usage and configuration details.
2.14.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-servicebus</artifactId>
</dependency>
2.15. Azure Storage Blob Service Copia collegamentoCollegamento copiato negli appunti!
Store and retrieve blobs from Azure Storage Blob Service using SDK v12.
2.15.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Azure Storage Blob Service component, URI syntax:
azure-storage-blob:accountName/containerName
Refer to the above link for usage and configuration details.
2.15.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-storage-blob</artifactId>
</dependency>
2.15.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.15.3.1. Micrometer metrics support Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
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. Azure Storage Queue Service Copia collegamentoCollegamento copiato negli appunti!
The azure-storage-queue component is used for storing and retrieving the messages to/from Azure Storage Queue using Azure SDK v12.
2.16.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Azure Storage Queue Service component, URI syntax:
azure-storage-queue:accountName/queueName
Refer to the above link for usage and configuration details.
2.16.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-azure-storage-queue</artifactId>
</dependency>
2.16.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.16.3.1. Micrometer metrics support Copia collegamentoCollegamento copiato negli appunti!
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.16.4. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.17. Bean Validator Copia collegamentoCollegamento copiato negli appunti!
Validate the message body using the Java Bean Validation API.
2.17.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Bean Validator component, URI syntax:
bean-validator:label
Refer to the above link for usage and configuration details.
2.17.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bean-validator</artifactId>
</dependency>
2.17.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.17.3.1. Configuring the ValidatorFactory Copia collegamentoCollegamento copiato negli appunti!
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.17.3.2. Custom validation groups in native mode Copia collegamentoCollegamento copiato negli appunti!
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.17.4. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.18. Bean Copia collegamentoCollegamento copiato negli appunti!
Invoke methods of Java beans
2.18.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Bean component, URI syntax:
bean:beanName - Bean Method language
-
Class component, URI syntax:
class:beanName
Refer to the above links for usage and configuration details.
2.18.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bean</artifactId>
</dependency>
2.18.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.19. BeanIO Copia collegamentoCollegamento copiato negli appunti!
Marshal and unmarshal Java beans to and from flat files (such as CSV, delimited, or fixed length formats).
2.19.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.19.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-beanio</artifactId>
</dependency>
2.20. Bindy Copia collegamentoCollegamento copiato negli appunti!
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.20.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above links for usage and configuration details.
2.20.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bindy</artifactId>
</dependency>
2.20.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.21. Browse Copia collegamentoCollegamento copiato negli appunti!
Inspect the messages received on endpoints supporting BrowsableEndpoint.
2.21.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Browse component, URI syntax:
browse:name
Refer to the above link for usage and configuration details.
2.21.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-browse</artifactId>
</dependency>
2.22. Cassandra CQL Copia collegamentoCollegamento copiato negli appunti!
Integrate with Cassandra 2.0 using the CQL3 API (not the Thrift API). Based on Cassandra Java Driver provided by DataStax.
2.22.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Cassandra CQL component, URI syntax:
cql:beanRef:hosts:port/keyspace
Refer to the above link for usage and configuration details.
2.22.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cassandraql</artifactId>
</dependency>
2.22.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.22.3.1. Cassandra aggregation repository in native mode Copia collegamentoCollegamento copiato negli appunti!
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.23. CICS Copia collegamentoCollegamento copiato negli appunti!
Interact with the IBM CICS® general-purpose transaction processing subsystem.
CICS is only supported in JVM mode.
Only synchronous mode calls are supported.
2.23.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
CICS component, URI syntax:
cics://[interfaceType]/[dataExchangeType][?options]
Refer to the above link for usage and configuration details.
2.23.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cics</artifactId>
</dependency>
2.24. CLI Connector Copia collegamentoCollegamento copiato negli appunti!
Runtime adapter connecting with Camel CLI
2.24.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.24.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cli-connector</artifactId>
</dependency>
2.24.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
Sets whether to enable Camel CLI Connector support. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.25. Control Bus Copia collegamentoCollegamento copiato negli appunti!
Manage and monitor Camel routes.
2.25.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Control Bus component, URI syntax:
controlbus:command:language
Refer to the above link for usage and configuration details.
2.25.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-controlbus</artifactId>
</dependency>
2.25.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.25.3.1. Statistics Copia collegamentoCollegamento copiato negli appunti!
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.25.3.2. Languages Copia collegamentoCollegamento copiato negli appunti!
The following languages are supported for use in the Control Bus extension in Red Hat build of Apache Camel for Quarkus:
2.25.3.2.1. Bean Copia collegamentoCollegamento copiato negli appunti!
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.25.3.2.2. Simple Copia collegamentoCollegamento copiato negli appunti!
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.25.4. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.25.4.1. Statistics Copia collegamentoCollegamento copiato negli appunti!
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.26. Core Copia collegamentoCollegamento copiato negli appunti!
Camel core functionality and basic Camel languages: Constant, ExchangeProperty, Header, Ref, Simple and Tokenize
2.26.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above links for usage and configuration details.
2.26.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
2.26.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.26.3.1. Simple language Copia collegamentoCollegamento copiato negli appunti!
2.26.3.1.1. Using the OGNL notation Copia collegamentoCollegamento copiato negli appunti!
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.26.3.1.2. Using dynamic type resolution in native mode Copia collegamentoCollegamento copiato negli appunti!
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.26.3.1.3. Using the simple language with classpath resources in native mode Copia collegamentoCollegamento copiato negli appunti!
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.26.3.1.4. Configuring a custom bean via properties in native mode Copia collegamentoCollegamento copiato negli appunti!
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 property | Type | Default |
|---|---|---|
|
When set to true, the |
|
|
|
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 ** 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: |
List of | |
|
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
Note that Camel Quarkus extensions may include some services by default. The services selected here added to those services and the exclusions defined in
Example values: |
List of | |
|
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: |
List of | |
|
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
Note that Camel Quarkus extensions may include some services by default. The services selected here added to those services and the exclusions defined in
Example values: |
List of | |
|
If
Setting this to |
|
|
|
If
Setting this to |
|
|
|
If
Setting this to |
|
|
|
If
Setting this to |
|
|
|
If
Setting this to |
|
|
|
If
Setting this to |
|
|
|
Enable automatic discovery of routes during static initialization. |
|
|
|
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 | |
|
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 | |
|
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
This option narrows down the set selected by This option cannot be used to unregister classes which have been registered internally by Quarkus extensions. |
List of | |
|
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
By default, no classes are included. The set selected by this option can be narrowed down by 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 For this option to work properly, at least one of the following conditions must be satisfied:
- There are no wildcards (
where |
List of | |
|
If |
|
|
|
What to do if it is not possible to extract CSimple expressions from a route definition at build time. |
|
|
|
What to do if it is not possible to extract expressions from a route definition at build time. |
|
|
|
Indicates whether the expression extraction from the route definitions at build time must be done. If disabled, the expressions are compiled at runtime. |
|
|
|
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 Note that this configuration item only has any effect when observers configured for Camel events are present in the application. |
|
|
|
Build time configuration options for enable/disable camel source location. |
|
|
|
Enables tracer in your Camel application. |
|
|
|
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. |
|
|
|
Defines how many of the last messages to keep in the tracer. |
|
|
|
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. |
|
|
|
To limit the message body to a maximum size in the traced message. Use 0 or negative value to use unlimited size. |
|
|
|
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. |
|
|
|
Whether to include the message body of file based messages. The overhead is that the file content has to be read from the file. |
|
|
|
Whether to include the exchange properties in the traced message. |
|
|
|
Whether to include the exchange variables in the traced message. |
|
|
|
Whether to include the exception in the traced message in case of failed exchange. |
|
|
|
Whether to trace routes that is created from Rest DSL. |
|
|
|
Whether to trace routes that is created from route templates or kamelets. |
|
|
|
Filter for tracing by route or node id. |
| |
|
Filter for tracing messages. |
| |
|
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. |
|
|
|
A timeout (with millisecond precision) to wait for |
|
|
|
The action to take when |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
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, ors, it is prefixed withPT. -
If the value is a number followed by
d, it is prefixed withP.
2.27. Cron Copia collegamentoCollegamento copiato negli appunti!
A generic interface for triggering events at times specified through the Unix cron syntax.
2.27.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Cron component, URI syntax:
cron:name
Refer to the above link for usage and configuration details.
2.27.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cron</artifactId>
</dependency>
2.27.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.28. Crypto (JCE) Copia collegamentoCollegamento copiato negli appunti!
Sign and verify exchanges using the Signature Service of the Java Cryptographic Extension (JCE).
2.28.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
- Crypto (Java Cryptographic Extension) data format
-
Crypto (JCE) component, URI syntax:
crypto:cryptoOperation:name
Refer to the above links for usage and configuration details.
2.28.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-crypto</artifactId>
</dependency>
2.28.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.28.3.1. Security Provider Copia collegamentoCollegamento copiato negli appunti!
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.28.3.2. FIPS Copia collegamentoCollegamento copiato negli appunti!
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.28.4. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.29. CXF Copia collegamentoCollegamento copiato negli appunti!
Expose SOAP WebServices using Apache CXF or connect to external WebServices using CXF WS client.
2.29.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
CXF component, URI syntax:
cxf:beanId:address
Refer to the above link for usage and configuration details.
2.29.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cxf-soap</artifactId>
</dependency>
2.29.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.29.3.1. General Copia collegamentoCollegamento copiato negli appunti!
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.
To learn about supported use cases and WS specifications, see the Quarkus CXF Reference.
2.29.3.2. Dependency management Copia collegamentoCollegamento copiato negli appunti!
The CXF and quarkus-cxf versions are managed by {project-name}. You do not need select compatible versions for those projects.
2.29.3.3. Client Copia collegamentoCollegamento copiato negli appunti!
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.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
@ApplicationScoped
@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)
public interface CalculatorService {
public static final String TARGET_NS = "http://acme.org/wscalculator/Calculator";
@WebMethod
public int add(int intA, int intB);
@WebMethod
public int subtract(int intA, int intB);
@WebMethod
public int divide(int intA, int intB);
@WebMethod
public int multiply(int intA, int intB);
}
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
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.29.3.4. Server Copia collegamentoCollegamento copiato negli appunti!
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.
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.
quarkus-cxf supports alternative ways of exposing SOAP endpoints. Refer to the SOAP Services chapter of quarkus-cxf user guide for more details.
2.29.3.5. Logging of requests and responses Copia collegamentoCollegamento copiato negli appunti!
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;
}
}
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.29.3.6. WS Specifications Copia collegamentoCollegamento copiato negli appunti!
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.
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.29.3.7. Tooling Copia collegamentoCollegamento copiato negli appunti!
quarkus-cxf wraps the following two CXF tools:
-
wsdl2Java- for generating service classes from WSDL -
java2ws- for generating WSDL from Java classes
For wsdl2Java to work properly, your application will have to directly depend on io.quarkiverse.cxf:quarkus-cxf.
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.29.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
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
|
List of |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.30. Data Format Copia collegamentoCollegamento copiato negli appunti!
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.30.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Data Format component, URI syntax:
dataformat:name:operation
Refer to the above link for usage and configuration details.
2.30.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-dataformat</artifactId>
</dependency>
2.31. Dataset Copia collegamentoCollegamento copiato negli appunti!
Provide data for load and soak testing of your Camel application.
2.31.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Dataset component, URI syntax:
dataset:name -
DataSet Test component, URI syntax:
dataset-test:name
Refer to the above links for usage and configuration details.
2.31.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-dataset</artifactId>
</dependency>
2.32. Direct Copia collegamentoCollegamento copiato negli appunti!
Call another endpoint from the same Camel Context synchronously.
2.32.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Direct component, URI syntax:
direct:name
Refer to the above link for usage and configuration details.
2.32.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-direct</artifactId>
</dependency>
2.33. Elasticsearch Low level Rest Client Copia collegamentoCollegamento copiato negli appunti!
Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client).
2.33.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Elasticsearch Low level Rest Client component, URI syntax:
elasticsearch-rest-client:clusterName
Refer to the above link for usage and configuration details.
2.33.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-elasticsearch-rest-client</artifactId>
</dependency>
2.34. Elasticsearch Copia collegamentoCollegamento copiato negli appunti!
Send requests to ElasticSearch via Java Client API.
2.34.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Elasticsearch component, URI syntax:
elasticsearch:clusterName
Refer to the above link for usage and configuration details.
2.34.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-elasticsearch</artifactId>
</dependency>
2.35. FHIR Copia collegamentoCollegamento copiato negli appunti!
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.35.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
FHIR component, URI syntax:
fhir:apiName/methodName - FHIR JSon data format
- FHIR XML data format
Refer to the above links for usage and configuration details.
2.35.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-fhir</artifactId>
</dependency>
2.35.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.35.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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 property | Type | Default |
|---|---|---|
|
Enable FHIR DSTU2 Specs in native mode. |
|
|
|
Enable FHIR DSTU2_HL7ORG Specs in native mode. |
|
|
|
Enable FHIR DSTU2_1 Specs in native mode. |
|
|
|
Enable FHIR DSTU3 Specs in native mode. |
|
|
|
Enable FHIR R4 Specs in native mode. |
|
|
|
Enable FHIR R5 Specs in native mode. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.36. File Cluster Service Copia collegamentoCollegamento copiato negli appunti!
Provides a FileLock implementation of the Camel Cluster Service SPI
2.36.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-file-cluster-service</artifactId>
</dependency>
2.36.2. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.36.2.1. Having only a single consumer in a cluster consuming from a given endpoint Copia collegamentoCollegamento copiato negli appunti!
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 property | Type | Default |
|---|---|---|
|
Whether a File Lock Cluster Service should be automatically configured according to 'quarkus.camel.cluster.file.*' configurations. |
|
|
|
The cluster service ID (defaults to null). |
| |
|
The root path (defaults to null). |
| |
|
The service lookup order/priority (defaults to 2147482647). |
| |
|
[[quarkus-camel-cluster-file-attributes—attributes]] The custom attributes associated to the service (defaults to empty map). |
| |
|
The time to wait before starting to try to acquire lock (defaults to 1000ms). |
| |
|
The time to wait between attempts to try to acquire lock (defaults to 10000ms). |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.37. File Copia collegamentoCollegamento copiato negli appunti!
Read and write files.
2.37.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
File component, URI syntax:
file:directoryName
Refer to the above link for usage and configuration details.
2.37.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-file</artifactId>
</dependency>
2.38. Flink Copia collegamentoCollegamento copiato negli appunti!
Send DataSet jobs to an Apache Flink cluster.
2.38.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Flink component, URI syntax:
flink:endpointType
Refer to the above link for usage and configuration details.
2.38.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-flink</artifactId>
</dependency>
2.39. FTP Copia collegamentoCollegamento copiato negli appunti!
Upload and download files to/from SFTP, FTP or SFTP servers
2.39.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
FTP component, URI syntax:
ftp:host:port/directoryName -
FTPS component, URI syntax:
ftps:host:port/directoryName -
SFTP component, URI syntax:
sftp:host:port/directoryName
Refer to the above links for usage and configuration details.
2.39.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ftp</artifactId>
</dependency>
2.40. Google BigQuery Copia collegamentoCollegamento copiato negli appunti!
Access Google Cloud BigQuery service using SQL queries or Google Client Services API
2.40.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Google BigQuery component, URI syntax:
google-bigquery:projectId:datasetId:tableId -
Google BigQuery Standard SQL component, URI syntax:
google-bigquery-sql:projectId:queryString
Refer to the above links for usage and configuration details.
2.40.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-bigquery</artifactId>
</dependency>
2.40.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.41. Google Pubsub Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from Google Cloud Platform PubSub Service.
2.41.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Google Pubsub component, URI syntax:
google-pubsub:projectId:destinationName
Refer to the above link for usage and configuration details.
2.41.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-pubsub</artifactId>
</dependency>
2.41.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.42. Google Secret Manager Copia collegamentoCollegamento copiato negli appunti!
Manage Google Secret Manager Secrets
2.42.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Google Secret Manager component, URI syntax:
google-secret-manager:project
Refer to the above link for usage and configuration details.
2.42.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-secret-manager</artifactId>
</dependency>
2.43. GraphQL Copia collegamentoCollegamento copiato negli appunti!
Send GraphQL queries and mutations to external systems.
2.43.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
GraphQL component, URI syntax:
graphql:httpUri
Refer to the above link for usage and configuration details.
2.43.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-graphql</artifactId>
</dependency>
2.43.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.43.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
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 |
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.44. Groovy Copia collegamentoCollegamento copiato negli appunti!
Evaluate a Groovy script
2.44.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.44.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-groovy</artifactId>
</dependency>
2.44.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
Due to some limitations in GraalVM that prevent to execute even basic scripts in native mode, the compilation of the Groovy expressions is made with the static compilation enabled which means that the types used in your expression must be known at compile time. Refer to the Groovy documentation for more details.
2.45. gRPC Copia collegamentoCollegamento copiato negli appunti!
Expose gRPC endpoints and access external gRPC endpoints.
2.45.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
gRPC component, URI syntax:
grpc:host:port/service
Refer to the above link for usage and configuration details.
2.45.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-grpc</artifactId>
</dependency>
2.45.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.45.3.1. Protobuf generated code Copia collegamentoCollegamento copiato negli appunti!
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.45.3.1.1. Scanning proto files with imports Copia collegamentoCollegamento copiato negli appunti!
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 insrc/main/protoorsrc/test/proto -
groupId1:artifactId1,groupId2:artifactId2- Scan only the dependencies matching thegroupIdandartifactIdlist
The default value is com.google.protobuf:protobuf-java.
2.45.3.1.2. Scanning proto files from dependencies Copia collegamentoCollegamento copiato negli appunti!
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
The : character within property keys must be escaped with \.
2.45.3.2. Accessing classpath resources in native mode Copia collegamentoCollegamento copiato negli appunti!
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.45.4. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.45.4.1. Integration with Quarkus gRPC is not supported Copia collegamentoCollegamento copiato negli appunti!
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.45.5. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
If |
|
|
|
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 |
|
|
|
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. |
|
|
|
[[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. |
| |
|
[[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. |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.46. Gson Copia collegamentoCollegamento copiato negli appunti!
Marshal POJOs to JSON and back using Gson
2.46.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.46.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-gson</artifactId>
</dependency>
2.46.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.46.3.1. Marshaling/Unmarshaling objects in native mode Copia collegamentoCollegamento copiato negli appunti!
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.47. Hashicorp Vault Copia collegamentoCollegamento copiato negli appunti!
Manage secrets in Hashicorp Vault Service
2.47.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Hashicorp Vault component, URI syntax:
hashicorp-vault:secretsEngine
Refer to the above link for usage and configuration details.
2.47.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-hashicorp-vault</artifactId>
</dependency>
2.47.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.47.3.1. Using a POJO for the createSecret operation in native mode Copia collegamentoCollegamento copiato negli appunti!
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.48. HL7 Copia collegamentoCollegamento copiato negli appunti!
Marshal and unmarshal HL7 (Health Care) model objects using the HL7 MLLP codec.
2.48.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above links for usage and configuration details.
2.48.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-hl7</artifactId>
</dependency>
2.48.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.49. HTTP Copia collegamentoCollegamento copiato negli appunti!
Send requests to external HTTP servers using Apache HTTP Client 5.x.
2.49.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
HTTP component, URI syntax:
http://httpUri -
HTTPS (Secure) component, URI syntax:
https://httpUri
Refer to the above links for usage and configuration details.
2.49.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-http</artifactId>
</dependency>
2.49.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.49.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
- 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.50. Infinispan Copia collegamentoCollegamento copiato negli appunti!
Read and write from/to Infinispan distributed key/value store and data grid.
2.50.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Infinispan component, URI syntax:
infinispan:cacheName
Refer to the above link for usage and configuration details.
2.50.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-infinispan</artifactId>
</dependency>
2.50.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.50.3.1. Infinispan client configuration Copia collegamentoCollegamento copiato negli appunti!
You can configure Camel Infinispan in one of two ways.
- Using the relevant Camel Infinispan component & endpoint options
- Using the Quarkus Infinispan extension configuration properties.
More details about these two configuration methods is described below.
2.50.3.2. Camel Infinispan component and endpoint configuration Copia collegamentoCollegamento copiato negli appunti!
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.50.3.3. Quarkus Infinispan configuration Copia collegamentoCollegamento copiato negli appunti!
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.50.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.50.4.1. Camel Infinispan InfinispanRemoteAggregationRepository in native mode Copia collegamentoCollegamento copiato negli appunti!
If you chose to use the InfinispanRemoteAggregationRepository in native mode, then you must enable native serialization support.
2.51. Avro Jackson Copia collegamentoCollegamento copiato negli appunti!
Marshal POJOs to Avro and back using Jackson.
2.51.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.51.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jackson-avro</artifactId>
</dependency>
2.52. Protobuf Jackson Copia collegamentoCollegamento copiato negli appunti!
Marshal POJOs to Protobuf and back using Jackson.
2.52.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.52.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jackson-protobuf</artifactId>
</dependency>
2.53. Jackson Copia collegamentoCollegamento copiato negli appunti!
Marshal POJOs to JSON and back using Jackson
2.53.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.53.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jackson</artifactId>
</dependency>
2.53.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.53.3.1. Configuring the Jackson ObjectMapper Copia collegamentoCollegamento copiato negli appunti!
There are a few ways of configuring the ObjectMapper that the JacksonDataFormat uses. These are outlined below.
2.53.3.1.1. ObjectMapper created internally by JacksonDataFormat Copia collegamentoCollegamento copiato negli appunti!
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.53.3.1.2. Custom ObjectMapper for JacksonDataFormat Copia collegamentoCollegamento copiato negli appunti!
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.53.3.1.3. Using the Quarkus Jackson ObjectMapper with JacksonDataFormat Copia collegamentoCollegamento copiato negli appunti!
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.54. JacksonXML Copia collegamentoCollegamento copiato negli appunti!
Unmarshal an XML payloads to POJOs and back using XMLMapper extension of Jackson.
2.54.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.54.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jacksonxml</artifactId>
</dependency>
2.55. Jasypt Copia collegamentoCollegamento copiato negli appunti!
Security using Jasypt
2.55.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.55.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jasypt</artifactId>
</dependency>
2.55.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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"
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}}");
}
}
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.55.3.1. Injecting encrypted configuration Copia collegamentoCollegamento copiato negli appunti!
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.55.3.1.1. Securing alternate configuration sources Copia collegamentoCollegamento copiato negli appunti!
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.55.3.1.2. Finer control of Jasypt configuration Copia collegamentoCollegamento copiato negli appunti!
If you require finer control of the Jasypt configuration than that provided by the default configuration, the following options are available.
2.55.3.1.2.1. JasyptConfigurationCustomizer Copia collegamentoCollegamento copiato negli appunti!
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.55.3.1.2.2. Disabling automatic Jasypt configuration Copia collegamentoCollegamento copiato negli appunti!
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.
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}}");
}
}
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.55.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
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. |
|
|
|
The algorithm to be used for decryption. |
|
|
|
The master password used by Jasypt for decrypting configuration values. This option supports prefixes which influence the master password lookup behaviour.
|
| |
|
Configures the Jasypt StandardPBEStringEncryptor with a RandomIvGenerator using the given algorithm. |
|
|
|
Configures the Jasypt StandardPBEStringEncryptor with a RandomSaltGenerator using the given algorithm. |
|
|
|
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. |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.56. JAXB Copia collegamentoCollegamento copiato negli appunti!
Unmarshal XML payloads to POJOs and back using JAXB2 XML marshalling standard.
2.56.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.56.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jaxb</artifactId>
</dependency>
2.56.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.56.3.1. Native mode ObjectFactory instantiation of non-JAXB annotated classes Copia collegamentoCollegamento copiato negli appunti!
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.57. JDBC Copia collegamentoCollegamento copiato negli appunti!
Access databases through SQL and JDBC.
2.57.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
JDBC component, URI syntax:
jdbc:dataSourceName
Refer to the above link for usage and configuration details.
2.57.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jdbc</artifactId>
</dependency>
2.57.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.57.3.1. Configuring a DataSource Copia collegamentoCollegamento copiato negli appunti!
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.57.3.1.1. Zero configuration with Quarkus Dev Services Copia collegamentoCollegamento copiato negli appunti!
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.58. Jira Copia collegamentoCollegamento copiato negli appunti!
Interact with JIRA issue tracker.
2.58.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Jira component, URI syntax:
jira:type
Refer to the above link for usage and configuration details.
2.58.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jira</artifactId>
</dependency>
2.58.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.59. JMS Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from a JMS Queue or Topic.
2.59.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
JMS component, URI syntax:
jms:destinationType:destinationName
Refer to the above link for usage and configuration details.
2.59.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jms</artifactId>
</dependency>
2.59.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.59.3.1. Message mapping with org.w3c.dom.Node Copia collegamentoCollegamento copiato negli appunti!
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.59.3.2. Native mode support for jakarta.jms.ObjectMessage Copia collegamentoCollegamento copiato negli appunti!
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.59.3.3. Support for Connection pooling and X/Open XA distributed transactions Copia collegamentoCollegamento copiato negli appunti!
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.
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);
}
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.
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.59.4. transferException option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.60. Jolokia Copia collegamentoCollegamento copiato negli appunti!
Expose runtime metrics and management operations via JMX with Jolokia
2.60.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jolokia</artifactId>
</dependency>
2.60.2. Usage Copia collegamentoCollegamento copiato negli appunti!
This extension adds Jolokia support to your application.
2.60.2.1. Jolokia HTTP endpoints Copia collegamentoCollegamento copiato negli appunti!
In prod mode, Jolokia is accessible at the following URLs.
In dev and test modes Jolokia is bound only to localhost.
To disable exposing Jolokia via the Quarkus management interface at /q/jolokia, add the following configuration to application.properties.
quarkus.camel.jolokia.register-management-endpoint=false
If you want to disable Jolokia entirely, then add the following configuration to application.properties.
quarkus.camel.jolokia.enabled=false
2.60.2.2. Jolokia configuration Copia collegamentoCollegamento copiato negli appunti!
Any of the Jolokia configuration options can be configured via the quarkus.camel.jolokia.additional-properties.<jolokia-property-name> option. Where <jolokia-property-name> is the name of the Jolokia configuration option you want to set.
For example, the following configuration added to application.properties enables Jolokia debugging and sets the max depth for traversing bean properties.
quarkus.camel.jolokia.additional-properties.debug=true
quarkus.camel.jolokia.additional-properties.maxDepth=10
2.60.2.3. Jolokia restrictor Copia collegamentoCollegamento copiato negli appunti!
By default, a Jolokia restrictor is automatically registered that exposes access to only a specific set of MBean domains.
-
org.apache.camel -
java.lang -
java.nio
If this is too restrictive, then you can either specify your own MBean domains, disable the default restrictor, or create a custom restrictor.
2.60.2.3.1. Default restrictor MBean domains Copia collegamentoCollegamento copiato negli appunti!
You can modify the set of MBean domains referenced by the default restrictor by adding configuration like the following to application.properties.
quarkus.camel.jolokia.camel-restrictor-allowed-mbean-domains=org.apache.camel
2.60.2.3.2. Disabling the default restrictor Copia collegamentoCollegamento copiato negli appunti!
The following configuration added to application.properties disables the default restrictor.
quarkus.camel.jolokia.register-camel-restrictor=false
2.60.2.3.3. Create a custom restrictor Copia collegamentoCollegamento copiato negli appunti!
You can create your own restrictor class and register it with Jolokia.
public class CustomRestrictor extends AllowAllRestrictor {
// Override methods to apply custom restrictions
}
Register the restrictor with Jolokia by adding the following configuration to application.properties.
quarkus.camel.jolokia.additional-properties.restrictorClass=org.acme.CustomRestrictor
2.60.2.4. Kubernetes & OpenShift support Copia collegamentoCollegamento copiato negli appunti!
2.60.2.4.1. Generated Kubernetes manifests Copia collegamentoCollegamento copiato negli appunti!
If the quarkus-kubernetes or quarkus-openshift extensions are present, a container port named jolokia will be added automatically to the pod configuration within the generated Kubernetes manifest resources.
This can be disabled by adding the following configuration to application.properties.
quarkus.camel.jolokia.kubernetes.expose-container-port=false
2.60.2.4.2. Automatic enablement of SSL client authentication Copia collegamentoCollegamento copiato negli appunti!
If the application detects that it is running on Kubernetes or OpenShift, then Jolokia is automatically configured for SSL client authentication. This is useful if you use tools like Hawtio to discover and connect to your running application pod.
This functionality can be disabled by adding the following configuration to application.properties.
quarkus.camel.jolokia.kubernetes.client-authentication-enabled=false
Note that if you choose to use hawtio-online to connect to your running application, then you must configure the Jolokia client principal.
quarkus.camel.jolokia.kubernetes.client-principal=cn=hawtio-online.hawtio.svc
2.60.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.60.3.1. Native mode limitations Copia collegamentoCollegamento copiato negli appunti!
JMX in GraalVM is still experimental. Therefore, some features are not available in native mode.
Refer to the Camel Quarkus Management extension limitations section for more details.
2.60.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
Enables Jolokia support. |
|
|
|
The context path that the Jolokia agent is deployed under. |
|
|
|
Whether to register a Quarkus management endpoint for Jolokia (default |
|
|
|
Comma separated list of allowed MBean domains used by |
List of |
|
|
When {@code true} and the quarkus-kubernetes extension is present, a container port named jolokia will be added to the generated Kubernetes manifests within the container spec ports definition. |
|
|
|
Whether the Jolokia agent HTTP server should be started automatically. When set to |
|
|
|
The host address to which the Jolokia agent HTTP server should bind to. When unspecified, the default is localhost for dev and test mode. In prod mode the default is to bind to all interfaces at 0.0.0.0. |
| |
|
The port the Jolokia agent HTTP server listens to. |
|
|
|
The mode in which Jolokia agent discovery is enabled. The default |
|
|
|
Whether to enable Jolokia SSL client authentication in Kubernetes environments. Useful for tools such as hawtio to be able to connect with your application. |
|
|
|
Absolute path of the CA certificate Jolokia should use for SSL client authentication. |
| |
|
The principal which must be given in a client certificate to allow access to Jolokia. |
| |
|
Arbitrary Jolokia configuration options. These are described at the Jolokia documentation. Options can be configured like |
| |
|
When
Note that this option has no effect if |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.61. JPA Copia collegamentoCollegamento copiato negli appunti!
Store and retrieve Java objects from databases using Java Persistence API (JPA).
2.61.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
JPA component, URI syntax:
jpa:entityType
Refer to the above link for usage and configuration details.
2.61.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jpa</artifactId>
</dependency>
2.61.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.61.3.1. Configuring JpaMessageIdRepository Copia collegamentoCollegamento copiato negli appunti!
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"));
Since it excludes the spring-orm dependency, some options such as sharedEntityManager, transactionManager are not supported.
2.62. JQ Copia collegamentoCollegamento copiato negli appunti!
Evaluates a JQ expression against a JSON message body.
2.62.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.62.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jq</artifactId>
</dependency>
2.62.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.62.3.1. JQ transformations to custom result types in native mode Copia collegamentoCollegamento copiato negli appunti!
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.63. JSLT Copia collegamentoCollegamento copiato negli appunti!
Query or transform JSON payloads using an JSLT.
2.63.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
JSLT component, URI syntax:
jslt:resourceUri
Refer to the above link for usage and configuration details.
2.63.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jslt</artifactId>
</dependency>
2.63.3. allowContextMapAll option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.63.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.63.4.1. Loading JSLT templates from classpath in native mode Copia collegamentoCollegamento copiato negli appunti!
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.63.4.2. Using JSLT functions in native mode Copia collegamentoCollegamento copiato negli appunti!
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.64. JSON Path Copia collegamentoCollegamento copiato negli appunti!
Evaluate a JSONPath expression against a JSON message body
2.64.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.64.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jsonpath</artifactId>
</dependency>
2.65. JT400 Copia collegamentoCollegamento copiato negli appunti!
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.65.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
JT400 component, URI syntax:
jt400:userID:password@systemName/QSYS.LIB/objectPath.type
Refer to the above link for usage and configuration details.
2.65.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jt400</artifactId>
</dependency>
2.66. JTA Copia collegamentoCollegamento copiato negli appunti!
Enclose Camel routes in transactions using Java Transaction API (JTA) and Narayana transaction manager
2.66.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.66.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jta</artifactId>
</dependency>
2.66.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.
| Policy | Description |
|---|---|
|
| Support a current transaction; throw an exception if no current transaction exists. |
|
| Do not support a current transaction; throw an exception if a current transaction exists. |
|
| Do not support a current transaction; rather always execute non-transactionally. |
|
| Support a current transaction; create a new one if none exists. |
|
| Create a new transaction, suspending the current transaction if one exists. |
|
| Support a current transaction; execute non-transactionally if none exists. |
2.67. Kafka Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from an Apache Kafka broker.
2.67.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Kafka component, URI syntax:
kafka:topic
Refer to the above link for usage and configuration details.
2.67.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kafka</artifactId>
</dependency>
2.67.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.67.3.1. Quarkus Kafka Dev Services Copia collegamentoCollegamento copiato negli appunti!
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.67.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
If |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.68. Kamelet Copia collegamentoCollegamento copiato negli appunti!
Materialize route templates
2.68.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Kamelet component, URI syntax:
kamelet:templateId/routeId
Refer to the above link for usage and configuration details.
2.68.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kamelet</artifactId>
</dependency>
2.68.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.68.3.1. Using the Kamelet Catalog Copia collegamentoCollegamento copiato negli appunti!
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.69. Kubernetes Cluster Service Copia collegamentoCollegamento copiato negli appunti!
Provides a Kubernetes implementation of the Camel Cluster Service SPI
2.69.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kubernetes-cluster-service</artifactId>
</dependency>
2.69.2. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.69.2.1. Having only a single consumer in a cluster consuming from a given endpoint Copia collegamentoCollegamento copiato negli appunti!
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 property | Type | Default |
|---|---|---|
|
Whether a Kubernetes Cluster Service should be automatically configured according to 'quarkus.camel.cluster.kubernetes.*' configurations. |
|
|
|
Whether the camel master namespace leaders should be distributed evenly across all the camel contexts in the cluster. |
|
|
|
The cluster service ID (defaults to null). |
| |
|
The URL of the Kubernetes master (read from Kubernetes client properties by default). |
| |
|
The connection timeout in milliseconds to use when making requests to the Kubernetes API server. |
| |
|
The name of the Kubernetes namespace containing the pods and the configmap (autodetected by default). |
| |
|
The name of the current pod (autodetected from container host name by default). |
| |
|
The jitter factor to apply in order to prevent all pods to call Kubernetes APIs in the same instant (defaults to 1.2). |
| |
|
The default duration of the lease for the current leader (defaults to 15000). |
| |
|
The deadline after which the leader must stop its services because it may have lost the leadership (defaults to 10000). |
| |
|
The time between two subsequent attempts to check and acquire the leadership. It is randomized using the jitter factor (defaults to 2000). |
| |
|
Service lookup order/priority (defaults to 2147482647). |
| |
|
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. |
| |
|
The lease resource type used in Kubernetes, either 'config-map' or 'lease' (defaults to 'lease'). |
| |
|
The labels key/value used to identify the pods composing the cluster, defaults to empty map. |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.70. Kubernetes Copia collegamentoCollegamento copiato negli appunti!
Perform operations against Kubernetes API
2.70.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kubernetes</artifactId>
</dependency>
2.70.2. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.70.2.1. Automatic registration of a Kubernetes Client instance Copia collegamentoCollegamento copiato negli appunti!
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.71. Kudu Copia collegamentoCollegamento copiato negli appunti!
Interact with Apache Kudu, a free and open source column-oriented data store of the Apache Hadoop ecosystem.
2.71.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Kudu component, URI syntax:
kudu:host:port/tableName
Refer to the above link for usage and configuration details.
2.71.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kudu</artifactId>
</dependency>
2.71.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.72. Language Copia collegamentoCollegamento copiato negli appunti!
Execute scripts in any of the languages supported by Camel.
2.72.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Language component, URI syntax:
language:languageName:resourceUri
Refer to the above link for usage and configuration details.
2.72.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-language</artifactId>
</dependency>
2.72.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.72.3.1. Required Dependencies Copia collegamentoCollegamento copiato negli appunti!
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.72.3.2. Native Mode Copia collegamentoCollegamento copiato negli appunti!
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.72.4. allowContextMapAll option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.73. LDAP Copia collegamentoCollegamento copiato negli appunti!
Perform searches on LDAP servers.
2.73.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
LDAP component, URI syntax:
ldap:dirContextName
Refer to the above link for usage and configuration details.
2.73.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ldap</artifactId>
</dependency>
2.73.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.73.3.1. Using SSL in Native Mode Copia collegamentoCollegamento copiato negli appunti!
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.74. Log Copia collegamentoCollegamento copiato negli appunti!
Prints data form the routed message (such as body and headers) to the logger.
2.74.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Log Data component, URI syntax:
log:loggerName
Refer to the above link for usage and configuration details.
2.74.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
2.75. LRA Copia collegamentoCollegamento copiato negli appunti!
Camel saga binding for Long-Running-Action framework
2.75.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.75.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-lra</artifactId>
</dependency>
2.76. Mail Copia collegamentoCollegamento copiato negli appunti!
Send and receive emails using imap, pop3 and smtp protocols. Marshal Camel messages with attachments into MIME-Multipart messages and back.
2.76.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
IMAP component, URI syntax:
imap:host:port -
IMAPS (Secure) component, URI syntax:
imaps:host:port - MIME Multipart data format
-
POP3 component, URI syntax:
pop3:host:port -
POP3S component, URI syntax:
pop3s:host:port -
SMTP component, URI syntax:
smtp:host:port -
SMTPS component, URI syntax:
smtps:host:port
Refer to the above links for usage and configuration details.
2.76.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mail</artifactId>
</dependency>
2.77. Management Copia collegamentoCollegamento copiato negli appunti!
JMX management strategy and associated managed resources.
2.77.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-management</artifactId>
</dependency>
2.77.2. Usage Copia collegamentoCollegamento copiato negli appunti!
For information on using Managed Beans in Camel, consult the JMX section of the Camel Manual.
2.77.2.1. Enabling and Disabling JMX Copia collegamentoCollegamento copiato negli appunti!
JMX can be enabled or disabled in Camel-Quarkus by any of the following methods:
-
Adding or removing the
camel-quarkus-managementextension. -
Setting the
camel.main.jmxEnabledconfiguration property to a boolean value. -
Setting the system property
-Dorg.apache.camel.jmx.disabledto a boolean value.
2.77.2.2. Native mode Copia collegamentoCollegamento copiato negli appunti!
If you want the native application to be discoverable by tools such as JConsole and VisualVM, add the following configuration to application.properties.
quarkus.native.monitoring=jvmstat
For more information, refer to the Quarkus native guide.
2.77.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.77.3.1. Native mode Copia collegamentoCollegamento copiato negli appunti!
JMX in GraalVM is still experimental. Therefore, some features are not available in native mode.
-
Operations for MBean
java.lang:type=Threadingare not fully implemented. Therefore, it is not possible to obtain details about application threads. -
Various MBean attributes do not have their values implemented. For example, the
ClassCountattribute values for MBeanjava.lang:type=ClassLoadingare fixed at0
2.78. MapStruct Copia collegamentoCollegamento copiato negli appunti!
Type Conversion using Mapstruct
2.78.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
MapStruct component, URI syntax:
mapstruct:className
Refer to the above link for usage and configuration details.
2.78.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mapstruct</artifactId>
</dependency>
2.78.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.78.3.1. Annotation Processor Copia collegamentoCollegamento copiato negli appunti!
To use MapStruct, you must configure your build to use an annotation processor.
2.78.3.1.1. Maven Copia collegamentoCollegamento copiato negli appunti!
<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.78.3.1.2. Gradle Copia collegamentoCollegamento copiato negli appunti!
dependencies {
annotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}'
}
2.78.3.2. Mapper definition discovery Copia collegamentoCollegamento copiato negli appunti!
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.79. Master Copia collegamentoCollegamento copiato negli appunti!
Have only a single consumer in a cluster consuming from a given endpoint; with automatic failover if the JVM dies.
2.79.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Master component, URI syntax:
master:namespace:delegateUri
Refer to the above link for usage and configuration details.
2.79.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-master</artifactId>
</dependency>
2.79.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
This extension can be used in conjunction with extensions below:
2.80. Micrometer Copia collegamentoCollegamento copiato negli appunti!
Collect various metrics directly from Camel routes using the Micrometer library.
2.80.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Micrometer component, URI syntax:
micrometer:metricsType:metricsName
Refer to the above link for usage and configuration details.
2.80.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-micrometer</artifactId>
</dependency>
2.80.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.80.4. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.80.4.1. Exposing Micrometer statistics in JMX Copia collegamentoCollegamento copiato negli appunti!
Exposing Micrometer statistics in JMX is not available in native mode as quarkus-micrometer-registry-jmx does not have native support at present.
2.80.4.2. Decrement header for Counter is ignored by Prometheus Copia collegamentoCollegamento copiato negli appunti!
Prometheus backend ignores negative values during increment of Counter metrics.
2.80.4.3. Exposing statistics in JMX Copia collegamentoCollegamento copiato negli appunti!
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.80.5. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
Set whether to enable the MicrometerRoutePolicyFactory for capturing metrics on route processing times. |
|
|
|
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. |
|
|
|
Set whether to enable the MicrometerExchangeEventNotifier for capturing metrics on exchange processing times. |
|
|
|
Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total number of routes running. |
|
|
|
Set whether to gather performance information about Camel Thread Pools by injecting an InstrumentedThreadPoolFactory. |
|
|
|
Controls the naming style to use for metrics. The available values are |
|
|
|
Sets the level of metrics to capture. The available values are |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.81. Microprofile Fault Tolerance Copia collegamentoCollegamento copiato negli appunti!
Circuit Breaker EIP using Microprofile Fault Tolerance
2.81.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.81.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-microprofile-fault-tolerance</artifactId>
</dependency>
2.82. MicroProfile Health Copia collegamentoCollegamento copiato negli appunti!
Expose Camel health checks via MicroProfile Health
2.82.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.82.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-microprofile-health</artifactId>
</dependency>
2.82.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.82.3.1. Provided health checks Copia collegamentoCollegamento copiato negli appunti!
Some checks are automatically registered for your application.
2.82.3.1.1. Camel Context Health Copia collegamentoCollegamento copiato negli appunti!
Inspects the Camel Context status and causes the health check status to be DOWN if the status is anything other than 'Started'.
2.82.3.1.2. Camel Route Health Copia collegamentoCollegamento copiato negli appunti!
Inspects the status of each route and causes the health check status to be DOWN if any route status is not 'Started'.
2.82.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
Set whether to enable Camel health checks |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.83. Minio Copia collegamentoCollegamento copiato negli appunti!
Store and retrieve objects from Minio Storage Service using Minio SDK.
2.83.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Minio component, URI syntax:
minio:bucketName
Refer to the above link for usage and configuration details.
2.83.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-minio</artifactId>
</dependency>
2.83.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.84. MLLP Copia collegamentoCollegamento copiato negli appunti!
Communicate with external systems using the MLLP protocol.
2.84.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
MLLP component, URI syntax:
mllp:hostname:port
Refer to the above link for usage and configuration details.
2.84.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mllp</artifactId>
</dependency>
2.84.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
-
Check the Character encodings section of the Native mode guide if you wish to use the
defaultCharsetcomponent option.
2.85. Mock Copia collegamentoCollegamento copiato negli appunti!
Test routes and mediation rules using mocks.
2.85.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Mock component, URI syntax:
mock:name
Refer to the above link for usage and configuration details.
2.85.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mock</artifactId>
</dependency>
2.85.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.85.4. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.86. MongoDB Copia collegamentoCollegamento copiato negli appunti!
Perform operations on MongoDB documents and collections.
2.86.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
MongoDB component, URI syntax:
mongodb:connectionBean
Refer to the above link for usage and configuration details.
2.86.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mongodb</artifactId>
</dependency>
2.86.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.87. MyBatis Copia collegamentoCollegamento copiato negli appunti!
Performs a query, poll, insert, update or delete in a relational database using MyBatis.
2.87.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
MyBatis component, URI syntax:
mybatis:statement -
MyBatis Bean component, URI syntax:
mybatis-bean:beanName:methodName
Refer to the above links for usage and configuration details.
2.87.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-mybatis</artifactId>
</dependency>
2.87.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
Refer to Quarkus MyBatis for configuration. It must enable the following options
quarkus.mybatis.xmlconfig.enable=true
quarkus.mybatis.xmlconfig.path=SqlMapConfig.xml
quarkus.mybatis.xmlconfig.path must be the same with configurationUri param in the mybatis endpoint.
2.88. Netty HTTP Copia collegamentoCollegamento copiato negli appunti!
The Netty HTTP extension provides HTTP transport on top of the Netty extension.
2.88.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Netty HTTP component, URI syntax:
netty-http:protocol://host:port/path
Refer to the above link for usage and configuration details.
2.88.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-netty-http</artifactId>
</dependency>
2.88.3. transferException option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.88.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
- 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.89. Netty Copia collegamentoCollegamento copiato negli appunti!
Socket level networking using TCP or UDP with Netty 4.x.
2.89.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Netty component, URI syntax:
netty:protocol://host:port
Refer to the above link for usage and configuration details.
2.89.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-netty</artifactId>
</dependency>
2.90. Observability Services Copia collegamentoCollegamento copiato negli appunti!
Camel Observability Services
2.90.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.90.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-observability-services</artifactId>
</dependency>
2.90.3. Usage Copia collegamentoCollegamento copiato negli appunti!
This extension provides a set of opinionated components and configuration to simplify operations such as observability on cloud environments. Although the extension is mainly targeted for cloud, it can be used in any other environment.
By adding the camel-quarkus-observability-services extension to your application, each observability component (described below) will be configured with their individual default settings. No additional configuration is required.
HTTP endpoints will be exposed under the context path /observe/<service> by default. Further details about this are described below.
If you need to customize any component provided by this extension, then you can specify any of their related configuration options in application.properties, as it would be done normally when you work with the individual component extension(s).
2.90.4. Components Copia collegamentoCollegamento copiato negli appunti!
This extension automatically provides the following Camel Quarkus component extensions:
- Camel Quarkus MicroProfile Health - for health checks
- Camel Quarkus Management - for JMX
- Camel Quarkus Micrometer - for Camel Micrometer metrics
- Camel Quarkus OpenTelemetry - for tracing Camel messages (events/spans)
- Quarkus Micrometer Registry Prometheus - for exporting metrics in Prometheus format
2.90.4.1. List of known endpoints Copia collegamentoCollegamento copiato negli appunti!
The presence of this extension will expose the following endpoints:
| Endpoint | Description |
|---|---|
|
| Accumulation of all health check procedures in the application |
|
| Liveness probe endpoint |
|
| Readiness probe endpoint |
|
| Application started probe endpoint |
|
| Metrics exposed from the Micrometer Prometheus registry |
You can configure the endpoints as you’d do normally within each extension configuration.
2.90.5. OpenTelemetry configuration Copia collegamentoCollegamento copiato negli appunti!
The presence of this extension will provide the required instrumentation to enable the collection of OpenTelemetry metrics. The Camel Quarkus OpenTelemetry extension instruments your application and periodically attempts to export traces to the configured collector. This is disabled by default in order to prevent the application exporting traces when no telemetry server is available.
In order to enable instrumentation, you need to add the following configuration to application.properties.
quarkus.otel.sdk.disabled=false
To configure any aspect of OpenTelemetry, you can add the following configuration to application.properties. For example to customize the server endpoint where traces should be exported (default, http://localhost:4317).
quarkus.otel.exporter.otlp.traces.endpoint=http://my-otel-collector.svc:4317
The full set of configuration options are documented in the Camel Quarkus OpenTelemetry and Quarkus OpenTelemetry documentation.
Quarkus trace exporting defaults to the gRPC protocol on port 4317.
2.90.6. JMX configuration Copia collegamentoCollegamento copiato negli appunti!
The presence of this extension implies the presence of the camel-quarkus-management extension. This exposes Camel JMX MBeans to provide insights and management of the running application.
If you prefer to disable Camel JMX instrumentation, you can add the following configuration to application.properties.
camel.main.jmxEnabled=false
The full set of configuration options are documented in the Camel Quarkus Management documentation.
2.91. Olingo4 Copia collegamentoCollegamento copiato negli appunti!
Communicate with OData 4.0 services using Apache Olingo OData API.
2.91.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Olingo4 component, URI syntax:
olingo4:apiName/methodName
Refer to the above link for usage and configuration details.
2.91.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-olingo4</artifactId>
</dependency>
2.91.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.92. OpenAPI Java Copia collegamentoCollegamento copiato negli appunti!
Expose OpenAPI resources defined in Camel REST DSL
2.92.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.92.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-openapi-java</artifactId>
</dependency>
2.92.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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
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.92.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
Expose the Camel REST DSL services to quarkus openapi at build time if 'quarkus.smallrye-openapi' is available. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.93. OpenTelemetry Copia collegamentoCollegamento copiato negli appunti!
Distributed tracing using OpenTelemetry
2.93.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.93.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-opentelemetry</artifactId>
</dependency>
2.93.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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:*
The use of the OpenTelemetry Agent is not needed nor recommended. Quarkus Extensions and the libraries they provide, are directly instrumented. Also, the agent does not work in native mode.
2.93.3.1. Exporters Copia collegamentoCollegamento copiato negli appunti!
Quarkus OpenTelemetry defaults to the standard OTLP exporter defined in OpenTelemetry. Additional exporters will be available in the Quarkiverse quarkus-opentelemetry-exporter project.
2.93.3.2. Tracing CDI bean method execution Copia collegamentoCollegamento copiato negli appunti!
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.
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.93.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
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. |
|
|
|
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/.* |
| |
|
Sets whether to create new OpenTelemetry spans for each Camel Processor. Use the excludePatterns property to filter out Processors. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.94. Paho MQTT5 Copia collegamentoCollegamento copiato negli appunti!
Communicate with MQTT message brokers using Eclipse Paho MQTT v5 Client.
2.94.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Paho MQTT 5 component, URI syntax:
paho-mqtt5:topic
Refer to the above link for usage and configuration details.
2.94.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-paho-mqtt5</artifactId>
</dependency>
2.95. Paho Copia collegamentoCollegamento copiato negli appunti!
Communicate with MQTT message brokers using Eclipse Paho MQTT Client.
2.95.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Paho component, URI syntax:
paho:topic
Refer to the above link for usage and configuration details.
2.95.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-paho</artifactId>
</dependency>
2.96. Platform HTTP Copia collegamentoCollegamento copiato negli appunti!
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.96.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Platform HTTP component, URI syntax:
platform-http:path
Refer to the above link for usage and configuration details.
2.96.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-platform-http</artifactId>
</dependency>
2.96.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.96.3.1. Basic Usage Copia collegamentoCollegamento copiato negli appunti!
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.96.3.2. Using platform-http via Camel REST DSL Copia collegamentoCollegamento copiato negli appunti!
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.96.3.3. Handling multipart/form-data file uploads Copia collegamentoCollegamento copiato negli appunti!
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.96.3.4. Securing platform-http endpoints Copia collegamentoCollegamento copiato negli appunti!
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.96.3.5. Implementing a reverse proxy Copia collegamentoCollegamento copiato negli appunti!
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.96.3.6. Error handling Copia collegamentoCollegamento copiato negli appunti!
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.96.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.96.4.1. Platform HTTP server configuration Copia collegamentoCollegamento copiato negli appunti!
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.96.4.2. Character encodings Copia collegamentoCollegamento copiato negli appunti!
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.97. Quartz Copia collegamentoCollegamento copiato negli appunti!
Schedule sending of messages using the Quartz 2.x scheduler.
2.97.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Quartz component, URI syntax:
quartz:groupName/triggerName
Refer to the above link for usage and configuration details.
2.97.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-quartz</artifactId>
</dependency>
2.97.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.97.3.1. Clustering Copia collegamentoCollegamento copiato negli appunti!
Support for Quartz clustering is provided by the Quarkus Quartz extension. The following steps outline how to configure Quarkus Quartz for use with Camel.
Enable Quartz clustered mode and configure a
DataSourceas 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=QuartzAdd the correct JDBC driver extension to your application that corresponds to the value of
quarkus.datasource.db-kind. In the above examplepostgresqlis used, therefore the following JDBC dependency would be required. Adjust as necessary for your needs. Agroal is also required forDataSourcesupport.<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-jdbc-postgresql</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-agroal</artifactId> </dependency>Quarkus Flyway can automatically create the necessary Quartz database tables for you. Add
quarkus-flywayto 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.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.98. Qute Copia collegamentoCollegamento copiato negli appunti!
Transform messages using Quarkus Qute templating engine
2.98.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-qute</artifactId>
</dependency>
2.98.2. Usage Copia collegamentoCollegamento copiato negli appunti!
For more information about Qute, Refer to the Quarkus Qute documentation.
2.98.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
2.98.4. allowContextMapAll option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.98.5. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.99. Ref Copia collegamentoCollegamento copiato negli appunti!
Route messages to an endpoint looked up dynamically by name in the Camel Registry.
2.99.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Ref component, URI syntax:
ref:name
Refer to the above link for usage and configuration details.
2.99.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ref</artifactId>
</dependency>
2.99.3. Usage Copia collegamentoCollegamento copiato negli appunti!
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.100. REST OpenApi Copia collegamentoCollegamento copiato negli appunti!
To call REST services using OpenAPI specification as contract.
2.100.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
REST OpenApi component, URI syntax:
rest-openapi:specificationUri#operationId
Refer to the above link for usage and configuration details.
2.100.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest-openapi</artifactId>
</dependency>
2.100.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.100.3.1. Required Dependencies Copia collegamentoCollegamento copiato negli appunti!
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.100.3.2. Contract First Development Copia collegamentoCollegamento copiato negli appunti!
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.100.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
If |
|
|
|
The package to use for generated model classes. |
|
|
|
A comma separated list of models to generate. All models is the default. |
| |
|
If |
|
|
|
If |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.101. Rest Copia collegamentoCollegamento copiato negli appunti!
Expose REST services and their OpenAPI Specification or call external REST services.
2.101.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
REST component, URI syntax:
rest:method:path:uriTemplate -
REST API component, URI syntax:
rest-api:path
Refer to the above links for usage and configuration details.
2.101.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest</artifactId>
</dependency>
2.101.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
This extension depends on the Platform HTTP extension and configures it as the component that provides the REST transport.
2.101.3.1. Path parameters containing special characters with platform-http Copia collegamentoCollegamento copiato negli appunti!
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.101.3.2. Configuring alternate REST transport providers Copia collegamentoCollegamento copiato negli appunti!
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.102. Saga Copia collegamentoCollegamento copiato negli appunti!
Execute custom actions within a route using the Saga EIP.
2.102.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Saga component, URI syntax:
saga:action
Refer to the above link for usage and configuration details.
2.102.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-saga</artifactId>
</dependency>
2.103. Salesforce Copia collegamentoCollegamento copiato negli appunti!
Communicate with Salesforce using Java DTOs.
2.103.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Salesforce component, URI syntax:
salesforce:operationName:topicName
Refer to the above link for usage and configuration details.
2.103.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-salesforce</artifactId>
</dependency>
2.103.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.103.3.1. Generating Salesforce DTOs with the salesforce-maven-plugin Copia collegamentoCollegamento copiato negli appunti!
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.103.3.2. Native mode support for Pub / Sub API with POJO pubSubDeserializeType Copia collegamentoCollegamento copiato negli appunti!
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.103.4. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.104. SAP Copia collegamentoCollegamento copiato negli appunti!
Provides SAP Camel Component
2.104.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-sap</artifactId>
</dependency>
2.104.2. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.105. XQuery Copia collegamentoCollegamento copiato negli appunti!
Query and/or transform XML payloads using XQuery and Saxon.
2.105.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
XQuery component, URI syntax:
xquery:resourceUri - XQuery language
Refer to the above links for usage and configuration details.
2.105.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-saxon</artifactId>
</dependency>
2.105.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.106. Scheduler Copia collegamentoCollegamento copiato negli appunti!
Generate messages in specified intervals using java.util.concurrent.ScheduledExecutorService.
2.106.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Scheduler component, URI syntax:
scheduler:name
Refer to the above link for usage and configuration details.
2.106.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-scheduler</artifactId>
</dependency>
2.107. SEDA Copia collegamentoCollegamento copiato negli appunti!
Asynchronously call another endpoint from any Camel Context in the same JVM.
2.107.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
SEDA component, URI syntax:
seda:name
Refer to the above link for usage and configuration details.
2.107.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-seda</artifactId>
</dependency>
2.108. Servlet Copia collegamentoCollegamento copiato negli appunti!
Serve HTTP requests by a Servlet.
2.108.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Servlet component, URI syntax:
servlet:contextPath
Refer to the above link for usage and configuration details.
2.108.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-servlet</artifactId>
</dependency>
2.108.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.108.3.1. Configuring CamelHttpTransportServlet Copia collegamentoCollegamento copiato negli appunti!
2.108.3.1.1. Minimal configuration Copia collegamentoCollegamento copiato negli appunti!
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.108.3.1.2. Advanced configuration Copia collegamentoCollegamento copiato negli appunti!
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.108.4. transferException option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.108.5. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
| Configuration property | Type | Default |
|---|---|---|
|
A comma separated list of path patterns under which the CamelServlet should be accessible. Example path patterns: |
List of | |
|
A fully qualified name of a servlet class to serve paths that match |
|
|
|
A servletName as it would be defined in a |
|
|
|
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. |
|
|
|
Enables Camel to benefit from asynchronous Servlet support. |
|
|
|
When set to |
|
|
|
The name of a bean to configure an optional custom thread pool for handling Camel Servlet processing. |
| |
|
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. |
|
|
|
The maximum size allowed in bytes for uploaded files. The default size (-1) allows an unlimited size. |
|
|
|
The maximum size allowed in bytes for a multipart/form-data request. The default size (-1) allows an unlimited size. |
|
|
|
The file size in bytes after which the file will be temporarily stored on disk. |
|
|
|
A comma separated list of path patterns under which the CamelServlet should be accessible. Example path patterns: |
List of | |
|
A fully qualified name of a servlet class to serve paths that match |
|
|
|
A servletName as it would be defined in a |
|
|
|
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. |
|
|
|
Enables Camel to benefit from asynchronous Servlet support. |
|
|
|
When set to |
|
|
|
The name of a bean to configure an optional custom thread pool for handling Camel Servlet processing. |
| |
|
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. |
|
|
|
The maximum size allowed in bytes for uploaded files. The default size (-1) allows an unlimited size. |
|
|
|
The maximum size allowed in bytes for a multipart/form-data request. The default size (-1) allows an unlimited size. |
|
|
|
The file size in bytes after which the file will be temporarily stored on disk. |
|
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.109. Slack Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages to/from Slack.
2.109.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Slack component, URI syntax:
slack:channel
Refer to the above link for usage and configuration details.
2.109.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-slack</artifactId>
</dependency>
2.109.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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. SMB Copia collegamentoCollegamento copiato negli appunti!
SMB component which consumes natively from file shares using the Server Message Block (SMB, also known as Common Internet File System - CIFS) protocol
2.110.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
SMB component, URI syntax:
smb:hostname:port/shareName
Refer to the above link for usage and configuration details.
2.110.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-smb</artifactId>
</dependency>
2.111. Smooks Copia collegamentoCollegamento copiato negli appunti!
Use Smooks to transform, route, and bind both XML and non-XML data, including EDI, CSV, JSON, and YAML.
2.111.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Smooks component, URI syntax:
smooks:smooksConfig - Smooks data format
Please refer to the above links for usage and configuration details.
2.111.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-smooks</artifactId>
</dependency>
2.111.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.111.3.1. EDI Copia collegamentoCollegamento copiato negli appunti!
EDI is not supported in Camel Quarkus Smooks.
2.112. SNMP Copia collegamentoCollegamento copiato negli appunti!
Receive traps and poll SNMP (Simple Network Management Protocol) capable devices.
2.112.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
SNMP component, URI syntax:
snmp:host:port
Refer to the above link for usage and configuration details.
2.112.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-snmp</artifactId>
</dependency>
2.113. SOAP dataformat Copia collegamentoCollegamento copiato negli appunti!
Marshal Java objects to SOAP messages and back.
2.113.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.113.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-soap</artifactId>
</dependency>
2.114. Splunk HEC Copia collegamentoCollegamento copiato negli appunti!
The splunk component allows to publish events in Splunk using the HTTP Event Collector.
2.114.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Splunk HEC component, URI syntax:
splunk-hec:splunkURL
Refer to the above link for usage and configuration details.
2.114.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-splunk-hec</artifactId>
</dependency>
2.114.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.115. Splunk Copia collegamentoCollegamento copiato negli appunti!
Publish or search for events in Splunk.
2.115.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Splunk component, URI syntax:
splunk:name
Refer to the above link for usage and configuration details.
2.115.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-splunk</artifactId>
</dependency>
2.115.3. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.116. Spring RabbitMQ Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages from RabbitMQ using Spring RabbitMQ client.
2.116.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Spring RabbitMQ component, URI syntax:
spring-rabbitmq:exchangeName
Refer to the above link for usage and configuration details.
2.116.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-spring-rabbitmq</artifactId>
</dependency>
2.116.3. Camel Quarkus limitations Copia collegamentoCollegamento copiato negli appunti!
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.117. SQL Copia collegamentoCollegamento copiato negli appunti!
Perform SQL queries.
2.117.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
SQL component, URI syntax:
sql:query -
SQL Stored Procedure component, URI syntax:
sql-stored:template
Refer to the above links for usage and configuration details.
2.117.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-sql</artifactId>
</dependency>
2.117.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.117.3.1. Configuring a DataSource Copia collegamentoCollegamento copiato negli appunti!
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.117.3.1.1. Zero configuration with Quarkus Dev Services Copia collegamentoCollegamento copiato negli appunti!
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.117.3.2. SQL scripts Copia collegamentoCollegamento copiato negli appunti!
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.117.3.3. SQL aggregation repository in native mode Copia collegamentoCollegamento copiato negli appunti!
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.118. SSH Copia collegamentoCollegamento copiato negli appunti!
Execute commands on remote hosts using SSH.
2.118.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
SSH component, URI syntax:
ssh:host:port
Refer to the above link for usage and configuration details.
2.118.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ssh</artifactId>
</dependency>
2.119. Telegram Copia collegamentoCollegamento copiato negli appunti!
Send and receive messages using the Telegram Bot API.
2.119.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Telegram component, URI syntax:
telegram:type
Refer to the above link for usage and configuration details.
2.119.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-telegram</artifactId>
</dependency>
2.119.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.119.4. Webhook Mode Copia collegamentoCollegamento copiato negli appunti!
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.119.4.1. Webhook Copia collegamentoCollegamento copiato negli appunti!
In this release of Red Hat build of Apache Camel for Quarkus, webhook mode is not supported.
2.119.5. SSL in native mode Copia collegamentoCollegamento copiato negli appunti!
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.120. Timer Copia collegamentoCollegamento copiato negli appunti!
Generate messages in specified intervals using java.util.Timer.
2.120.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Timer component, URI syntax:
timer:timerName
Refer to the above link for usage and configuration details.
2.120.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-timer</artifactId>
</dependency>
2.121. Validator Copia collegamentoCollegamento copiato negli appunti!
Validate the payload using XML Schema and JAXP Validation.
2.121.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Validator component, URI syntax:
validator:resourceUri
Refer to the above link for usage and configuration details.
2.121.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-validator</artifactId>
</dependency>
2.122. Velocity Copia collegamentoCollegamento copiato negli appunti!
Transform messages using a Velocity template.
2.122.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Velocity component, URI syntax:
velocity:resourceUri
Refer to the above link for usage and configuration details.
2.122.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-velocity</artifactId>
</dependency>
2.122.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.122.3.1. Custom body as domain object in the native mode Copia collegamentoCollegamento copiato negli appunti!
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.122.4. allowContextMapAll option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.122.5. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.123. Vert.x HTTP Client Copia collegamentoCollegamento copiato negli appunti!
Camel HTTP client support with Vert.x
2.123.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Vert.x HTTP Client component, URI syntax:
vertx-http:httpUri
Refer to the above link for usage and configuration details.
2.123.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-vertx-http</artifactId>
</dependency>
2.123.3. transferException option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.123.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.123.5. allowJavaSerializedObject option in native mode Copia collegamentoCollegamento copiato negli appunti!
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.123.5.1. Character encodings Copia collegamentoCollegamento copiato negli appunti!
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.124. Vert.x WebSocket Copia collegamentoCollegamento copiato negli appunti!
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.124.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
Vert.x WebSocket component, URI syntax:
vertx-websocket:host:port/path
Refer to the above link for usage and configuration details.
2.124.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-vertx-websocket</artifactId>
</dependency>
2.124.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.124.3.1. Vert.x WebSocket consumers Copia collegamentoCollegamento copiato negli appunti!
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");
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.124.3.2. Vert.x WebSocket producers Copia collegamentoCollegamento copiato negli appunti!
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.124.4. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.124.4.1. Vert.x WebSocket server configuration Copia collegamentoCollegamento copiato negli appunti!
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.124.4.2. Character encodings Copia collegamentoCollegamento copiato negli appunti!
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.125. XJ Copia collegamentoCollegamento copiato negli appunti!
Transform JSON and XML message using a XSLT.
2.125.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
XJ component, URI syntax:
xj:resourceUri
Refer to the above link for usage and configuration details.
2.125.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xj</artifactId>
</dependency>
2.126. XML IO DSL Copia collegamentoCollegamento copiato negli appunti!
An XML stack for parsing XML route definitions
2.126.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.126.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xml-io-dsl</artifactId>
</dependency>
2.126.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
2.126.3.1. XML file encodings Copia collegamentoCollegamento copiato negli appunti!
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.127. XML JAXP Copia collegamentoCollegamento copiato negli appunti!
XML JAXP type converters and parsers
2.127.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xml-jaxp</artifactId>
</dependency>
2.128. XPath Copia collegamentoCollegamento copiato negli appunti!
Evaluates an XPath expression against an XML payload
2.128.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.128.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xpath</artifactId>
</dependency>
2.128.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.129. XSLT Saxon Copia collegamentoCollegamento copiato negli appunti!
Transform XML payloads using an XSLT template using Saxon.
2.129.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
XSLT Saxon component, URI syntax:
xslt-saxon:resourceUri
Refer to the above link for usage and configuration details.
2.129.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xslt-saxon</artifactId>
</dependency>
2.130. XSLT Copia collegamentoCollegamento copiato negli appunti!
Transforms XML payload using an XSLT template.
2.130.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
-
XSLT component, URI syntax:
xslt:resourceUri
Refer to the above link for usage and configuration details.
2.130.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xslt</artifactId>
</dependency>
2.130.3. Additional Camel Quarkus configuration Copia collegamentoCollegamento copiato negli appunti!
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.130.3.1. Configuration Copia collegamentoCollegamento copiato negli appunti!
TransformerFactory features can be configured using following property:
quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing"=false
2.130.3.2. Extension functions support Copia collegamentoCollegamento copiato negli appunti!
Xalan’s extension functions do work properly only when:
- Secure-processing is disabled
- Functions are defined in a separate jar
- Functions are augmented during native build phase. For example, they can be registered for reflection:
@RegisterForReflection(targets = { my.Functions.class })
public class FunctionsConfiguration {
}
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 property | Type | Default |
|---|---|---|
|
A comma separated list of templates to compile. |
List of | |
|
The package name for the generated classes. |
|
|
|
TransformerFactory features. |
|
Configuration property fixed at build time. All other configuration properties are overridable at runtime.
2.131. YAML DSL Copia collegamentoCollegamento copiato negli appunti!
An YAML stack for parsing YAML route definitions
2.131.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.131.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-yaml-dsl</artifactId>
</dependency>
2.131.3. Usage Copia collegamentoCollegamento copiato negli appunti!
2.131.3.1. Native mode Copia collegamentoCollegamento copiato negli appunti!
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.131.3.1.1. Bean definitions Copia collegamentoCollegamento copiato negli appunti!
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.131.3.1.2. Exception handling Copia collegamentoCollegamento copiato negli appunti!
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.132. YAML IO Copia collegamentoCollegamento copiato negli appunti!
Dump routes in YAML format
2.132.1. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-yaml-io</artifactId>
</dependency>
2.132.2. Usage Copia collegamentoCollegamento copiato negli appunti!
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.133. Zip Deflate Compression Copia collegamentoCollegamento copiato negli appunti!
Compress and decompress streams using java.util.zip.Deflater, java.util.zip.Inflater or java.util.zip.GZIPStream.
2.133.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above links for usage and configuration details.
2.133.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-zip-deflater</artifactId>
</dependency>
2.134. Zip File Copia collegamentoCollegamento copiato negli appunti!
Compression and decompress streams using java.util.zip.ZipStream.
2.134.1. What’s inside Copia collegamentoCollegamento copiato negli appunti!
Refer to the above link for usage and configuration details.
2.134.2. Maven coordinates Copia collegamentoCollegamento copiato negli appunti!
Create a new project with this extension on code.camel.redhat.com
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-zipfile</artifactId>
</dependency>
