Camel Spring Boot

AWS Polly

Synthesize speech from text or SSML with Amazon Polly, and manage its pronunciation lexicons and speech synthesis tasks.

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-polly-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 36 options, which are listed below.

Name Description Default Type

camel.component.aws2-polly.access-key

The access key ID of the AWS credentials, used together with the secretKey option. The endpoint requires it, unless pollyClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

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

The configuration that the endpoints of this component start from. Each endpoint gets a copy of it, and the options of the endpoint replace its values. The option is a org.apache.camel.component.aws2.polly.Polly2Configuration type.

Polly2Configuration

camel.component.aws2-polly.enabled

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

Boolean

camel.component.aws2-polly.engine

The engine that synthesizes the speech: standard, neural, long-form or generative. The voice must support it. For synthesizeSpeech and startSpeechSynthesisTask, Amazon Polly uses the standard engine when neither this option nor the CamelAwsPollyEngine header is set; for describeVoices it only lists the voices that support this engine. The header is used only when this option is not set, and neither is used when pojoRequest is true.

Engine

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

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

true

Boolean

camel.component.aws2-polly.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-polly.language-code

A language code such as en-US or hi-IN. For synthesizeSpeech and startSpeechSynthesisTask, it selects the language of a bilingual voice, such as Aditi for en-IN or hi-IN, and if not set the voice speaks its default language; for describeVoices, it only lists the voices of this language. The CamelAwsPollyLanguageCode header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.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-polly.lexicon-content

The pronunciation lexicon that putLexicon stores, as a PLS (Pronunciation Lexicon Specification) XML document. A lexicon with the same name in the region is replaced. When neither this option nor the CamelAwsPollyLexiconContent header is set, the body is used. It is not used when pojoRequest is true.

String

camel.component.aws2-polly.lexicon-name

The name of the pronunciation lexicon for getLexicon, putLexicon and deleteLexicon, which fail when neither this option nor the CamelAwsPollyLexiconName header is set. The name is a case-sensitive alphanumeric string of up to 20 characters. The header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.lexicon-names

A comma-separated list of up to 5 names of pronunciation lexicons, stored with putLexicon, that Amazon Polly applies during synthesizeSpeech and startSpeechSynthesisTask. A lexicon applies only when its language is the language of the voice. The CamelAwsPollyLexiconNames header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.operation

The operation that the producer performs. The CamelAwsPollyOperation header replaces this option.

synthesizespeech

Polly2Operations

camel.component.aws2-polly.output-format

The format of the output of synthesizeSpeech and startSpeechSynthesisTask: mp3, ogg_vorbis, ogg_opus, pcm (signed 16-bit, mono, little-endian), mulaw or alaw for audio, or json for speech marks. The component cannot set the speech mark types that json needs, so use a request of the AWS SDK with pojoRequest=true for speech marks. When neither this option nor the CamelAwsPollyOutputFormat header is set, mp3 is used. The header is used only when this option is not set, and neither is used when pojoRequest is true.

OutputFormat

camel.component.aws2-polly.override-endpoint

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

camel.component.aws2-polly.pojo-request

Whether the body is the request of the AWS SDK for the operation, such as a SynthesizeSpeechRequest for synthesizeSpeech. If true, the producer sends that request as it is, without the options and headers of the operation, and a body of another type fails. Use it for the request fields that the component does not set, such as the speech mark types. If false, the producer builds the request from the options, the headers and the body.

false

Boolean

camel.component.aws2-polly.polly-client

To use a custom software.amazon.awssdk.services.polly.PollyClient, which is autowired when the registry has a single one. When this option is set, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The endpoint does not close a client that is set or autowired. The option is a software.amazon.awssdk.services.polly.PollyClient type.

PollyClient

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

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

camel.component.aws2-polly.proxy-host

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

String

camel.component.aws2-polly.proxy-port

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

Integer

camel.component.aws2-polly.proxy-protocol

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

https

Protocol

camel.component.aws2-polly.region

The AWS region of Amazon Polly, as a region ID such as eu-west-1, which is the value of Region.EU_WEST_1.id(). If not set, the default region provider chain of the AWS SDK is used. Lexicons and speech synthesis tasks are kept per region, and Amazon Polly is not available in every region.

String

camel.component.aws2-polly.s3-bucket

The name of the Amazon S3 bucket in which startSpeechSynthesisTask stores the output file, which fails when neither this option nor the CamelAwsPollyS3Bucket header is set. The header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.s3-key-prefix

The prefix of the Amazon S3 key of the output file of startSpeechSynthesisTask, to which Amazon Polly adds the task ID and the file extension: the output URI of the returned task gives the full location. The CamelAwsPollyS3KeyPrefix header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.sample-rate

The sample rate of the audio in Hz, as a string, for synthesizeSpeech and startSpeechSynthesisTask: 8000, 16000, 22050 or 24000 for mp3 and ogg_vorbis (also 44100 and 48000 for synthesizeSpeech), 8000 or 16000 for pcm, 48000 for ogg_opus and 8000 for mulaw and alaw. If not set, Amazon Polly uses 22050 for the standard engine and 24000 for the other engines with mp3 and ogg_vorbis, and 16000 with pcm. The CamelAwsPollySampleRate header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.secret-key

The secret access key of the AWS credentials, used together with the accessKey option. The endpoint requires it, unless pollyClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

camel.component.aws2-polly.session-token

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. All three are then required: if one of the three is missing, creating the client fails.

String

camel.component.aws2-polly.sns-topic-arn

The ARN of the Amazon SNS topic to which Amazon Polly sends the status notifications of a task of startSpeechSynthesisTask. If not set, no notification is sent. The CamelAwsPollySnsTopicArn header is used only when this option is not set, and neither is used when pojoRequest is true.

String

camel.component.aws2-polly.task-id

The ID of the speech synthesis task to get with getSpeechSynthesisTask, which fails when neither this option nor the CamelAwsPollyTaskId header is set. startSpeechSynthesisTask sets that header, but this option, when set, is used instead of it. Amazon Polly keeps a task for 72 hours. It is not used when pojoRequest is true.

String

camel.component.aws2-polly.text-type

Whether the text of the body is plain text (text) or SSML (ssml), for synthesizeSpeech and startSpeechSynthesisTask. SSML must be valid, well-formed SSML in a speak element. When neither this option nor the CamelAwsPollyTextType header is set, text is used. The header is used only when this option is not set, and neither is used when pojoRequest is true.

TextType

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

Whether the HTTP client of Amazon Polly 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

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

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

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

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

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

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

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

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

camel.component.aws2-polly.voice-id

The ID of the voice that speaks the text, such as Joanna or Matthew, for synthesizeSpeech and startSpeechSynthesisTask, which fail when neither this option nor the CamelAwsPollyVoiceId header is set. The voice must support the engine of the request: describeVoices lists the voices and their engines. The header is used only when this option is not set, and neither is used when pojoRequest is true.

VoiceId