Camel Components

AWS Timestream

Since Camel 4.1

Only producer is supported

The AWS2 Timestream component supports the following operations on AWS Timestream:

  • Write Operations

    • Describe Write Endpoints

    • Create, Describe, Resume, List Batch Load Tasks

    • Create, Delete, Update, Describe, List Databases

    • Create, Delete, Update, Describe, List Tables

    • Write Records

  • Query Operations

    • Describe Query Endpoints

    • Prepare Query, Query, Cancel Query

    • Create, Delete, Execute, Update, Describe, List Scheduled Queries

Prerequisites

You must have a valid Amazon Web Services developer account, and be signed up to use Amazon Timestream. More information is available at AWS Timestream.

URI Format

aws2-timestream://clientType:label[?options]

You can append query options to the URI in the following format:

?options=value&option2=value&…​

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 AWS Timestream component supports the following options which are listed below.

Name Description Default Type

configuration (producer)

The configuration that the endpoints of the component start from. Each endpoint uses a copy of it, in which its own URI options replace the values.

Timestream2Configuration

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)

Required The operation that the producer performs, which must be one of the clientType of the endpoint: the query and scheduled query operations for query, the others for write, and describeEndpoints for both. The CamelAwsTimestreamOperation header replaces this option.

Enum values:

  • describeEndpoints

  • createBatchLoadTask

  • describeBatchLoadTask

  • resumeBatchLoadTask

  • listBatchLoadTasks

  • createDatabase

  • deleteDatabase

  • describeDatabase

  • updateDatabase

  • listDatabases

  • createTable

  • deleteTable

  • describeTable

  • updateTable

  • listTables

  • writeRecords

  • createScheduledQuery

  • deleteScheduledQuery

  • executeScheduledQuery

  • updateScheduledQuery

  • describeScheduledQuery

  • listScheduledQueries

  • prepareQuery

  • query

  • cancelQuery

Timestream2Operations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, such as a WriteRecordsRequest or a QueryRequest, which the producer sends as it is. The headers that give the input of the operation are then not used, and a body of another type fails the exchange.

false

boolean

profileCredentialsName (producer)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

queryAllPages (producer)

For the query operation: read all the pages of the result, and give all the rows in one QueryResponse. Without it, the body is one page, and the CamelAwsTimestreamQueryNextToken header gives the token of the next page. Not used with pojoRequest.

false

boolean

region (producer)

The AWS region of Timestream, as a region ID such as eu-west-1, which is the value of Region.EU_WEST_1.id(). If not set, the AWS SDK takes the region from its default region provider chain, for example the AWS_REGION environment variable.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • eu-isoe-west-1

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • ca-west-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

String

trustAllCertificates (producer)

Whether the HTTP client of Timestream trusts every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

useDefaultCredentialsProvider (producer)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (producer)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

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

awsTimestreamQueryClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.timestreamquery.TimestreamQueryClient for an endpoint of the query clientType; a write endpoint does not use it. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The Camel endpoint does not close a client that is set or autowired.

TimestreamQueryClient

awsTimestreamWriteClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.timestreamwrite.TimestreamWriteClient for an endpoint of the write clientType; a query endpoint does not use it. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The Camel endpoint does not close a client that is set or autowired.

TimestreamWriteClient

healthCheckConsumerEnabled (health)

Used for enabling or disabling all consumer based health checks from this component.

true

boolean

healthCheckProducerEnabled (health)

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

boolean

proxyHost (proxy)

The host name of the proxy that the HTTP client of Timestream connects through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP client of Timestream connects through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP client of Timestream uses to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is required, unless the client option of the clientType (awsTimestreamWriteClient or awsTimestreamQueryClient) is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is required, unless the client option of the clientType (awsTimestreamWriteClient or awsTimestreamQueryClient) is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. When it is not set, the accessKey and secretKey options are used without a session token.

String

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Endpoint Options

The AWS Timestream endpoint is configured using URI syntax:

aws2-timestream:clientType:label

With the following path and query parameters:

Path Parameters

Name Description Default Type

clientType (producer)

Required The type of the client: write for the databases, tables, batch load tasks and records of the Write API of Amazon Timestream for LiveAnalytics, or query for the queries and scheduled queries of its Query API. describeEndpoints is an operation of both.

Enum values:

  • write

  • query

Timestream2ClientType

label (producer)

Required A logical name of the endpoint, which you choose freely. The producer does not use it: the database, table or query to act on is given in headers.

String

Query Parameters

Name Description Default Type

operation (producer)

Required The operation that the producer performs, which must be one of the clientType of the endpoint: the query and scheduled query operations for query, the others for write, and describeEndpoints for both. The CamelAwsTimestreamOperation header replaces this option.

Enum values:

  • describeEndpoints

  • createBatchLoadTask

  • describeBatchLoadTask

  • resumeBatchLoadTask

  • listBatchLoadTasks

  • createDatabase

  • deleteDatabase

  • describeDatabase

  • updateDatabase

  • listDatabases

  • createTable

  • deleteTable

  • describeTable

  • updateTable

  • listTables

  • writeRecords

  • createScheduledQuery

  • deleteScheduledQuery

  • executeScheduledQuery

  • updateScheduledQuery

  • describeScheduledQuery

  • listScheduledQueries

  • prepareQuery

  • query

  • cancelQuery

Timestream2Operations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, such as a WriteRecordsRequest or a QueryRequest, which the producer sends as it is. The headers that give the input of the operation are then not used, and a body of another type fails the exchange.

false

boolean

profileCredentialsName (producer)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

queryAllPages (producer)

For the query operation: read all the pages of the result, and give all the rows in one QueryResponse. Without it, the body is one page, and the CamelAwsTimestreamQueryNextToken header gives the token of the next page. Not used with pojoRequest.

false

boolean

region (producer)

The AWS region of Timestream, as a region ID such as eu-west-1, which is the value of Region.EU_WEST_1.id(). If not set, the AWS SDK takes the region from its default region provider chain, for example the AWS_REGION environment variable.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • eu-isoe-west-1

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • ca-west-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

String

trustAllCertificates (producer)

Whether the HTTP client of Timestream trusts every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

useDefaultCredentialsProvider (producer)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (producer)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

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

awsTimestreamQueryClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.timestreamquery.TimestreamQueryClient for an endpoint of the query clientType; a write endpoint does not use it. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The Camel endpoint does not close a client that is set or autowired.

TimestreamQueryClient

awsTimestreamWriteClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.timestreamwrite.TimestreamWriteClient for an endpoint of the write clientType; a query endpoint does not use it. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The Camel endpoint does not close a client that is set or autowired.

TimestreamWriteClient

proxyHost (proxy)

The host name of the proxy that the HTTP client of Timestream connects through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP client of Timestream connects through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP client of Timestream uses to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is required, unless the client option of the clientType (awsTimestreamWriteClient or awsTimestreamQueryClient) is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is required, unless the client option of the clientType (awsTimestreamWriteClient or awsTimestreamQueryClient) is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. When it is not set, the accessKey and secretKey options are used without a session token.

String

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Message Headers

The AWS Timestream component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelAwsTimestreamOperation (producer)

Constant: OPERATION

The operation that the producer performs, as text or as a Timestream2Operations. It replaces the operation option.

String

CamelAwsTimestreamRecord (producer)

Constant: RECORD

The common attributes of the writeRecords operation: the dimensions, measure and time values that all the records of the CamelAwsTimestreamRecordList header share. It is not written as a record of its own.

Record

CamelAwsTimestreamRecordList (producer)

Constant: RECORD_LIST

The records that writeRecords writes, as a List of the Record of the AWS SDK. Timestream accepts at most 100 records in one request.

List

CamelAwsTimestreamTaskStatus (producer)

Constant: TASK_STATUS

The status of the batch load tasks that listBatchLoadTasks lists, such as IN_PROGRESS or SUCCEEDED, as text. If not set, the tasks of every status are listed.

String

CamelAwsTimestreamTaskId (producer)

Constant: TASK_ID

The ID of the batch load task, for describeBatchLoadTask and resumeBatchLoadTask.

String

CamelAwsTimestreamDatabaseName (producer)

