Camel Spring Boot

AWS Athena

Run SQL queries with AWS Athena and read the state and the results of query executions.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-aws2-athena-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 41 options, which are listed below.

Name Description Default Type

camel.component.aws2-athena.access-key

The access key ID of the AWS credentials. The client uses it with secretKey as static credentials, or with secretKey and sessionToken when useSessionCredentials is true.

String

camel.component.aws2-athena.amazon-athena-client

To use a custom software.amazon.awssdk.services.athena.AthenaClient. When this option is set or autowired, the endpoint does not build a client of its own, so the credentials, region, proxy and endpoint override options are not used. The endpoint does not close a client that is set or autowired. The option is a software.amazon.awssdk.services.athena.AthenaClient type.

AthenaClient

camel.component.aws2-athena.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.aws2-athena.client-request-token

The idempotency token of startQueryExecution, a unique case-sensitive string of 32 to 128 characters. If not set, the AWS SDK generates a new token for each request. For a token it has seen before, Athena starts no new query and returns the same query execution ID, or fails if the query string differs. A token set here is sent with every exchange and every retry. The CamelAwsAthenaClientRequestToken header takes precedence over this option.

String

camel.component.aws2-athena.configuration

The component configuration. The option is a org.apache.camel.component.aws2.athena.Athena2Configuration type.

Athena2Configuration

camel.component.aws2-athena.database

The name of the database that startQueryExecution runs the query in, sent as the database of the query execution context. If not set, no database is sent. The CamelAwsAthenaDatabase header takes precedence over this option.

String

camel.component.aws2-athena.delay

The time in milliseconds between two checks of the state of the query, after the first one. Used only when waitTimeout is above 0. The CamelAwsAthenaDelay header takes precedence over this option.

2000

Long

camel.component.aws2-athena.enabled

Whether to enable auto configuration of the aws2-athena component. This is enabled by default.

Boolean

camel.component.aws2-athena.encryption-option

The encryption of the query results that startQueryExecution stores in S3: SSE_S3, SSE_KMS or CSE_KMS. If not set, no encryption configuration is sent with the query. If the workgroup enforces its own configuration, Athena uses the encryption of the workgroup. The CamelAwsAthenaEncryptionOption header takes precedence over this option.

EncryptionOption

camel.component.aws2-athena.health-check-consumer-enabled

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

true

Boolean

camel.component.aws2-athena.health-check-producer-enabled

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

camel.component.aws2-athena.include-trace

Whether startQueryExecution adds an SQL comment line (starting with --) before the query, with the URI of the from endpoint, the exchange ID and the route ID as JSON, to trace the query back to the exchange. The CamelAwsAthenaIncludeTrace header takes precedence over this option.

false

Boolean

camel.component.aws2-athena.initial-delay

The time in milliseconds before startQueryExecution checks the state of the query for the first time; the checks after a retry wait delay instead. Used only when waitTimeout is above 0. The CamelAwsAthenaInitialDelay header takes precedence over this option.

1000

Long

camel.component.aws2-athena.kms-key

The ARN or ID of the KMS key for the SSE_KMS and CSE_KMS encryption options. It requires an encryption option: startQueryExecution fails if kmsKey is set without one. The CamelAwsAthenaKmsKey header takes precedence over this option.

String

camel.component.aws2-athena.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

camel.component.aws2-athena.max-attempts

The maximum number of times that startQueryExecution starts the query; 1, the default, makes no retries. The query is started again only when it completed without success and the failure matches the retry option, which requires waitTimeout above 0. A query still running when waitTimeout is up is not started again. A value below 1 fails the exchange. The CamelAwsAthenaMaxAttempts header takes precedence over this option.

1

Integer

camel.component.aws2-athena.max-results

The maximum number of results that one request returns: rows for getQueryResults (1 to 1000), query execution IDs for listQueryExecutions (0 to 50). With outputType StreamList, it is the size of each page. If not set, Athena uses its own default. The CamelAwsAthenaMaxResults header takes precedence over this option.

Integer

camel.component.aws2-athena.next-token

The token of the page of results to read, which is the NextToken of an earlier response of getQueryResults or listQueryExecutions. If not set, the first page is read. The CamelAwsAthenaNextToken header takes precedence over this option.

String

camel.component.aws2-athena.operation

The operation that the producer performs. The CamelAwsAthenaOperation header takes precedence over this option.

startqueryexecution

Athena2Operations

camel.component.aws2-athena.output-location

The location in Amazon S3 where startQueryExecution stores the query results, such as s3://path/to/query/bucket/, ending with a forward slash. startQueryExecution fails if neither this option nor the CamelAwsAthenaOutputLocation header, which takes precedence, is set. If the workgroup enforces its own configuration, Athena uses the location of the workgroup.

String

camel.component.aws2-athena.output-type

How getQueryResults returns the results. StreamList, the default, returns a GetQueryResultsIterable that pages through all results, calling Athena as it is read. SelectList returns one page as a GetQueryResultsResponse, at most 1000 rows, and sets the CamelAwsAthenaNextToken header to the token of the next page. S3Pointer returns the S3 location of the results file as text. The CamelAwsAthenaOutputType header takes precedence over this option.

streamlist

Athena2OutputType

camel.component.aws2-athena.override-endpoint

Whether the client sends its requests to the URI of uriEndpointOverride instead of the endpoint of the AWS region. Without uriEndpointOverride this option has no effect.

false

Boolean

camel.component.aws2-athena.profile-credentials-name

The name of the profile that the client loads when useProfileCredentialsProvider is true. If not set, the AWS SDK uses the profile that the AWS_PROFILE environment variable or the aws.profile system property names, or else the profile named default.

String

camel.component.aws2-athena.proxy-host

The host name of the proxy that the client sends its requests through. The proxy is used only when proxyPort is set as well.

String

camel.component.aws2-athena.proxy-port

The port of the proxy that the client sends its requests through. The proxy is used only when proxyHost is set as well.

Integer

camel.component.aws2-athena.proxy-protocol

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

https

Protocol

camel.component.aws2-athena.query-execution-id

The ID of the query execution that getQueryExecution and getQueryResults read. The CamelAwsAthenaQueryExecutionId header, which startQueryExecution sets, takes precedence over this option. These operations fail if neither is set.

String

camel.component.aws2-athena.query-string

The SQL query to run. The CamelAwsAthenaQueryString header takes precedence over this option, and when useMessageBodyForSql is enabled, so does a non-empty message body. Except for simple queries, prefer setting the query in the header to avoid having to deal with URL encoding issues.

String

camel.component.aws2-athena.region

The AWS region of Athena, as a lowercase 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, such as the aws.region system property or the AWS_REGION environment variable.

String

camel.component.aws2-athena.reset-wait-timeout-on-retry

Whether waitTimeout starts again with each attempt of the query. If true, each attempt waits up to waitTimeout, so the total wait can reach waitTimeout times maxAttempts. If false, waitTimeout is the limit for all attempts together, counted from the first start. The CamelAwsAthenaResetWaitTimeoutOnRetry header takes precedence over this option.

true

Boolean

camel.component.aws2-athena.retry

Which failures of a completed query make startQueryExecution start it again, as a comma-separated list: never (the default) for no retries; always for every query that did not succeed; generic when the reason of the failure contains GENERIC_INTERNAL_ERROR; exhausted when the query exhausted the resources at this scale factor; retryable for both generic and exhausted. never, always and retryable cannot be combined with another value. Used only when maxAttempts is above 1 and waitTimeout above 0. The CamelAwsAthenaRetry header takes precedence over this option.

never

String

camel.component.aws2-athena.secret-key

The secret access key of the AWS credentials, which the client uses together with accessKey.

String

camel.component.aws2-athena.session-token

The session token of temporary AWS credentials, for example from assuming an IAM role. The client uses it only when useSessionCredentials is true, together with accessKey and secretKey.

String

camel.component.aws2-athena.trust-all-certificates

Whether the client trusts all TLS certificates without validating them. It applies to every connection of the client, not only when the endpoint is overridden.

false

Boolean

camel.component.aws2-athena.uri-endpoint-override

The URI that the client sends its requests to, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

camel.component.aws2-athena.use-default-credentials-provider

Whether the client loads the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the web identity token, the profile files, and the container and instance metadata. It takes precedence over the other credentials options.

false

Boolean

camel.component.aws2-athena.use-message-body-for-sql

Whether to use the message body as the SQL query to run. When enabled, a non-empty message body takes precedence over the CamelAwsAthenaQueryString header and the queryString option. When disabled, the message body is not used as the query.

false

Boolean

camel.component.aws2-athena.use-profile-credentials-provider

Whether the client loads the credentials from a profile of the AWS config and credentials files, the one that profileCredentialsName names. It takes precedence over useSessionCredentials, accessKey and secretKey, but not over useDefaultCredentialsProvider.

false

Boolean

camel.component.aws2-athena.use-session-credentials

Whether the client uses temporary session credentials made of accessKey, secretKey and sessionToken, for example after assuming an IAM role. All three are required: if one of the three is missing, creating the client fails.

false

Boolean

camel.component.aws2-athena.wait-timeout

The maximum time in milliseconds that startQueryExecution waits for the query to complete, checking its state after initialDelay and then every delay. 0, the default, does not wait: the producer returns after starting the query, without its state, and makes no retries. A query that fails, or still runs when the time is up, does not fail the exchange: check the CamelAwsAthenaQueryExecutionState header. A negative value fails the exchange. The CamelAwsAthenaWaitTimeout header takes precedence over this option.

0

Long

camel.component.aws2-athena.work-group

The name of the workgroup that startQueryExecution runs the query in, and whose query executions listQueryExecutions lists. If not set, Athena uses the primary workgroup. The CamelAwsAthenaWorkGroup header takes precedence over this option.

String