Interface PollyAsyncClient

All Superinterfaces:
AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface PollyAsyncClient extends AwsClient
Service client for accessing Amazon Polly asynchronously. This can be created using the static builder() method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.

Amazon Polly is a web service that makes it easy to synthesize speech from text.

The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results for your application domain.

  • Field Details

  • Method Details

    • deleteLexicon

      default CompletableFuture<DeleteLexiconResponse> deleteLexicon(DeleteLexiconRequest deleteLexiconRequest)

      Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs.

      For more information, see Managing Lexicons.

      Parameters:
      deleteLexiconRequest -
      Returns:
      A Java Future containing the result of the DeleteLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • deleteLexicon

      default CompletableFuture<DeleteLexiconResponse> deleteLexicon(Consumer<DeleteLexiconRequest.Builder> deleteLexiconRequest)

      Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs.

      For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the DeleteLexiconRequest.Builder avoiding the need to create one manually via DeleteLexiconRequest.builder()

      Parameters:
      deleteLexiconRequest - A Consumer that will call methods on DeleteLexiconRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the DeleteLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • describeVoices

      default CompletableFuture<DescribeVoicesResponse> describeVoices(DescribeVoicesRequest describeVoicesRequest)

      Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.

      When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices.

      For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from.

      You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.

      This operation requires permissions to perform the polly:DescribeVoices action.

      Parameters:
      describeVoicesRequest -
      Returns:
      A Java Future containing the result of the DescribeVoices operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • describeVoices

      default CompletableFuture<DescribeVoicesResponse> describeVoices(Consumer<DescribeVoicesRequest.Builder> describeVoicesRequest)

      Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.

      When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices.

      For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from.

      You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.

      This operation requires permissions to perform the polly:DescribeVoices action.


      This is a convenience which creates an instance of the DescribeVoicesRequest.Builder avoiding the need to create one manually via DescribeVoicesRequest.builder()

      Parameters:
      describeVoicesRequest - A Consumer that will call methods on DescribeVoicesRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the DescribeVoices operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • describeVoices

      default CompletableFuture<DescribeVoicesResponse> describeVoices()

      Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.

      When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices.

      For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from.

      You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.

      This operation requires permissions to perform the polly:DescribeVoices action.

      Returns:
      A Java Future containing the result of the DescribeVoices operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getLexicon

      default CompletableFuture<GetLexiconResponse> getLexicon(GetLexiconRequest getLexiconRequest)

      Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.

      Parameters:
      getLexiconRequest -
      Returns:
      A Java Future containing the result of the GetLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getLexicon

      default CompletableFuture<GetLexiconResponse> getLexicon(Consumer<GetLexiconRequest.Builder> getLexiconRequest)

      Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the GetLexiconRequest.Builder avoiding the need to create one manually via GetLexiconRequest.builder()

      Parameters:
      getLexiconRequest - A Consumer that will call methods on GetLexiconRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the GetLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getSpeechSynthesisTask

      default CompletableFuture<GetSpeechSynthesisTaskResponse> getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest)

      Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.

      Parameters:
      getSpeechSynthesisTaskRequest -
      Returns:
      A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getSpeechSynthesisTask

      default CompletableFuture<GetSpeechSynthesisTaskResponse> getSpeechSynthesisTask(Consumer<GetSpeechSynthesisTaskRequest.Builder> getSpeechSynthesisTaskRequest)

      Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.


      This is a convenience which creates an instance of the GetSpeechSynthesisTaskRequest.Builder avoiding the need to create one manually via GetSpeechSynthesisTaskRequest.builder()

      Parameters:
      getSpeechSynthesisTaskRequest - A Consumer that will call methods on GetSpeechSynthesisTaskRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listLexicons

      default CompletableFuture<ListLexiconsResponse> listLexicons(ListLexiconsRequest listLexiconsRequest)

      Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.

      Parameters:
      listLexiconsRequest -
      Returns:
      A Java Future containing the result of the ListLexicons operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listLexicons

      default CompletableFuture<ListLexiconsResponse> listLexicons(Consumer<ListLexiconsRequest.Builder> listLexiconsRequest)

      Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the ListLexiconsRequest.Builder avoiding the need to create one manually via ListLexiconsRequest.builder()

      Parameters:
      listLexiconsRequest - A Consumer that will call methods on ListLexiconsRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the ListLexicons operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listLexicons

      default CompletableFuture<ListLexiconsResponse> listLexicons()

      Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.

      Returns:
      A Java Future containing the result of the ListLexicons operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasks

      default CompletableFuture<ListSpeechSynthesisTasksResponse> listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest)

      Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.

      Parameters:
      listSpeechSynthesisTasksRequest -
      Returns:
      A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasks

      default CompletableFuture<ListSpeechSynthesisTasksResponse> listSpeechSynthesisTasks(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest)

      Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.


      This is a convenience which creates an instance of the ListSpeechSynthesisTasksRequest.Builder avoiding the need to create one manually via ListSpeechSynthesisTasksRequest.builder()

      Parameters:
      listSpeechSynthesisTasksRequest - A Consumer that will call methods on ListSpeechSynthesisTasksRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasks

      default CompletableFuture<ListSpeechSynthesisTasksResponse> listSpeechSynthesisTasks()

      Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.

      Returns:
      A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasksPaginator

      default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator()

      This is a variant of listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.

      When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a new Subscription i.e., a new contract to stream data from the starting request.

      The following are few ways to use the response class:

      1) Using the subscribe helper method
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() {
       
       public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
       
       
       public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.

      Note: If you prefer to have control on service calls, use the listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation.

      Returns:
      A custom publisher that can be subscribed to request a stream of response pages.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasksPaginator

      default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest)

      This is a variant of listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.

      When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a new Subscription i.e., a new contract to stream data from the starting request.

      The following are few ways to use the response class:

      1) Using the subscribe helper method
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() {
       
       public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
       
       
       public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.

      Note: If you prefer to have control on service calls, use the listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation.

      Parameters:
      listSpeechSynthesisTasksRequest -
      Returns:
      A custom publisher that can be subscribed to request a stream of response pages.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • listSpeechSynthesisTasksPaginator

      default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest)

      This is a variant of listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.

      When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a new Subscription i.e., a new contract to stream data from the starting request.

      The following are few ways to use the response class:

      1) Using the subscribe helper method
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() {
       
       public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
       
       
       public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.

      Note: If you prefer to have control on service calls, use the listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest) operation.


      This is a convenience which creates an instance of the ListSpeechSynthesisTasksRequest.Builder avoiding the need to create one manually via ListSpeechSynthesisTasksRequest.builder()

      Parameters:
      listSpeechSynthesisTasksRequest - A Consumer that will call methods on ListSpeechSynthesisTasksRequest.Builder to create a request.
      Returns:
      A custom publisher that can be subscribed to request a stream of response pages.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putLexicon

      default CompletableFuture<PutLexiconResponse> putLexicon(PutLexiconRequest putLexiconRequest)

      Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.

      For more information, see Managing Lexicons.

      Parameters:
      putLexiconRequest -
      Returns:
      A Java Future containing the result of the PutLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and then try again.
      • UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa and ipa.
      • UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
      • LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this operation.
      • MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
      • MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this operation.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • putLexicon

      default CompletableFuture<PutLexiconResponse> putLexicon(Consumer<PutLexiconRequest.Builder> putLexiconRequest)

      Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.

      For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the PutLexiconRequest.Builder avoiding the need to create one manually via PutLexiconRequest.builder()

      Parameters:
      putLexiconRequest - A Consumer that will call methods on PutLexiconRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the PutLexicon operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and then try again.
      • UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa and ipa.
      • UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
      • LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this operation.
      • MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
      • MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this operation.
      • ServiceFailureException An unknown condition has caused a service failure.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startSpeechSynthesisTask

      default CompletableFuture<StartSpeechSynthesisTaskResponse> startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest)

      Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters ( OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status. The SpeechSynthesisTask object is available for 72 hours after starting the asynchronous synthesis task.

      Parameters:
      startSpeechSynthesisTaskRequest -
      Returns:
      A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements and try again.
      • InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startSpeechSynthesisTask

      default CompletableFuture<StartSpeechSynthesisTaskResponse> startSpeechSynthesisTask(Consumer<StartSpeechSynthesisTaskRequest.Builder> startSpeechSynthesisTaskRequest)

      Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters ( OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status. The SpeechSynthesisTask object is available for 72 hours after starting the asynchronous synthesis task.


      This is a convenience which creates an instance of the StartSpeechSynthesisTaskRequest.Builder avoiding the need to create one manually via StartSpeechSynthesisTaskRequest.builder()

      Parameters:
      startSpeechSynthesisTaskRequest - A Consumer that will call methods on StartSpeechSynthesisTaskRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements and try again.
      • InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • synthesizeSpeech

      default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse,ReturnT> asyncResponseTransformer)

      Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.

      Parameters:
      synthesizeSpeechRequest -
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '

      Stream containing the synthesized speech.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • synthesizeSpeech

      default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse,ReturnT> asyncResponseTransformer)

      Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.


      This is a convenience which creates an instance of the SynthesizeSpeechRequest.Builder avoiding the need to create one manually via SynthesizeSpeechRequest.builder()

      Parameters:
      synthesizeSpeechRequest - A Consumer that will call methods on SynthesizeSpeechRequest.Builder to create a request.
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows '

      Stream containing the synthesized speech.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • synthesizeSpeech

      default CompletableFuture<SynthesizeSpeechResponse> synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, Path destinationPath)

      Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.

      Parameters:
      synthesizeSpeechRequest -
      destinationPath - Path to file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '

      Stream containing the synthesized speech.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • synthesizeSpeech

      default CompletableFuture<SynthesizeSpeechResponse> synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, Path destinationPath)

      Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.


      This is a convenience which creates an instance of the SynthesizeSpeechRequest.Builder avoiding the need to create one manually via SynthesizeSpeechRequest.builder()

      Parameters:
      synthesizeSpeechRequest - A Consumer that will call methods on SynthesizeSpeechRequest.Builder to create a request.
      destinationPath - Path to file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows '

      Stream containing the synthesized speech.

      '.
      Returns:
      A future to the transformed result of the AsyncResponseTransformer.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters.
      • InvalidSampleRateException The specified sample rate is not valid.
      • InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
      • LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.

        Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.

      • ServiceFailureException An unknown condition has caused a service failure.
      • MarksNotSupportedForFormatException Speech marks are not supported for the OutputFormat selected. Speech marks are only available for content in json format.
      • SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
      • LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
      • EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • serviceClientConfiguration

      default PollyServiceClientConfiguration serviceClientConfiguration()
      Description copied from interface: SdkClient
      The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration
      Specified by:
      serviceClientConfiguration in interface AwsClient
      Specified by:
      serviceClientConfiguration in interface SdkClient
      Returns:
      SdkServiceClientConfiguration
    • create

      static PollyAsyncClient create()
      Create a PollyAsyncClient with the region loaded from the DefaultAwsRegionProviderChain and credentials loaded from the DefaultCredentialsProvider.
    • builder

      static PollyAsyncClientBuilder builder()
      Create a builder that can be used to configure and create a PollyAsyncClient.