Constant: DATABASE_NAME

The name of the database, for the database operations except listDatabases, the table operations and writeRecords. For createScheduledQuery, the database of the table that the scheduled query writes its results to.

String

CamelAwsTimestreamTableName (producer)

Constant: TABLE_NAME

The name of the table, for createTable, deleteTable, describeTable, updateTable and writeRecords. For createScheduledQuery, the table that the scheduled query writes its results to.

String

CamelAwsTimestreamTargetDatabaseName (producer)

Constant: TARGET_DATABASE_NAME

The name of the database that the batch load task of createBatchLoadTask loads the data into.

String

CamelAwsTimestreamTargetTableName (producer)

Constant: TARGET_TABLE_NAME

The name of the table that the batch load task of createBatchLoadTask loads the data into.

String

CamelAwsTimestreamRecordVersion (producer)

Constant: RECORD_VERSION

The version that createBatchLoadTask gives to the records it loads. A record with a higher version replaces the measure value of an existing record of the same time series and time.

Long

CamelAwsTimestreamDataModelConfiguration (producer)

Constant: DATA_MODEL_CONFIGURATION

The data model of the batch load task of createBatchLoadTask, which maps the columns of the source data to the dimensions, measures and time of the records, as a DataModelConfiguration of the AWS SDK.

DataModelConfiguration

CamelAwsTimestreamDataSourceConfiguration (producer)

Constant: DATA_SOURCE_CONFIGURATION

The source data of the batch load task of createBatchLoadTask: its S3 location and its format, as a DataSourceConfiguration of the AWS SDK.

DataSourceConfiguration

CamelAwsTimestreamReportConfiguration (producer)

Constant: REPORT_CONFIGURATION

The S3 location where the batch load task of createBatchLoadTask writes its error report, as a ReportConfiguration of the AWS SDK.

ReportConfiguration

CamelAwsTimestreamTableSchema (producer)

Constant: SCHEMA

The schema of the table for createTable and updateTable, which defines its composite partition key, as a Schema of the AWS SDK.

Schema

CamelAwsTimestreamRetentionProperties (producer)

Constant: RETENTION_PROPERTIES

How long the memory store and the magnetic store of the table keep the data, for createTable and updateTable, as a RetentionProperties of the AWS SDK.

RetentionProperties

CamelAwsTimestreamMagneticStoreWriteProperties (producer)

Constant: MAGNETIC_STORE_WRITE_PROPERTIES

Whether the table accepts writes of records that are older than the retention of its memory store, and where Timestream reports the rejected records, for createTable and updateTable, as a MagneticStoreWriteProperties of the AWS SDK.

MagneticStoreWriteProperties

CamelAwsTimestreamTimeColumn (producer)

Constant: TIME_COLUMN

The column of the query result that gives the time of the records that the scheduled query of createScheduledQuery writes.

String

CamelAwsTimestreamMeasureColumnName (producer)

Constant: MEASURE_NAME_COLUMN

The column of the query result that gives the measure name of the records that the scheduled query of createScheduledQuery writes.

String

CamelAwsTimestreamDimensionMappingList (producer)

Constant: DIMENSION_MAPPING_LIST

The columns of the query result that are the dimensions of the records that the scheduled query of createScheduledQuery writes, as a List of the DimensionMapping of the AWS SDK.

List

CamelAwsTimestreamMultiMeasureMappings (producer)

Constant: MULTI_MEASURE_MAPPINGS

How the scheduled query of createScheduledQuery maps the columns of the query result to multi-measure records, as a MultiMeasureMappings of the AWS SDK. Use it or the CamelAwsTimestreamMixedMeasureMappingList header.

MultiMeasureMappings

CamelAwsTimestreamMixedMeasureMappingList (producer)

Constant: MIXED_MEASURE_MAPPING_LIST

How the scheduled query of createScheduledQuery maps the measures of the query result to records, as a List of the MixedMeasureMapping of the AWS SDK. Use it or the CamelAwsTimestreamMultiMeasureMappings header.

List

CamelAwsTimestreamScheduledQueryName (producer)

Constant: SCHEDULED_QUERY_NAME

