Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 81. Kudu
Since Camel 3.0
Only producer is supported
The Kudu component supports storing and retrieving data from/to Apache Kudu, a free and open source column-oriented data store of the Apache Hadoop ecosystem.
81.1. Dependencies
When using kudu
with Red Hat build of Camel Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-kudu-starter</artifactId> </dependency>
81.2. Prerequisites
You must have a valid Kudu instance running. More information are available at Apache Kudu.
81.3. Configuring Options
Camel components are configured on two separate levels:
- component level
- endpoint level
81.3.1. Configuring Component Options
The component level is the highest level which holds general and common configurations that are inherited by the endpoints. For example a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
Configuring components can be done with the Component DSL, in a configuration file (application.properties|yaml), or directly with Java code.
81.3.2. Configuring Endpoint Options
Where you find yourself configuring the most is on endpoints, as endpoints often have many options, which allows you to configure what you need the endpoint to do. The options are also categorized into whether the endpoint is used as consumer (from) or as a producer (to), or used for both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL as a type safe way of configuring endpoints.
A good practice when configuring options is to use Property Placeholders, which allows to not hardcode urls, port numbers, sensitive information, and other settings. In other words placeholders allows to externalize the configuration from your code, and gives more flexibility and reuse.
The following two sections lists all the options, firstly for the component followed by the endpoint.
81.4. Component Options
The Kudu component supports 2 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
lazyStartProducer (producer) | Whether the producer should be started lazy (on the first message). This allows CamelContext and routes to start in situations where a producer failing would cause the route to fail. With lazy startup, the startup failures can be handled during routing messages via Camel’s routing error handlers. Note When the first message is processed, it may take some time to create and start the producer which will increase the total processing time. | false | boolean |
autowiredEnabled (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
81.5. Endpoint Options
The Kudu endpoint is configured using URI syntax:
kudu:host:port/tableName
with the following path and query parameters:
81.5.1. Path Parameters (3 parameters)
Name | Description | Default | Type |
---|---|---|---|
host (common) | Host of the server to connect to. | String | |
port (common) | Port of the server to connect to. | String | |
tableName (common) | Table to connect to. | String |
81.5.2. Query Parameters (2 parameters)
Name | Description | Default | Type |
---|---|---|---|
operation (producer) | Operation to perform. Enum values:
| KuduOperations | |
lazyStartProducer (producer (advanced)) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean |
81.6. Message Headers
The Kudu component supports 5 message header(s), which is/are listed below:
Name | Description | Default | Type |
---|---|---|---|
CamelKuduSchema (producer) Constant:CAMEL_KUDU_SCHEMA | The schema. | Schema | |
CamelKuduTableOptions (producer) Constant:CAMEL_KUDU_TABLE_OPTIONS | The create table options. | CreateTableOptions | |
CamelKuduScanColumnNames (producer) Constant:CAMEL_KUDU_SCAN_COLUMN_NAMES | The projected column names for scan operation. | List | |
CamelKuduScanPredicate (producer) Constant:CAMEL_KUDU_SCAN_PREDICATE | The predicate for scan operation. | KuduPredicate | |
CamelKuduScanLimit (producer) Constant:CAMEL_KUDU_SCAN_LIMIT | The limit on the number of rows for scan operation. | long |
81.7. Input Body formats
81.7.1. Insert, delete, update, and upsert
The input body format has to be a java.util.Map<String, Object>. This map will represent a row of the table whose elements are columns, where the key is the column name and the value is the value of the column.
81.8. Output Body formats
81.8.1. Scan
The output body format will be a java.util.List<java.util.Map<String, Object>>. Each element of the list will be a different row of the table. Each row is a Map<String, Object> whose elements will be each pair of column name and column value for that row.
81.9. Spring Boot Auto-Configuration
The component supports 3 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
camel.component.kudu.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.kudu.enabled | Whether to enable auto configuration of the kudu component. This is enabled by default. | Boolean | |
camel.component.kudu.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |