This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8f10ea95942c0ac16ab554bce06def665e1c0788 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Apr 8 16:07:16 2020 +0200 Regen docs --- .../modules/ROOT/pages/aws2-translate-component.adoc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/components/modules/ROOT/pages/aws2-translate-component.adoc b/docs/components/modules/ROOT/pages/aws2-translate-component.adoc index c36afb1..00ac26e 100644 --- a/docs/components/modules/ROOT/pages/aws2-translate-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-translate-component.adoc @@ -37,7 +37,7 @@ You can append query options to the URI in the following format, // component options: START -The AWS 2 Translate component supports 14 options, which are listed below. +The AWS 2 Translate component supports 15 options, which are listed below. @@ -48,6 +48,7 @@ The AWS 2 Translate component supports 14 options, which are listed below. | *configuration* (producer) | Component configuration | | Translate2Configuration | *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 [...] | *operation* (producer) | *Required* The operation to perform. The value can be one of: translateText | translateText | Translate2Operations +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the Translate client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the Translate client | | Integer | *proxyProtocol* (producer) | To define a proxy protocol when instantiating the Translate client. The value can be one of: HTTP, HTTPS | HTTPS | Protocol @@ -83,7 +84,7 @@ with the following path and query parameters: |=== -=== Query Parameters (14 parameters): +=== Query Parameters (15 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -92,6 +93,7 @@ with the following path and query parameters: | *autodetectSourceLanguage* (producer) | Being able to autodetect the source language | false | boolean | *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 [...] | *operation* (producer) | *Required* The operation to perform. The value can be one of: translateText | translateText | Translate2Operations +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the Translate client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the Translate client | | Integer | *proxyProtocol* (producer) | To define a proxy protocol when instantiating the Translate client. The value can be one of: HTTP, HTTPS | HTTPS | Protocol @@ -156,6 +158,20 @@ from("direct:start") As result you'll get an exchange containing the translated text. +== Using a POJO as body + +Sometimes build an AWS Request can be complex, because of multiple options. We introduce the possibility to use a POJO as body. +In AWS Translate the only operation available is TranslateText so you can do something like: + +------------------------------------------------------------------------------------------------------ +from("direct:start") + .setBody(TranslateTextRequest.builder().sourceLanguageCode(Translate2LanguageEnum.ITALIAN.toString()) + .targetLanguageCode(Translate2LanguageEnum.GERMAN.toString()).text("Ciao").build()) + .to("aws2-translate://test?translateClient=#amazonTranslateClient&operation=translateText"); +------------------------------------------------------------------------------------------------------ + +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.