The name of the scheduled query that createScheduledQuery creates.

String

CamelAwsTimestreamScheduledQueryArn (producer)

Constant: SCHEDULED_QUERY_ARN

The Amazon Resource Name (ARN) of the scheduled query, for deleteScheduledQuery, executeScheduledQuery, updateScheduledQuery and describeScheduledQuery.

String

CamelAwsTimestreamScheduledQueryState (producer)

Constant: SCHEDULED_QUERY_STATE

The state that updateScheduledQuery sets on the scheduled query: ENABLED or DISABLED, as text.

String

CamelAwsTimestreamScheduledQueryInvocationTime (producer)

Constant: SCHEDULED_QUERY_INVOCATION_TIME

The time of the run that executeScheduledQuery starts: Timestream runs the query as if it was invoked at this time.

Instant

CamelAwsTimestreamQueryString (producer)

Constant: QUERY_STRING

The SQL query, for query and prepareQuery, or the query that the scheduled query of createScheduledQuery runs.

String

CamelAwsTimestreamQueryId (producer)

Constant: QUERY_ID

The ID of the query that cancelQuery cancels, as given in the QueryResponse of query.

String

CamelAwsTimestreamQueryValidateOnly (producer)

Constant: QUERY_VALIDATE_ONLY

Whether prepareQuery only validates the query string, without storing the prepared query for later use.

Boolean

CamelAwsTimestreamQueryMaxRows (producer)

Constant: QUERY_MAX_ROWS

The maximum number of rows in one page of the result of query. If not set, Timestream returns as many rows as fit in a page of 1 MB.

Integer

CamelAwsTimestreamQueryNextToken (producer)

Constant: QUERY_NEXT_TOKEN

The token of a page of a query result. As input, the query operation reads the page of this token; as output, it is the token of the next page, and it is removed after the last page. Set the same query string to read the next page.

String

CamelAwsTimestreamMaxResults (producer)

Constant: MAX_RESULTS

The maximum number of items that listBatchLoadTasks, listDatabases, listTables and listScheduledQueries return. The response holds one page only, with a nextToken when there are more.

Integer

CamelAwsTimestreamScheduleExpression (producer)

Constant: SCHEDULE_EXPRESSION

The schedule of the scheduled query that createScheduledQuery creates, as a cron or rate expression, for example rate(1 hour).

String

CamelAwsTimestreamNotificationTopicArn (producer)

Constant: NOTIFICATION_TOPIC_ARN

The Amazon Resource Name (ARN) of the Amazon SNS topic that receives the notifications of the scheduled query that createScheduledQuery creates.

String

CamelAwsTimestreamErrorReportS3BucketName (producer)

Constant: ERROR_REPORT_S3_BUCKET_NAME

The name of the S3 bucket that the scheduled query of createScheduledQuery writes its error reports to. The other CamelAwsTimestreamErrorReportS3 headers are used only when it is set.

String

CamelAwsTimestreamErrorReportS3ObjectKeyPrefix (producer)

Constant: ERROR_REPORT_S3_OBJECT_KEY_PREFIX

The prefix of the object keys of the error reports of the scheduled query of createScheduledQuery. Used only with the CamelAwsTimestreamErrorReportS3BucketName header.

String

CamelAwsTimestreamErrorReportS3EncryptionOption (producer)

Constant: ERROR_REPORT_S3_ENCRYPTION_OPTION

How S3 encrypts the error reports of the scheduled query of createScheduledQuery: SSE_S3 or SSE_KMS, as text. Used only with the CamelAwsTimestreamErrorReportS3BucketName header.

String

CamelAwsTimestreamScheduledQueryExecutionRoleArn (producer)

Constant: SCHEDULED_QUERY_EXECUTION_ROLE_ARN

The Amazon Resource Name (ARN) of the IAM role that Timestream assumes to run the scheduled query that createScheduledQuery creates.

String

CamelAwsTimestreamClientToken (producer)

Constant: CLIENT_TOKEN

A token that makes createBatchLoadTask, createScheduledQuery and executeScheduledQuery idempotent: a repeated request with the same token has the same result. If not set, the AWS SDK generates one for each request.

