Camel Components

IBM watsonx.data

Since Camel 4.19

Only producer is supported

The IBM watsonx.data component provides integration with IBM watsonx.data, an open lakehouse platform for data analytics and AI workloads. It allows you to manage catalogs, schemas, tables, query engines, and storage registrations programmatically.

This component is built on top of the IBM watsonx.data Java SDK.

Prerequisites

You must have a valid IBM Cloud account with access to watsonx.data services. More information is available at IBM watsonx.data.

To use this component, you need:

  • An IBM Cloud API key

  • The watsonx.data service URL for your region

URI Format

ibm-watsonx-data:label[?options]

Where label is a logical name for the endpoint.

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

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.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The IBM watsonx.data component supports the following options which are listed below.

Name Description Default Type

authInstanceId (common)

The ID of the watsonx.data instance (on IBM Cloud, the CRN of the instance), sent in the AuthInstanceId HTTP header of every request. The CamelIBMWatsonxDataAuthInstanceId header overrides it; when neither is set, the request has no AuthInstanceId header.

String

serviceUrl (common)

Required The base URL of the watsonx.data REST API, to which the IBM SDK appends the resource paths, for example https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v3. The endpoint does not start without it.

String

catalogName (producer)

The name of the catalog for getCatalog, deleteCatalog, getAllColumns and the schema and table operations, except registerTable, which takes the catalog ID header instead. The CamelIBMWatsonxDataCatalogName header overrides it.

String

configuration (producer)

The configuration that the endpoints share. Each endpoint starts from a copy of it, and its URI options override the copied values.

WatsonxDataConfiguration

engineId (producer)

The ID of the engine that the schema and table operations, except registerTable, run on, and of the engine that getPrestoEngine and getPrestissimoEngine return. The CamelIBMWatsonxDataEngineId header overrides it.

String