String

CamelAwsTimestreamKmsKeyId (producer)

Constant: KMS_KEY_ID

The AWS KMS key that encrypts at rest the database of createDatabase and updateDatabase, or the scheduled query of createScheduledQuery.

String

Message Body

The message body at each side of the AWS Timestream 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

Not used: the operations of both client types take their input from headers, such as the records of writeRecords in CamelAwsTimestreamRecordList, a List of the Record of the AWS SDK, and the SQL of query in CamelAwsTimestreamQueryString. With pojoRequest=true the request of the AWS SDK for the operation, such as a WriteRecordsRequest or a QueryRequest: another body fails.

  • With pojoRequest=true: pojo

Producer output

pojo

The response of the AWS SDK for the operation, such as the WriteRecordsResponse of writeRecords, or the QueryResponse of query with one page of rows: the CamelAwsTimestreamQueryNextToken header gives the next page, and queryAllPages=true gives the rows of all the pages.

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.

Required Timestream component options

Based on the type of operation to be performed, the type of client (write/query) needs to be provided as clientType URI path parameter

You have to provide either the awsTimestreamWriteClient(for write operations) or awsTimestreamQueryClient(for query operations) in the Registry or your accessKey and secretKey to access the AWS Timestream service.

Usage

Static credentials, Default Credential Provider and Profile Credentials Provider

You have the possibility of avoiding the usage of explicit static credentials by specifying the useDefaultCredentialsProvider option and set it to true.

The order of evaluation for Default Credentials Provider is the following:

  • Java system properties - aws.accessKeyId and aws.secretKey.

  • Environment variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  • Web Identity Token from AWS STS.

  • The shared credentials and config files.

  • Amazon ECS container credentials - loaded from the Amazon ECS if the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is set.

  • Amazon EC2 Instance profile credentials.

You have also the possibility of using Profile Credentials Provider, by specifying the useProfileCredentialsProvider option to true and profileCredentialsName to the profile name.

Only one of static, default and profile credentials could be used at the same time.

For more information about this you can look at AWS credentials documentation

Timestream Producer operations

Camel-AWS Timestream component provides the following operation on the producer side:

  • Write Operations

    • describeEndpoints

    • createBatchLoadTask

    • describeBatchLoadTask

    • resumeBatchLoadTask

    • listBatchLoadTasks

    • createDatabase

    • deleteDatabase

    • describeDatabase

    • updateDatabase

    • listDatabases

    • createTable

    • deleteTable

    • describeTable

    • updateTable

    • listTables

    • writeRecords

  • Query Operations

    • describeEndpoints

    • createScheduledQuery

    • deleteScheduledQuery

    • executeScheduledQuery

    • updateScheduledQuery

    • describeScheduledQuery

    • listScheduledQueries

    • prepareQuery

    • query

    • cancelQuery

The operation is the CamelAwsTimestreamOperation header, or else the operation option; without either, the producer fails with an IllegalArgumentException. The write operations need clientType write and the query operations need clientType query (describeEndpoints is an operation of both): an operation of the other client type fails with an IllegalArgumentException, already when the producer starts if it is the operation option.

Writing records

The writeRecords operation writes the records of the CamelAwsTimestreamRecordList header (a List of Record) into the table of the CamelAwsTimestreamDatabaseName and CamelAwsTimestreamTableName headers. The CamelAwsTimestreamRecord header is the common attributes of the request: the dimensions, measure and time values that all the records share. It is not written as a record of its own, so a request with only this header writes no record.

Examples

Producer Examples

  • Write Operation

    • createDatabase: this operation will create a timestream database

  • Java

  • XML

  • YAML

from("direct:createDatabase")
    .setHeader(Timestream2Constants.DATABASE_NAME, constant("testDb"))
    .setHeader(Timestream2Constants.KMS_KEY_ID, constant("testKmsKey"))
    .to("aws2-timestream://write:test?awsTimestreamWriteClient=#awsTimestreamWriteClient&operation=createDatabase");
<route>
    <from uri="direct:createDatabase"/>
    <setHeader name="CamelAwsTimestreamDatabaseName">
        <constant>testDb</constant>
    </setHeader>
    <setHeader name="CamelAwsTimestreamKmsKeyId">
        <constant>testKmsKey</constant>
    </setHeader>
    <to uri="aws2-timestream://write:test?awsTimestreamWriteClient=#awsTimestreamWriteClient&amp;operation=createDatabase"/>
</route>
- route:
    from:
      uri: direct:createDatabase
      steps:
        - setHeader:
            name: CamelAwsTimestreamDatabaseName
            constant: testDb
        - setHeader:
            name: CamelAwsTimestreamKmsKeyId
            constant: testKmsKey
        - to:
            uri: aws2-timestream://write:test
            parameters:
              awsTimestreamWriteClient: "#awsTimestreamWriteClient"
              operation: createDatabase
  • Query Operation

    • query: this operation will execute a timestream query

  • Java

  • XML

  • YAML

from("direct:query")
    .setHeader(Timestream2Constants.QUERY_STRING, constant("SELECT * FROM testDb.testTable ORDER BY time DESC LIMIT 10"))
    .to("aws2-timestream://query:test?awsTimestreamQueryClient=#awsTimestreamQueryClient&operation=query");
<route>
    <from uri="direct:query"/>
    <setHeader name="CamelAwsTimestreamQueryString">
        <constant>SELECT * FROM testDb.testTable ORDER BY time DESC LIMIT 10</constant>
    </setHeader>
    <to uri="aws2-timestream://query:test?awsTimestreamQueryClient=#awsTimestreamQueryClient&amp;operation=query"/>
</route>
- route:
    from:
      uri: direct:query
      steps:
        - setHeader:
            name: CamelAwsTimestreamQueryString
            constant: "SELECT * FROM testDb.testTable ORDER BY time DESC LIMIT 10"
        - to:
            uri: aws2-timestream://query:test
            parameters:
              awsTimestreamQueryClient: "#awsTimestreamQueryClient"
              operation: query

Paging the query results

Timestream returns the result of a query in pages. The body of the query operation is one page (a QueryResponse), and when more pages follow, the CamelAwsTimestreamQueryNextToken header holds the token of the next page. Send the same query again with this header to read the next page; after the last page, the header is removed. A page can be empty while the query still runs, so loop on the header, not on the number of rows. CamelAwsTimestreamQueryMaxRows sets the maximum number of rows of a page.

With queryAllPages=true, the producer reads all the pages and the body is one QueryResponse with the rows of all the pages. Use it only for results that fit in memory.

from("direct:query")
    .setHeader(Timestream2Constants.QUERY_STRING, constant("SELECT * FROM testDb.testTable"))
    .to("aws2-timestream://query:test?operation=query&queryAllPages=true")
    .log("${body.rows.size} rows");

Using a POJO as body

Sometimes building an AWS Request can be complex because of multiple options. We introduce the possibility to use a POJO as the body. In AWS Timestream there are multiple operations you can submit, as an example for a create database request, you can do something like:

  • Write Operation

    • createDatabase: this operation will create a timestream database

Java-only: uses AWS SDK POJO request builder as message body
from("direct:start")
  .setBody(CreateDatabaseRequest.builder().databaseName("testDb").kmsKeyId("testKmsKey").build())
  .to("aws2-timestream://write:test?awsTimestreamWriteClient=#awsTimestreamWriteClient&operation=createDatabase&pojoRequest=true")
  • Query Operation

    • query: this operation will execute a timestream query

Java-only: uses AWS SDK POJO request builder as message body
from("direct:query")
    .setBody(QueryRequest.builder().queryString("SELECT * FROM testDb.testTable ORDER BY time DESC LIMIT 10").build())
    .to("aws2-timestream://query:test?awsTimestreamQueryClient=#awsTimestreamQueryClient&operation=query&pojoRequest=true")

In this way, you’ll pass the request directly without the need of passing headers and options specifically related to this operation.

Dependencies

Maven users will need to add the following dependency to their pom.xml.

pom.xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-aws2-timestream</artifactId>
    <version>${camel-version}</version>
</dependency>

where ${camel-version} must be replaced by the actual version of Camel.