lazyStartProducer (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

operation (producer)

The operation to perform. The CamelIBMWatsonxDataOperation header overrides it; when neither is set, the exchange fails.

Enum values:

  • listCatalogs

  • getCatalog

  • deleteCatalog

  • listSchemas

  • createSchema

  • deleteSchema

  • listTables

  • getTable

  • deleteTable

  • updateTable

  • registerTable

  • getAllColumns

  • listPrestoEngines

  • getPrestoEngine

  • listPrestissimoEngines

  • getPrestissimoEngine

  • listStorageRegistrations

  • createStorageRegistration

WatsonxDataOperations

schemaName (producer)

The name of the schema for deleteSchema and the table operations, except registerTable; getAllColumns returns only the columns of this schema. The CamelIBMWatsonxDataSchemaName header overrides it. createSchema ignores this option and takes the name of the new schema from the header only.

String

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

apiKey (security)

The IBM Cloud API key, exchanged at IBM Cloud IAM for an access token that is sent to watsonx.data. Required unless oauthProfile is set; when both are set, oauthProfile is used.

String

oauthProfile (security)

OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token of the configured identity provider is sent to watsonx.data as a Bearer token instead of an IBM Cloud API key, and obtained again when it expires. Requires camel-oauth on the classpath.

String

Endpoint Options

The IBM watsonx.data endpoint is configured using URI syntax:

ibm-watsonx-data:label

With the following path and query parameters:

Path Parameters

Name Description Default Type

label (producer)

Required A logical name of your choice for the endpoint. It is not sent to watsonx.data.

String

Query Parameters

Name Description Default Type

authInstanceId (common)

The ID of the watsonx.data instance (on IBM Cloud, the CRN of the instance), sent in the AuthInstanceId HTTP header of every request. The CamelIBMWatsonxDataAuthInstanceId header overrides it; when neither is set, the request has no AuthInstanceId header.

String

serviceUrl (common)

Required The base URL of the watsonx.data REST API, to which the IBM SDK appends the resource paths, for example https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v3. The endpoint does not start without it.

String

catalogName (producer)

The name of the catalog for getCatalog, deleteCatalog, getAllColumns and the schema and table operations, except registerTable, which takes the catalog ID header instead. The CamelIBMWatsonxDataCatalogName header overrides it.

String

engineId (producer)

The ID of the engine that the schema and table operations, except registerTable, run on, and of the engine that getPrestoEngine and getPrestissimoEngine return. The CamelIBMWatsonxDataEngineId header overrides it.

String

operation (producer)

The operation to perform. The CamelIBMWatsonxDataOperation header overrides it; when neither is set, the exchange fails.

Enum values:

  • listCatalogs

  • getCatalog

  • deleteCatalog

  • listSchemas

  • createSchema

  • deleteSchema

  • listTables

  • getTable

  • deleteTable

  • updateTable

  • registerTable

  • getAllColumns

  • listPrestoEngines

  • getPrestoEngine

  • listPrestissimoEngines

  • getPrestissimoEngine

  • listStorageRegistrations

  • createStorageRegistration

WatsonxDataOperations

schemaName (producer)

The name of the schema for deleteSchema and the table operations, except registerTable; getAllColumns returns only the columns of this schema. The CamelIBMWatsonxDataSchemaName header overrides it. createSchema ignores this option and takes the name of the new schema from the header only.

String

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

apiKey (security)

The IBM Cloud API key, exchanged at IBM Cloud IAM for an access token that is sent to watsonx.data. Required unless oauthProfile is set; when both are set, oauthProfile is used.

String

oauthProfile (security)

OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token of the configured identity provider is sent to watsonx.data as a Bearer token instead of an IBM Cloud API key, and obtained again when it expires. Requires camel-oauth on the classpath.

String

Message Headers

The IBM watsonx.data component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelIBMWatsonxDataOperation (producer)

Constant: OPERATION

The operation to perform. Overrides the operation option.

Enum values:

  • listCatalogs

  • getCatalog

  • deleteCatalog

  • listSchemas

  • createSchema

  • deleteSchema

  • listTables

  • getTable

  • deleteTable

  • updateTable

  • registerTable

  • getAllColumns

  • listPrestoEngines

  • getPrestoEngine

  • listPrestissimoEngines

  • getPrestissimoEngine

  • listStorageRegistrations

  • createStorageRegistration

WatsonxDataOperations

CamelIBMWatsonxDataCatalogName (producer)

Constant: CATALOG_NAME

The name of the catalog. Overrides the catalogName option.

String

CamelIBMWatsonxDataSchemaName (producer)

Constant: SCHEMA_NAME

The name of the schema. Overrides the schemaName option. createSchema takes the name of the new schema from this header only.

String

CamelIBMWatsonxDataCustomPath (producer)

Constant: CUSTOM_PATH

The path within the storage bucket where createSchema creates the schema. Required for createSchema.

String

CamelIBMWatsonxDataTableName (producer)

Constant: TABLE_NAME

The name of the table. Required for getTable, deleteTable, updateTable and registerTable; getAllColumns returns only the columns of this table. There is no option for it.

String

CamelIBMWatsonxDataMetadataLocation (producer)

Constant: METADATA_LOCATION

The location of the metadata file of the table that registerTable registers, for example the S3 path of an Iceberg metadata file. Required for registerTable.

String

CamelIBMWatsonxDataCatalogId (producer)

Constant: CATALOG_ID

The ID of the catalog that registerTable registers the table in. Required for registerTable, which ignores the catalogName option.

String

CamelIBMWatsonxDataSchemaId (producer)

Constant: SCHEMA_ID

The ID of the schema that registerTable registers the table in. Required for registerTable, which ignores the schemaName option.

String

CamelIBMWatsonxDataEngineId (producer)

Constant: ENGINE_ID

The ID of the engine. Overrides the engineId option.

String

CamelIBMWatsonxDataStorageDescription (producer)

Constant: STORAGE_DESCRIPTION

The description of the storage that createStorageRegistration registers. Required for createStorageRegistration.

String

CamelIBMWatsonxDataStorageDisplayName (producer)

Constant: STORAGE_DISPLAY_NAME

The display name of the storage that createStorageRegistration registers. Required for createStorageRegistration.

String

CamelIBMWatsonxDataStorageManagedBy (producer)

Constant: STORAGE_MANAGED_BY

Who manages the storage that createStorageRegistration registers: ibm or customer. Required for createStorageRegistration.

String

CamelIBMWatsonxDataStorageType (producer)

Constant: STORAGE_TYPE

The type of the storage that createStorageRegistration registers, such as ibm_cos, aws_s3, s3, minio, ibm_ceph, adls_gen1, adls_gen2, google_cs, ozone or ibm_storage_scale. Required for createStorageRegistration.

String

CamelIBMWatsonxDataAuthInstanceId (producer)

Constant: AUTH_INSTANCE_ID

The ID of the watsonx.data instance, sent in the AuthInstanceId HTTP header. Overrides the authInstanceId option.

String

Message Body

The message body at each side of the IBM watsonx.data component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Producer input

any

Only updateTable reads the body: the patch of the table, as a Map or as a JSON object in text, bytes, a stream or a file, sent as a JSON merge patch. No body, an empty patch or a body that is not a JSON object fails. The other operations take their input from the options and headers.

  • With operation=updateTable: map, text, bytes, stream or file

Producer output

pojo

The response of the IBM watsonx.data SDK, such as a CatalogCollection for listCatalogs or a Table for getTable and updateTable; converted to text, it is its JSON. The delete operations set no body.

  • With operation=deleteCatalog: null

  • With operation=deleteSchema: null

  • With operation=deleteTable: null

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Authentication

The component supports authentication via IBM Cloud API Key:

  • Java

  • XML

  • YAML

from("direct:start")
    .to("ibm-watsonx-data:myLakehouse?apiKey=YOUR_API_KEY&serviceUrl=https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2&operation=listCatalogs");
<route>
  <from uri="direct:start"/>
  <to uri="ibm-watsonx-data:myLakehouse?apiKey=YOUR_API_KEY&amp;serviceUrl=https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2&amp;operation=listCatalogs"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - to:
            uri: ibm-watsonx-data:myLakehouse
            parameters:
              apiKey: YOUR_API_KEY
              serviceUrl: "https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2"
              operation: listCatalogs

OAuth 2.0 Client Credentials grant is also supported when camel-oauth is on the classpath: set oauthProfile in the place of apiKey. The access token of the profile is sent to watsonx.data as a Bearer token, and asked again for every request (camel-oauth caches it until it expires), so a long-running route keeps working; the endpoint fails to start when the profile gives no token. The identity provider must issue tokens that watsonx.data accepts: IBM Cloud IAM itself does not offer the Client Credentials grant, so with IBM Cloud use apiKey. The examples read the service URL of such a deployment from the watsonx.data.service-url property.

  • Java

  • XML

  • YAML

from("direct:start")
    .to("ibm-watsonx-data:myLakehouse?oauthProfile=myidp&serviceUrl={{watsonx.data.service-url}}&operation=listCatalogs");
<route>
  <from uri="direct:start"/>
  <to uri="ibm-watsonx-data:myLakehouse?oauthProfile=myidp&amp;serviceUrl={{watsonx.data.service-url}}&amp;operation=listCatalogs"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - to:
            uri: ibm-watsonx-data:myLakehouse
            parameters:
              oauthProfile: myidp
              serviceUrl: "{{watsonx.data.service-url}}"
              operation: listCatalogs

Operations

The component supports the following operations:

Catalog Operations

Operation Description

listCatalogs

List all catalogs in the watsonx.data instance.

getCatalog

Get details of a specific catalog. Requires catalogName.

deleteCatalog

Delete a catalog. Requires catalogName.

Schema Operations

Operation Description

listSchemas

List schemas in a catalog. Requires catalogName and engineId.

createSchema

Create a new schema. Requires catalogName, engineId, CamelIBMWatsonxDataSchemaName header, and CamelIBMWatsonxDataCustomPath header.

deleteSchema

Delete a schema. Requires catalogName, engineId, and schemaName.

Table Operations

Operation Description

listTables

List tables in a schema. Requires catalogName, schemaName, and engineId.

getTable

Get table details. Requires catalogName, schemaName, engineId, and CamelIBMWatsonxDataTableName header.

deleteTable

Delete a table. Requires catalogName, schemaName, engineId, and CamelIBMWatsonxDataTableName header.

updateTable

Update table properties. Requires catalogName, schemaName, engineId, CamelIBMWatsonxDataTableName header, and the patch of the table in the body: a Map, or a JSON object as text (a String, byte[], InputStream or file), which is sent as a JSON merge patch.

registerTable

Register an external Iceberg table. Requires CamelIBMWatsonxDataCatalogId, CamelIBMWatsonxDataSchemaId, CamelIBMWatsonxDataMetadataLocation, and CamelIBMWatsonxDataTableName headers.

getAllColumns

Get all columns for a catalog. Requires catalogName. Optionally filter by schemaName and CamelIBMWatsonxDataTableName.

Engine Operations

Operation Description

listPrestoEngines

List all Presto query engines.

getPrestoEngine

Get details of a Presto engine. Requires engineId.

listPrestissimoEngines

List all Prestissimo query engines.

getPrestissimoEngine

Get details of a Prestissimo engine. Requires engineId.

Storage Operations

Operation Description

listStorageRegistrations

List all registered storage locations.

createStorageRegistration

Register a new storage location. Requires CamelIBMWatsonxDataStorageDescription, CamelIBMWatsonxDataStorageDisplayName, CamelIBMWatsonxDataStorageManagedBy, and CamelIBMWatsonxDataStorageType headers.

Examples

List Catalogs

  • Java

  • XML

  • YAML

from("direct:listCatalogs")
    .to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&operation=listCatalogs")
    .log("Catalogs: ${body}");
<route>
  <from uri="direct:listCatalogs"/>
  <to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&amp;serviceUrl={{ibm.watsonxdata.url}}&amp;operation=listCatalogs"/>
  <log message="Catalogs: ${body}"/>
</route>
- route:
    from:
      uri: direct:listCatalogs
      steps:
        - to:
            uri: ibm-watsonx-data:lakehouse
            parameters:
              apiKey: "{{ibm.apiKey}}"
              serviceUrl: "{{ibm.watsonxdata.url}}"
              operation: listCatalogs
        - log:
            message: "Catalogs: ${body}"

List Tables in a Schema

  • Java

  • XML

  • YAML

from("direct:listTables")
    .to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=listTables")
    .log("Tables: ${body}");
<route>
  <from uri="direct:listTables"/>
  <to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&amp;serviceUrl={{ibm.watsonxdata.url}}&amp;catalogName=my-catalog&amp;schemaName=my-schema&amp;engineId=my-presto-engine&amp;operation=listTables"/>
  <log message="Tables: ${body}"/>
</route>
- route:
    from:
      uri: direct:listTables
      steps:
        - to:
            uri: ibm-watsonx-data:lakehouse
            parameters:
              apiKey: "{{ibm.apiKey}}"
              serviceUrl: "{{ibm.watsonxdata.url}}"
              catalogName: my-catalog
              schemaName: my-schema
              engineId: my-presto-engine
              operation: listTables
        - log:
            message: "Tables: ${body}"

Create a Schema

  • Java

  • XML

  • YAML

from("direct:createSchema")
    .setHeader("CamelIBMWatsonxDataSchemaName", constant("new_schema"))
    .setHeader("CamelIBMWatsonxDataCustomPath", constant("s3a://my-bucket/new_schema"))
    .to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&engineId=my-engine&operation=createSchema")
    .log("Schema created: ${body}");
<route>
  <from uri="direct:createSchema"/>
  <setHeader name="CamelIBMWatsonxDataSchemaName">
    <constant>new_schema</constant>
  </setHeader>
  <setHeader name="CamelIBMWatsonxDataCustomPath">
    <constant>s3a://my-bucket/new_schema</constant>
  </setHeader>
  <to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&amp;serviceUrl={{ibm.watsonxdata.url}}&amp;catalogName=my-catalog&amp;engineId=my-engine&amp;operation=createSchema"/>
  <log message="Schema created: ${body}"/>
</route>
- route:
    from:
      uri: direct:createSchema
      steps:
        - setHeader:
            name: CamelIBMWatsonxDataSchemaName
            constant: new_schema
        - setHeader:
            name: CamelIBMWatsonxDataCustomPath
            constant: "s3a://my-bucket/new_schema"
        - to:
            uri: ibm-watsonx-data:lakehouse
            parameters:
              apiKey: "{{ibm.apiKey}}"
              serviceUrl: "{{ibm.watsonxdata.url}}"
              catalogName: my-catalog
              engineId: my-engine
              operation: createSchema
        - log:
            message: "Schema created: ${body}"

Rename a Table

The patch of the table can be a JSON object as text, for example from a file or an HTTP request:

  • Java

  • XML

  • YAML

from("direct:renameTable")
    .setHeader("CamelIBMWatsonxDataTableName", constant("orders"))
    .setBody(constant("{\"name\": \"orders_v2\"}"))
    .to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=updateTable")
    .log("Table updated: ${body}");
<route>
  <from uri="direct:renameTable"/>
  <setHeader name="CamelIBMWatsonxDataTableName">
    <constant>orders</constant>
  </setHeader>
  <setBody>
    <constant>{"name": "orders_v2"}</constant>
  </setBody>
  <to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&amp;serviceUrl={{ibm.watsonxdata.url}}&amp;catalogName=my-catalog&amp;schemaName=my-schema&amp;engineId=my-presto-engine&amp;operation=updateTable"/>
  <log message="Table updated: ${body}"/>
</route>
- route:
    from:
      uri: direct:renameTable
      steps:
        - setHeader:
            name: CamelIBMWatsonxDataTableName
            constant: orders
        - setBody:
            constant: '{"name": "orders_v2"}'
        - to:
            uri: ibm-watsonx-data:lakehouse
            parameters:
              apiKey: "{{ibm.apiKey}}"
              serviceUrl: "{{ibm.watsonxdata.url}}"
              catalogName: my-catalog
              schemaName: my-schema
              engineId: my-presto-engine
              operation: updateTable
        - log:
            message: "Table updated: ${body}"

Using Dynamic Operations via Headers

Java-only: requires Java enum WatsonxDataOperations constant
from("direct:dynamic")
    .setHeader("CamelIBMWatsonxDataOperation", constant(WatsonxDataOperations.listPrestoEngines))
    .to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}")
    .log("Engines: ${body}");