This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit b3f6892fc76a2d562cad4fbc39a5604c3a6a1bec Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jun 15 13:02:55 2026 +0200 chore: wrap component doc examples in tabs blocks with YAML DSL Wrap paired Java+XML route DSL examples in [tabs] blocks across 27 component doc files, adding canonical YAML DSL examples to each. Also fixes several pre-existing doc bugs: broken </joor> closing tag in java-language.adoc, missing closing parenthesis in xquery expression, broken </route> tags in telegram-component.adoc, missing <route> wrapper in xmlsecurity-verify XML, and mismatched method names in thrift-component.adoc. Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../main/docs/atmosphere-websocket-component.adoc | 78 +++++++---- .../src/main/docs/base64-dataformat.adoc | 70 ++++++++-- .../src/main/docs/hwcloud-frs-component.adoc | 155 ++++++++++++++++----- .../docs/hwcloud-imagerecognition-component.adoc | 140 ++++++++++++++----- .../src/main/docs/hwcloud-smn-component.adoc | 81 ++++++++--- .../camel-jcr/src/main/docs/jcr-component.adoc | 83 ++++++++++- .../camel-joor/src/main/docs/java-language.adoc | 35 ++++- .../docs/kubernetes-config-maps-component.adoc | 104 +++++++++++--- .../main/docs/kubernetes-secrets-component.adoc | 103 +++++++++++--- .../camel-log/src/main/docs/log-component.adoc | 29 +++- .../camel-mvel/src/main/docs/mvel-language.adoc | 26 +++- .../camel-ocsf/src/main/docs/ocsf-dataformat.adoc | 63 +++++---- .../camel-ognl/src/main/docs/ognl-language.adoc | 26 +++- .../camel-once/src/main/docs/once-component.adoc | 64 ++++++++- .../src/main/docs/protobuf-dataformat.adoc | 66 ++++++--- .../camel-saxon/src/main/docs/xquery-language.adoc | 34 ++++- .../src/main/docs/scheduler-component.adoc | 33 ++++- .../camel-solr/src/main/docs/solr-component.adoc | 59 +++++++- .../camel-spring/src/main/docs/spel-language.adoc | 34 ++++- .../camel-ssh/src/main/docs/ssh-component.adoc | 84 +++++++++-- .../src/main/docs/swiftMt-dataformat.adoc | 70 ++++++++-- .../src/main/docs/swiftMx-dataformat.adoc | 70 ++++++++-- .../src/main/docs/telegram-component.adoc | 82 ++++++++--- .../src/main/docs/thrift-component.adoc | 71 ++++++++-- .../src/main/docs/thrift-dataformat.adoc | 54 +++++-- .../camel-timer/src/main/docs/timer-component.adoc | 94 +++++++++++-- .../main/docs/xmlsecurity-verify-component.adoc | 46 ++++-- 27 files changed, 1477 insertions(+), 377 deletions(-) diff --git a/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc b/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc index 3de9702dc6da..dc7e132a4b7c 100644 --- a/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc +++ b/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc @@ -54,46 +54,76 @@ the producer or the consumer, respectively. In the route below, Camel will read from the specified websocket connection. +[tabs] +==== +Java:: ++ [source,java] -------------------------------------------- +---- from("atmosphere-websocket:///servicepath") .to("direct:next"); -------------------------------------------- - -And the equivalent Spring sample: +---- +XML:: ++ [source,xml] ------------------------------------------------------------- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="atmosphere-websocket:///servicepath"/> - <to uri="direct:next"/> - </route> -</camelContext> ------------------------------------------------------------- +---- +<route> + <from uri="atmosphere-websocket:///servicepath"/> + <to uri="direct:next"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: atmosphere-websocket:///servicepath + steps: + - to: + uri: direct:next +---- +==== === Producer Example In the route below, Camel will write to the specified websocket connection. +[tabs] +==== +Java:: ++ [source,java] ---------------------------------------------------- +---- from("direct:next") .to("atmosphere-websocket:///servicepath"); ---------------------------------------------------- - -And the equivalent Spring sample: +---- +XML:: ++ [source,xml] ------------------------------------------------------------- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:next"/> - <to uri="atmosphere-websocket:///servicepath"/> - </route> -</camelContext> ------------------------------------------------------------- +---- +<route> + <from uri="direct:next"/> + <to uri="atmosphere-websocket:///servicepath"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:next + steps: + - to: + uri: atmosphere-websocket:///servicepath +---- +==== include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-base64/src/main/docs/base64-dataformat.adoc b/components/camel-base64/src/main/docs/base64-dataformat.adoc index 1c91b3df2a5d..14df9a882e9c 100644 --- a/components/camel-base64/src/main/docs/base64-dataformat.adoc +++ b/components/camel-base64/src/main/docs/base64-dataformat.adoc @@ -52,6 +52,10 @@ inline as shown below. In this example, we marshal the file content to a base64 object. +[tabs] +==== +Java:: ++ [source,java] ---- from("file://data.bin") @@ -59,22 +63,43 @@ from("file://data.bin") .to("jms://myqueue"); ---- -In Spring DSL: - +XML:: ++ [source,xml] ---- - <from uri="file://data.bin"> - <marshal> - <base64/> - </marshal> - <to uri="jms://myqueue"/> +<route> + <from uri="file://data.bin"/> + <marshal> + <base64/> + </marshal> + <to uri="jms://myqueue"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: file://data.bin + steps: + - marshal: + base64: {} + - to: + uri: jms://myqueue ---- +==== == Unmarshal In this example, we unmarshal the payload from the JMS queue to a byte[] object, before its processed by the `newOrder` processor. +[tabs] +==== +Java:: ++ [source,java] ---- from("jms://queue/order") @@ -82,16 +107,33 @@ from("jms://queue/order") .process("newOrder"); ---- -In Spring DSL: - +XML:: ++ [source,xml] ---- - <from uri="jms://queue/order"> - <unmarshal> - <base64/> - </unmarshal> - <to uri="bean:newOrder"/> +<route> + <from uri="jms://queue/order"/> + <unmarshal> + <base64/> + </unmarshal> + <to uri="bean:newOrder"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: jms://queue/order + steps: + - unmarshal: + base64: {} + - to: + uri: bean:newOrder ---- +==== == Dependencies diff --git a/components/camel-huawei/camel-huaweicloud-frs/src/main/docs/hwcloud-frs-component.adoc b/components/camel-huawei/camel-huaweicloud-frs/src/main/docs/hwcloud-frs-component.adoc index e2262713dc39..e4348aa5d2b4 100644 --- a/components/camel-huawei/camel-huaweicloud-frs/src/main/docs/hwcloud-frs-component.adoc +++ b/components/camel-huawei/camel-huaweicloud-frs/src/main/docs/hwcloud-frs-component.adoc @@ -90,8 +90,10 @@ When using imageBase64 or videoBase64 option, we suggest you use RAW(base64_valu ==== faceDetection -Java DSL - +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:triggerRoute") @@ -99,51 +101,106 @@ from("direct:triggerRoute") .to("hwcloud-frs:faceDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") ---- -XML DSL - +XML:: ++ [source,xml] ---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudFrsImageUrl"> - <constant>https://xxxx</constant> - </setProperty> - <to uri="hwcloud-frs:faceDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudFrsImageUrl"> + <constant>https://xxxx</constant> + </setProperty> + <to uri="hwcloud-frs:faceDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> ---- -=== faceVerification +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudFrsImageUrl + expression: + constant: + expression: https://xxxx + - to: + uri: hwcloud-frs:faceDetection + parameters: + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== -Java DSL +==== faceVerification +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:triggerRoute") - .setProperty(FaceRecognitionProperties.FACE_IMAGE_BASE64, constant("/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk...")) - .setProperty(FaceRecognitionProperties.ANOTHER_FACE_IMAGE_BASE64, constant("/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgFBgcGBQgHBgcJCAgJDBMMDAsLDBgREg4THBgdHRsYGxofIywlHyEqIRobJjQnKi4vMTIxHiU2Os...")) + .setProperty(FaceRecognitionProperties.FACE_IMAGE_BASE64, constant("/9j/4AAQSkZJRgABAQEASABIAAD/...")) + .setProperty(FaceRecognitionProperties.ANOTHER_FACE_IMAGE_BASE64, constant("/9j/4AAQSkZJRgABAQAAAQABAAD/...")) .to("hwcloud-frs:faceVerification?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") ---- -XML DSL - +XML:: ++ [source,xml] ---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudFrsImageBase64"> - <constant>/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk...</constant> - </setProperty> - <setProperty name="CamelHwCloudFrsAnotherImageBase64"> - <constant>/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgFBgcGBQgHBgcJCAgJDBMMDAsLDBgREg4THBgdHRsYGxofIywlHyEqIRobJjQnKi4vMTIxHiU2Os...</constant> - </setProperty> - <to uri="hwcloud-frs:faceVerification?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudFrsImageBase64"> + <constant>/9j/4AAQSkZJRgABAQEASABIAAD/...</constant> + </setProperty> + <setProperty name="CamelHwCloudFrsAnotherImageBase64"> + <constant>/9j/4AAQSkZJRgABAQAAAQABAAD/...</constant> + </setProperty> + <to uri="hwcloud-frs:faceVerification?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> ---- -=== faceLiveDetection +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudFrsImageBase64 + expression: + constant: + expression: "/9j/4AAQSkZJRgABAQEASABIAAD/..." + - setProperty: + name: CamelHwCloudFrsAnotherImageBase64 + expression: + constant: + expression: "/9j/4AAQSkZJRgABAQAAAQABAAD/..." + - to: + uri: hwcloud-frs:faceVerification + parameters: + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== -Java DSL +==== faceLiveDetection +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:triggerRoute") @@ -152,20 +209,48 @@ from("direct:triggerRoute") .to("hwcloud-frs:faceLiveDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") ---- -XML DSL - +XML:: ++ [source,xml] ---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudFrsVideoFilePath"> - <constant>/tmp/video.mp4</constant> - </setProperty> - <setProperty name="CamelHwCloudFrsVideoActions"> - <constant>1,3,2</constant> - </setProperty> - <to uri="hwcloud-frs:faceLiveDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudFrsVideoFilePath"> + <constant>/tmp/video.mp4</constant> + </setProperty> + <setProperty name="CamelHwCloudFrsVideoActions"> + <constant>1,3,2</constant> + </setProperty> + <to uri="hwcloud-frs:faceLiveDetection?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudFrsVideoFilePath + expression: + constant: + expression: /tmp/video.mp4 + - setProperty: + name: CamelHwCloudFrsVideoActions + expression: + constant: + expression: "1,3,2" + - to: + uri: hwcloud-frs:faceLiveDetection + parameters: + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== + include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/docs/hwcloud-imagerecognition-component.adoc b/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/docs/hwcloud-imagerecognition-component.adoc index 16591ddeb219..561337f66f94 100644 --- a/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/docs/hwcloud-imagerecognition-component.adoc +++ b/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/docs/hwcloud-imagerecognition-component.adoc @@ -77,67 +77,137 @@ When using imageContent option, we suggest you use RAW(image_base64_value) to av ==== celebrityRecognition -Java DSL - +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:triggerRoute") .setProperty(ImageRecognitionProperties.IMAGE_URL, constant("https://xxxx")) - .setProperty(ImageRecognitionProperties.THRESHOLD,constant(0.5)) + .setProperty(ImageRecognitionProperties.THRESHOLD, constant(0.5)) .to("hwcloud-imagerecognition:celebrityRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") ---- -XML DSL - +XML:: ++ [source,xml] ---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudImageUrl"> - <constant>https://xxxx</constant> - </setProperty> - <setProperty name="CamelHwCloudImageThreshold"> - <constant>0.5</constant> - </setProperty> - <to uri="hwcloud-imagerecognition:celebrityRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudImageUrl"> + <constant>https://xxxx</constant> + </setProperty> + <setProperty name="CamelHwCloudImageThreshold"> + <constant>0.5</constant> + </setProperty> + <to uri="hwcloud-imagerecognition:celebrityRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> ---- -=== tagRecognition +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudImageUrl + expression: + constant: + expression: https://xxxx + - setProperty: + name: CamelHwCloudImageThreshold + expression: + constant: + expression: "0.5" + - to: + uri: hwcloud-imagerecognition:celebrityRecognition + parameters: + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== -Java DSL +==== tagRecognition +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:triggerRoute") - .setProperty(ImageRecognitionProperties.IMAGE_CONTENT, constant("/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//...")) - .setProperty(ImageRecognitionProperties.THRESHOLD,constant(60)) - .setProperty(ImageRecognitionProperties.TAG_LANGUAGE,constant("en")) - .setProperty(ImageRecognitionProperties.TAG_LIMIT,constant(50)) + .setProperty(ImageRecognitionProperties.IMAGE_CONTENT, constant("/9j/4AAQSkZJRgABAQEASABIAAD/...")) + .setProperty(ImageRecognitionProperties.THRESHOLD, constant(60)) + .setProperty(ImageRecognitionProperties.TAG_LANGUAGE, constant("en")) + .setProperty(ImageRecognitionProperties.TAG_LIMIT, constant(50)) .to("hwcloud-imagerecognition:tagRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") ---- -XML DSL - +XML:: ++ [source,xml] ---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudImageContent"> - <constant>/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//...</constant> - </setProperty> - <setProperty name="CamelHwCloudImageThreshold"> - <constant>60</constant> - </setProperty> - <setProperty name="CamelHwCloudImageTagLanguage"> - <constant>en</constant> - </setProperty> - <setProperty name="CamelHwCloudImageTagLimit"> - <constant>50</constant> - </setProperty> - <to uri="hwcloud-imagerecognition:tagRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudImageContent"> + <constant>/9j/4AAQSkZJRgABAQEASABIAAD/...</constant> + </setProperty> + <setProperty name="CamelHwCloudImageThreshold"> + <constant>60</constant> + </setProperty> + <setProperty name="CamelHwCloudImageTagLanguage"> + <constant>en</constant> + </setProperty> + <setProperty name="CamelHwCloudImageTagLimit"> + <constant>50</constant> + </setProperty> + <to uri="hwcloud-imagerecognition:tagRecognition?accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudImageContent + expression: + constant: + expression: "/9j/4AAQSkZJRgABAQEASABIAAD/..." + - setProperty: + name: CamelHwCloudImageThreshold + expression: + constant: + expression: "60" + - setProperty: + name: CamelHwCloudImageTagLanguage + expression: + constant: + expression: en + - setProperty: + name: CamelHwCloudImageTagLimit + expression: + constant: + expression: "50" + - to: + uri: hwcloud-imagerecognition:tagRecognition + parameters: + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== + include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-huawei/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc b/components/camel-huawei/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc index abe4974a71dd..ff7f86c8bbf6 100644 --- a/components/camel-huawei/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc +++ b/components/camel-huawei/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc @@ -93,33 +93,72 @@ include::partial$component-endpoint-headers.adoc[] === Inline Configuration of route ==== publishAsTextMessage -Java DSL + +[tabs] +==== +Java:: ++ [source,java] --------------------------------------------------------------------------------- +---- from("direct:triggerRoute") -.setProperty(SmnProperties.NOTIFICATION_SUBJECT, constant("Notification Subject")) -.setProperty(SmnProperties.NOTIFICATION_TOPIC_NAME,constant(testConfiguration.getProperty("topic"))) -.setProperty(SmnProperties.NOTIFICATION_TTL, constant(60)) -.to("hwcloud-smn:publishMessageService?operation=publishAsTextMessage&accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4") --------------------------------------------------------------------------------- + .setProperty(SmnProperties.NOTIFICATION_SUBJECT, constant("Notification Subject")) + .setProperty(SmnProperties.NOTIFICATION_TOPIC_NAME, constant("reji-test")) + .setProperty(SmnProperties.NOTIFICATION_TTL, constant(60)) + .to("hwcloud-smn:publishMessageService?operation=publishAsTextMessage&accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4"); +---- -XML DSL +XML:: ++ [source,xml] --------------------------------------------------------------------------------- +---- <route> - <from uri="direct:triggerRoute" /> - <setProperty name="CamelHwCloudSmnSubject"> - <constant>this is my subjectline</constant> - </setProperty> - <setProperty name="CamelHwCloudSmnTopic"> - <constant>reji-test</constant> - </setProperty> - <setProperty name="CamelHwCloudSmnMessageTtl"> - <constant>60</constant> - </setProperty> - <to uri="hwcloud-smn:publishMessageService?operation=publishAsTextMessage&accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4" /> + <from uri="direct:triggerRoute"/> + <setProperty name="CamelHwCloudSmnSubject"> + <constant>this is my subjectline</constant> + </setProperty> + <setProperty name="CamelHwCloudSmnTopic"> + <constant>reji-test</constant> + </setProperty> + <setProperty name="CamelHwCloudSmnMessageTtl"> + <constant>60</constant> + </setProperty> + <to uri="hwcloud-smn:publishMessageService?operation=publishAsTextMessage&accessKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/> </route> --------------------------------------------------------------------------------- +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:triggerRoute + steps: + - setProperty: + name: CamelHwCloudSmnSubject + expression: + constant: + expression: this is my subjectline + - setProperty: + name: CamelHwCloudSmnTopic + expression: + constant: + expression: reji-test + - setProperty: + name: CamelHwCloudSmnMessageTtl + expression: + constant: + expression: "60" + - to: + uri: hwcloud-smn:publishMessageService + parameters: + operation: publishAsTextMessage + accessKey: "*********" + secretKey: "********" + projectId: 9071a38e7f6a4ba7b7bcbeb7d4ea6efc + region: cn-north-4 +---- +==== diff --git a/components/camel-jcr/src/main/docs/jcr-component.adoc b/components/camel-jcr/src/main/docs/jcr-component.adoc index acb31d4efb66..0b47e895e145 100644 --- a/components/camel-jcr/src/main/docs/jcr-component.adoc +++ b/components/camel-jcr/src/main/docs/jcr-component.adoc @@ -58,25 +58,96 @@ node in the content repository. One additional property is added to the node as well: `my.contents.property` which will contain the body of the message being sent. +[tabs] +==== +Java:: ++ [source,java] ------------------------------------------------------------------------- +---- from("direct:a").setHeader(JcrConstants.JCR_NODE_NAME, constant("node")) .setHeader("my.contents.property", body()) .to("jcr://user:pass@repository/home/test"); ------------------------------------------------------------------------- +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:a"/> + <setHeader name="JcrConstants.JCR_NODE_NAME"> + <constant>node</constant> + </setHeader> + <setHeader name="my.contents.property"> + <simple>${body}</simple> + </setHeader> + <to uri="jcr://user:pass@repository/home/test"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:a + steps: + - setHeader: + name: JcrConstants.JCR_NODE_NAME + expression: + constant: + expression: node + - setHeader: + name: my.contents.property + expression: + simple: + expression: "${body}" + - to: + uri: jcr://user:pass@repository/home/test +---- +==== The following code will register an EventListener under the path import-application/inbox for `Event.NODE_ADDED` and `Event.NODE_REMOVED` events (event types 1 and 2, both masked as 3) and listening deep for all the children. +[tabs] +==== +Java:: ++ +[source,java] +---- +from("jcr://user:pass@repository/import-application/inbox?eventTypes=3&deep=true") + .to("direct:execute-import-application"); +---- + +XML:: ++ [source,xml] ---------------------------------------------------------------------------------------------- +---- <route> - <from uri="jcr://user:pass@repository/import-application/inbox?eventTypes=3&deep=true" /> - <to uri="direct:execute-import-application" /> + <from uri="jcr://user:pass@repository/import-application/inbox?eventTypes=3&deep=true"/> + <to uri="direct:execute-import-application"/> </route> ---------------------------------------------------------------------------------------------- +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: jcr://user:pass@repository/import-application/inbox + parameters: + eventTypes: 3 + deep: true + steps: + - to: + uri: direct:execute-import-application +---- +==== diff --git a/components/camel-joor/src/main/docs/java-language.adoc b/components/camel-joor/src/main/docs/java-language.adoc index ca90f39db677..41c1616264b6 100644 --- a/components/camel-joor/src/main/docs/java-language.adoc +++ b/components/camel-joor/src/main/docs/java-language.adoc @@ -226,6 +226,10 @@ camelContext.getRegistry().put("MyJoorConfig", config); For example, to transform the message using jOOR language to the upper case +[tabs] +==== +Java:: ++ [source,java] ---- from("seda:orders") @@ -233,19 +237,36 @@ from("seda:orders") .to("seda:upper"); ---- -And in XML DSL: - +XML:: ++ [source,xml] ---- <route> - <from uri="seda:orders"/> - <transform> - <java>message.getBody(String.class).toUpperCase()</joor> - </transform> - <to uri="seda:upper"/> + <from uri="seda:orders"/> + <transform> + <java>message.getBody(String.class).toUpperCase()</java> + </transform> + <to uri="seda:upper"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: seda:orders + steps: + - transform: + expression: + java: + expression: "message.getBody(String.class).toUpperCase()" + - to: + uri: seda:upper +---- +==== + === Multi statements It is possible to include multiple statements. diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc index 6f459fe8224c..8929d5feac0a 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc @@ -42,32 +42,98 @@ include::partial$component-endpoint-headers.adoc[] - `listConfigMaps`: this operation lists the configmaps +[tabs] +==== +Java:: ++ [source,java] --------------------------------------------------------------------------------- -from("direct:list"). - to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMaps"). - to("mock:result"); --------------------------------------------------------------------------------- +---- +from("direct:list") + .to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMaps") + .to("mock:result"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:list"/> + <to uri="kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMaps"/> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:list + steps: + - to: + uri: kubernetes-config-maps:/// + parameters: + kubernetesClient: "#kubernetesClient" + operation: listConfigMaps + - to: + uri: mock:result +---- +==== This operation returns a List of ConfigMaps from your cluster - `listConfigMapsByLabels`: this operation lists the configmaps selected by label +[tabs] +==== +Java:: ++ [source,java] --------------------------------------------------------------------------------- -from("direct:listByLabels").process(new Processor() { - - @Override - public void process(Exchange exchange) throws Exception { - Map<String, String> labels = new HashMap<>(); - labels.put("key1", "value1"); - labels.put("key2", "value2"); - exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_CONFIGMAPS_LABELS, labels); - } - }); - to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMapsByLabels"). - to("mock:result"); --------------------------------------------------------------------------------- +---- +from("direct:listByLabels") + .setHeader(KubernetesConstants.KUBERNETES_CONFIGMAPS_LABELS, constant("key1=value1,key2=value2")) + .to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMapsByLabels") + .to("mock:result"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:listByLabels"/> + <setHeader name="CamelKubernetesConfigMapsLabels"> + <constant>key1=value1,key2=value2</constant> + </setHeader> + <to uri="kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMapsByLabels"/> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:listByLabels + steps: + - setHeader: + name: CamelKubernetesConfigMapsLabels + expression: + constant: + expression: key1=value1,key2=value2 + - to: + uri: kubernetes-config-maps:/// + parameters: + kubernetesClient: "#kubernetesClient" + operation: listConfigMapsByLabels + - to: + uri: mock:result +---- +==== This operation returns a List of ConfigMaps from your cluster, using a label selector (with key1 and key2, with value value1 and value2) diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-secrets-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-secrets-component.adoc index 4d71bf101c7d..b5a4a93c1def 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-secrets-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-secrets-component.adoc @@ -43,31 +43,98 @@ include::partial$component-endpoint-headers.adoc[] - `listSecrets`: this operation lists the secrets on a kubernetes cluster +[tabs] +==== +Java:: ++ [source,java] --------------------------------------------------------------------------------- -from("direct:list"). - toF("kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecrets"). - to("mock:result"); --------------------------------------------------------------------------------- +---- +from("direct:list") + .to("kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecrets") + .to("mock:result"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:list"/> + <to uri="kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecrets"/> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:list + steps: + - to: + uri: kubernetes-secrets:/// + parameters: + kubernetesClient: "#kubernetesClient" + operation: listSecrets + - to: + uri: mock:result +---- +==== This operation returns a list of secrets from your cluster - `listSecretsByLabels`: this operation lists the Secrets by labels on a kubernetes cluster +[tabs] +==== +Java:: ++ [source,java] --------------------------------------------------------------------------------- -from("direct:listByLabels").process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - Map<String, String> labels = new HashMap<>(); - labels.put("key1", "value1"); - labels.put("key2", "value2"); - exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_SECRETS_LABELS, labels); - } - }); - toF("kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecretsByLabels"). - to("mock:result"); --------------------------------------------------------------------------------- +---- +from("direct:listByLabels") + .setHeader(KubernetesConstants.KUBERNETES_SECRETS_LABELS, constant("key1=value1,key2=value2")) + .to("kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecretsByLabels") + .to("mock:result"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:listByLabels"/> + <setHeader name="CamelKubernetesSecretsLabels"> + <constant>key1=value1,key2=value2</constant> + </setHeader> + <to uri="kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=listSecretsByLabels"/> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:listByLabels + steps: + - setHeader: + name: CamelKubernetesSecretsLabels + expression: + constant: + expression: key1=value1,key2=value2 + - to: + uri: kubernetes-secrets:/// + parameters: + kubernetesClient: "#kubernetesClient" + operation: listSecretsByLabels + - to: + uri: mock:result +---- +==== This operation returns a list of Secrets from your cluster using a label selector (with key1 and key2, with value value1 and value2) diff --git a/components/camel-log/src/main/docs/log-component.adoc b/components/camel-log/src/main/docs/log-component.adoc index d3b6b5e2520b..389e58c70ded 100644 --- a/components/camel-log/src/main/docs/log-component.adoc +++ b/components/camel-log/src/main/docs/log-component.adoc @@ -80,13 +80,19 @@ include::partial$component-endpoint-headers.adoc[] In the route below we log the incoming orders at `DEBUG` level before the order is processed: +[tabs] +==== +Java:: ++ [source,java] ---- -from("activemq:orders").to("log:com.mycompany.order?level=DEBUG").to("bean:processOrder"); +from("activemq:orders") + .to("log:com.mycompany.order?level=DEBUG") + .to("bean:processOrder"); ---- -Or using Spring XML to define the route: - +XML:: ++ [source,xml] ---- <route> @@ -96,6 +102,23 @@ Or using Spring XML to define the route: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: activemq:orders + steps: + - to: + uri: log:com.mycompany.order + parameters: + level: DEBUG + - to: + uri: bean:processOrder +---- +==== + === Regular logger with formatter example In the route below we log the incoming orders at `INFO` level before the diff --git a/components/camel-mvel/src/main/docs/mvel-language.adoc b/components/camel-mvel/src/main/docs/mvel-language.adoc index 94ea93e94768..3187d57510a0 100644 --- a/components/camel-mvel/src/main/docs/mvel-language.adoc +++ b/components/camel-mvel/src/main/docs/mvel-language.adoc @@ -70,6 +70,10 @@ The following Camel related variables are made available: For example, you could use MVEL inside a xref:eips:filter-eip.adoc[Message Filter] +[tabs] +==== +Java:: ++ [source,java] ---- from("seda:foo") @@ -77,8 +81,8 @@ from("seda:foo") .to("seda:bar"); ---- -And in XML: - +XML:: ++ [source,xml] ---- <route> @@ -90,6 +94,24 @@ And in XML: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: seda:foo + steps: + - filter: + expression: + mvel: + expression: headers.foo == 'bar' + steps: + - to: + uri: seda:bar +---- +==== + == Loading script from external resource You can externalize the script and have Apache Camel load it from a resource diff --git a/components/camel-ocsf/src/main/docs/ocsf-dataformat.adoc b/components/camel-ocsf/src/main/docs/ocsf-dataformat.adoc index 51f19fd15d6f..9ee32c4c1500 100644 --- a/components/camel-ocsf/src/main/docs/ocsf-dataformat.adoc +++ b/components/camel-ocsf/src/main/docs/ocsf-dataformat.adoc @@ -68,6 +68,10 @@ from("kafka:security-events") === Unmarshalling to a Specific Event Class +[tabs] +==== +Java:: ++ [source,java] ---- from("kafka:security-events") @@ -75,6 +79,35 @@ from("kafka:security-events") .to("direct:process"); ---- +XML:: ++ +[source,xml] +---- +<route> + <from uri="kafka:security-events"/> + <unmarshal> + <ocsf unmarshalType="org.apache.camel.dataformat.ocsf.model.DetectionFinding"/> + </unmarshal> + <to uri="direct:process"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: kafka:security-events + steps: + - unmarshal: + ocsf: + unmarshalType: org.apache.camel.dataformat.ocsf.model.DetectionFinding + - to: + uri: direct:process +---- +==== + === Using with AWS Security Hub AWS Security Hub now outputs findings in OCSF format. You can use this data format to process those findings: @@ -96,36 +129,6 @@ from("aws-securityhub:findings") include::partial$dataformat-options.adoc[] // dataformat options: END -== Using OCSF in Spring DSL - -You can use the OCSF data format directly in Spring XML: - -[source,xml] ----- -<route> - <from uri="kafka:security-events"/> - <unmarshal> - <ocsf unmarshalType="org.apache.camel.dataformat.ocsf.model.DetectionFinding"/> - </unmarshal> - <to uri="direct:process"/> -</route> ----- - -Or define a reusable data format: - -[source,xml] ----- -<dataFormats> - <ocsf id="ocsfDetection" unmarshalType="org.apache.camel.dataformat.ocsf.model.DetectionFinding"/> -</dataFormats> - -<route> - <from uri="kafka:security-events"/> - <unmarshal ref="ocsfDetection"/> - <to uri="direct:process"/> -</route> ----- - == OCSF Event Categories OCSF defines the following event categories: diff --git a/components/camel-ognl/src/main/docs/ognl-language.adoc b/components/camel-ognl/src/main/docs/ognl-language.adoc index f1a287d819e5..db3e1a5ff014 100644 --- a/components/camel-ognl/src/main/docs/ognl-language.adoc +++ b/components/camel-ognl/src/main/docs/ognl-language.adoc @@ -71,6 +71,10 @@ include::partial$language-options.adoc[] For example, you could use OGNL inside a xref:eips:filter-eip.adoc[Message Filter] +[tabs] +==== +Java:: ++ [source,java] ---- from("seda:foo") @@ -78,8 +82,8 @@ from("seda:foo") .to("seda:bar"); ---- -And in XML: - +XML:: ++ [source,xml] ---- <route> @@ -91,6 +95,24 @@ And in XML: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: seda:foo + steps: + - filter: + expression: + ognl: + expression: request.headers.foo == 'bar' + steps: + - to: + uri: seda:bar +---- +==== + == Loading script from external resource diff --git a/components/camel-once/src/main/docs/once-component.adoc b/components/camel-once/src/main/docs/once-component.adoc index f594386f46fb..f383a552d77f 100644 --- a/components/camel-once/src/main/docs/once-component.adoc +++ b/components/camel-once/src/main/docs/once-component.adoc @@ -44,23 +44,44 @@ include::partial$component-endpoint-headers.adoc[] To set up a route that generates an event every 60 seconds: +[tabs] +==== +Java:: ++ [source,java] ---- from("once:foo?body=file:data.json").to("bean:myBean?method=someMethodName"); ---- -The above route will trigger once and load the `data.json` from file system and use as message body. -And then route to call the bean. - -And the route in XML DSL: - +XML:: ++ [source,xml] ------ +---- <route> <from uri="once:foo?body=file:data.json"/> <to uri="bean:myBean?method=someMethodName"/> </route> ------ +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: once:foo + parameters: + body: "file:data.json" + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + +The above route will trigger once and load the `data.json` from file system and use as message body. +And then route to call the bean. === Using headers and variables @@ -141,6 +162,17 @@ And for any other its `String` or the output from executing a language. By default, the component is fired after 1 seconds when Camel has been fully started. If you want to fire messages in a Camel route as soon as possible, you can use a negative delay: +[tabs] +==== +Java:: ++ +[source,java] +---- +from("once:foo?body=file.data.json&delay=-1").to("bean:myBean?method=someMethodName"); +---- + +XML:: ++ [source,xml] ---- <route> @@ -149,6 +181,24 @@ If you want to fire messages in a Camel route as soon as possible, you can use a </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: once:foo + parameters: + body: file.data.json + delay: -1 + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + In this way, the timer will fire messages immediately. diff --git a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc index 2b7a9120c389..9cca85783e5b 100644 --- a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc +++ b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc @@ -166,50 +166,74 @@ to use a class that does not implement com.google.protobuf.Message. Use the generated builders to translate the data from any of your existing domain classes. -== Java DSL +== Examples You can use create the ProtobufDataFormat instance and pass it to Camel DataFormat marshal and unmarshal API like this. [source,java] ------------------------------------------------------------------------------------ +---- ProtobufDataFormat format = new ProtobufDataFormat(Person.getDefaultInstance()); from("direct:in").marshal(format); from("direct:back").unmarshal(format).to("mock:reverse"); ------------------------------------------------------------------------------------ +---- Or use the DSL `protobuf()` passing the unmarshal default instance or default instance class name like this. However, if you have input data as `Map` type, you will need to **specify** the ProtobufDataFormat otherwise it will throw an error. [source,java] --------------------------------------------------------------------------------------------------- +---- // You don't need to specify the default instance for protobuf marshaling, but you will need in case your input data is a Map type from("direct:marshal").marshal().protobuf(); from("direct:unmarshalA").unmarshal() .protobuf("org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person") .to("mock:reverse"); - - from("direct:unmarshalB").unmarshal().protobuf(Person.getDefaultInstance()).to("mock:reverse"); --------------------------------------------------------------------------------------------------- -== Spring DSL + from("direct:unmarshalB").unmarshal().protobuf(Person.getDefaultInstance()).to("mock:reverse"); +---- -The following example shows how to use Protobuf to unmarshal using Spring -configuring the protobuf data type +The following example shows how to use Protobuf to unmarshal: +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:start") + .unmarshal().protobuf("org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person") + .to("mock:result"); +---- + +XML:: ++ [source,xml] ----------------------------------------------------------------------------------------------------------- -<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <unmarshal> - <protobuf instanceClass="org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person" /> - </unmarshal> - <to uri="mock:result"/> - </route> -</camelContext> ----------------------------------------------------------------------------------------------------------- +---- +<route> + <from uri="direct:start"/> + <unmarshal> + <protobuf instanceClass="org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person"/> + </unmarshal> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:start + steps: + - unmarshal: + protobuf: + instanceClass: org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person + - to: + uri: mock:result +---- +==== == Dependencies diff --git a/components/camel-saxon/src/main/docs/xquery-language.adoc b/components/camel-saxon/src/main/docs/xquery-language.adoc index 34909675d2e3..1cb5d4c03649 100644 --- a/components/camel-saxon/src/main/docs/xquery-language.adoc +++ b/components/camel-saxon/src/main/docs/xquery-language.adoc @@ -60,23 +60,43 @@ explicit type conversion, or you will get an `org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR`). You need to pass in the expected output type of the function. For example, the concat function returns a `String` which is done as shown: +[tabs] +==== +Java:: ++ [source,java] ------------------------------------------------------------------------------ +---- from("direct:start") .recipientList().xquery("concat('mock:foo.', /person/@city)", String.class); ------------------------------------------------------------------------------ - -And in XML DSL: +---- +XML:: ++ [source,xml] ------------------------------------------------------------------------------ +---- <route> <from uri="direct:start"/> <recipientList> - <xquery resultType="java.lang.String">concat('mock:foo.', /person/@city</xquery> + <xquery resultType="java.lang.String">concat('mock:foo.', /person/@city)</xquery> </recipientList> </route> ------------------------------------------------------------------------------ +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:start + steps: + - recipientList: + expression: + xquery: + expression: "concat('mock:foo.', /person/@city)" + resultType: java.lang.String +---- +==== === Using namespaces diff --git a/components/camel-scheduler/src/main/docs/scheduler-component.adoc b/components/camel-scheduler/src/main/docs/scheduler-component.adoc index 9542d73a8574..bf841e1b4d0a 100644 --- a/components/camel-scheduler/src/main/docs/scheduler-component.adoc +++ b/components/camel-scheduler/src/main/docs/scheduler-component.adoc @@ -94,17 +94,17 @@ exchange. To set up a route that generates an event every 60 seconds: +[tabs] +==== +Java:: ++ [source,java] ---- from("scheduler://foo?delay=60000").to("bean:myBean?method=someMethodName"); ---- -The above route will generate an event and then invoke the -`someMethodName` method on the bean called `myBean` in the -Registry such as JNDI or Spring. - -And the route in Spring DSL: - +XML:: ++ [source,xml] ---- <route> @@ -113,5 +113,26 @@ And the route in Spring DSL: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: scheduler:foo + parameters: + delay: 60000 + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + +The above route will generate an event and then invoke the +`someMethodName` method on the bean called `myBean` in the +Registry such as JNDI or Spring. + include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-solr/src/main/docs/solr-component.adoc b/components/camel-solr/src/main/docs/solr-component.adoc index 0abeaa15da6f..19d7e3f0e003 100644 --- a/components/camel-solr/src/main/docs/solr-component.adoc +++ b/components/camel-solr/src/main/docs/solr-component.adoc @@ -78,8 +78,12 @@ the following. Some operations also require the message body to be set. Below is a simple `INSERT`, `DELETE` and `SEARCH` example +[tabs] +==== +Java:: ++ [source,java] ---------------------------------------------------------------------------------------- +---- from("direct:insert") .setHeader(SolrConstants.PARAM_OPERATION, constant(SolrOperation.INSERT)) .setHeader(SolrConstants.FIELD + "id", body()) @@ -92,10 +96,12 @@ from("direct:delete") from("direct:search") .setHeader(SolrConstants.PARAM_OPERATION, constant(SolrOperation.SEARCH)) .to("solr://localhost:8983/solr"); ---------------------------------------------------------------------------------------- +---- +XML:: ++ [source,xml] ------------------------------------------- +---- <route> <from uri="direct:insert"/> <setHeader name="CamelSolrOperation"> @@ -120,7 +126,52 @@ from("direct:search") </setHeader> <to uri="solr://localhost:8983/solr"/> </route> ------------------------------------------- +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:insert + steps: + - setHeader: + name: CamelSolrOperation + expression: + constant: + expression: INSERT + - setHeader: + name: CamelSolrField.id + expression: + simple: + expression: "${body}" + - to: + uri: solr://localhost:8983/solr +- route: + from: + uri: direct:delete + steps: + - setHeader: + name: CamelSolrOperation + expression: + constant: + expression: DELETE + - to: + uri: solr://localhost:8983/solr +- route: + from: + uri: direct:search + steps: + - setHeader: + name: CamelSolrOperation + expression: + constant: + expression: SEARCH + - to: + uri: solr://localhost:8983/solr +---- +==== A client would simply need to pass a body message to the insert or delete routes and then call the commit route. diff --git a/components/camel-spring-parent/camel-spring/src/main/docs/spel-language.adoc b/components/camel-spring-parent/camel-spring/src/main/docs/spel-language.adoc index ccad88b21038..f77eeea84703 100644 --- a/components/camel-spring-parent/camel-spring/src/main/docs/spel-language.adoc +++ b/components/camel-spring-parent/camel-spring/src/main/docs/spel-language.adoc @@ -55,6 +55,19 @@ You can use SpEL as an expression for xref:eips:recipientList-eip.adoc[Recipient List] or as a predicate inside a xref:eips:filter-eip.adoc[Message Filter]: +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:foo") + .filter().spel("#{request.headers.foo == 'bar'}") + .to("direct:bar"); +---- + +XML:: ++ [source,xml] ---- <route> @@ -66,14 +79,23 @@ Filter]: </route> ---- -And the equivalent in Java DSL: - -[source,java] +YAML:: ++ +[source,yaml] ---- -from("direct:foo") - .filter().spel("#{request.headers.foo == 'bar'}") - .to("direct:bar"); +- route: + from: + uri: direct:foo + steps: + - filter: + expression: + spel: + expression: "#{request.headers.foo == 'bar'}" + steps: + - to: + uri: direct:bar ---- +==== === Expression templating diff --git a/components/camel-ssh/src/main/docs/ssh-component.adoc b/components/camel-ssh/src/main/docs/ssh-component.adoc index c527cf3fb33e..1be2e2d1265c 100644 --- a/components/camel-ssh/src/main/docs/ssh-component.adoc +++ b/components/camel-ssh/src/main/docs/ssh-component.adoc @@ -53,11 +53,25 @@ When the SSH Component is used as a Producer (`.to("ssh://...")`), it will send the message body as the command to execute on the remote SSH server. -Here is an example of this within the XML DSL. Note that the command has -an XML encoded newline (`+ +`). +Here is an example of this. Note that the command has +a newline (`+ +`). +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:exampleSshProducer") + .setBody(constant("features:list\n")) + .to("ssh://user:pass@localhost:8101") + .log("${body}"); +---- + +XML:: ++ [source,xml] ----------------------------------------------- +---- <route id="camel-example-ssh-producer"> <from uri="direct:exampleSshProducer"/> <setBody> @@ -66,7 +80,27 @@ an XML encoded newline (`+ +`). <to uri="ssh://user:pass@localhost:8101"/> <log message="${body}"/> </route> ----------------------------------------------- +---- + +YAML:: ++ +[source,yaml] +---- +- route: + id: camel-example-ssh-producer + from: + uri: direct:exampleSshProducer + steps: + - setBody: + expression: + constant: + expression: "features:list\n" + - to: + uri: ssh://user:pass@localhost:8101 + - log: + message: "${body}" +---- +==== === Authentication @@ -91,23 +125,43 @@ configuration is surpassed and credentials set in the headers are used. The following route fragment shows an SSH polling consumer using a certificate from the classpath. -In the XML DSL, +[tabs] +==== +Java:: ++ +[source,java] +---- +from("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A") + .log("${body}"); +---- +XML:: ++ [source,xml] -------------------------------------------------------------------------------------------------------------------------------------------------- +---- <route> <from uri="ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A"/> <log message="${body}"/> </route> -------------------------------------------------------------------------------------------------------------------------------------------------- - -In the Java DSL, - -[source,java] ------------------------------------------------------------------------------------------------------------------------------ -from("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A") - .log("${body}"); ------------------------------------------------------------------------------------------------------------------------------ +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: ssh://scott@localhost:8101 + parameters: + certResource: "classpath:test_rsa" + useFixedDelay: true + delay: 5000 + pollCommand: "features:list%0A" + steps: + - log: + message: "${body}" +---- +==== An example of using Public Key authentication is provided in `examples/camel-example-ssh-security`. diff --git a/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc b/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc index 57fdf0ad9614..4388cbde44d4 100644 --- a/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc +++ b/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc @@ -61,6 +61,10 @@ inline as shown below: In this example, we marshal the messages read from a JMS queue in SWIFT format before storing the result into a file. +[tabs] +==== +Java:: ++ [source,java] ---- from("jms://myqueue") @@ -68,16 +72,33 @@ from("jms://myqueue") .to("file://data.bin"); ---- -In Spring DSL: - +XML:: ++ [source,xml] ---- - <from uri="jms://myqueue"> - <marshal> - <swiftMt/> - </marshal> - <to uri="file://data.bin"/> +<route> + <from uri="jms://myqueue"/> + <marshal> + <swiftMt/> + </marshal> + <to uri="file://data.bin"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: jms://myqueue + steps: + - marshal: + swiftMt: {} + - to: + uri: file://data.bin ---- +==== == Unmarshal @@ -86,7 +107,10 @@ The unmarshaller converts the input data into the concrete class of type `com.pr In this example, we unmarshal the content of a file to get SWIFT MT objects before processing them with the `newOrder` processor. -.SwiftMt example in Java +[tabs] +==== +Java:: ++ [source,java] ---- from("file://data.bin") @@ -94,15 +118,33 @@ from("file://data.bin") .process("newOrder"); ---- -.SwiftMt example in In Spring DSL +XML:: ++ [source,xml] ---- - <from uri="file://data.bin"> - <unmarshal> - <swiftMt/> - </unmarshal> - <to uri="bean:newOrder"/> +<route> + <from uri="file://data.bin"/> + <unmarshal> + <swiftMt/> + </unmarshal> + <to uri="bean:newOrder"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: file://data.bin + steps: + - unmarshal: + swiftMt: {} + - to: + uri: bean:newOrder ---- +==== == Dependencies diff --git a/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc b/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc index 319ceb45b37b..15813ea37c3d 100644 --- a/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc +++ b/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc @@ -61,6 +61,10 @@ inline as shown below: In this example, we marshal the messages read from a JMS queue in SWIFT format before storing the result into a file. +[tabs] +==== +Java:: ++ [source,java] ---- from("jms://myqueue") @@ -68,16 +72,33 @@ from("jms://myqueue") .to("file://data.bin"); ---- -In Spring DSL: - +XML:: ++ [source,xml] ---- - <from uri="jms://myqueue"> - <marshal> - <swiftMx/> - </marshal> - <to uri="file://data.bin"/> +<route> + <from uri="jms://myqueue"/> + <marshal> + <swiftMx/> + </marshal> + <to uri="file://data.bin"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: jms://myqueue + steps: + - marshal: + swiftMx: {} + - to: + uri: file://data.bin ---- +==== == Unmarshal @@ -86,6 +107,10 @@ The unmarshaller converts the input data into the concrete class of type `com.pr In this example, we unmarshal the content of a file to get SWIFT MX objects before processing them with the `newOrder` processor. +[tabs] +==== +Java:: ++ [source,java] ---- from("file://data.bin") @@ -93,16 +118,33 @@ from("file://data.bin") .process("newOrder"); ---- -In Spring DSL: - +XML:: ++ [source,xml] ---- - <from uri="file://data.bin"> - <unmarshal> - <swiftMx/> - </unmarshal> - <to uri="bean:newOrder"/> +<route> + <from uri="file://data.bin"/> + <unmarshal> + <swiftMx/> + </unmarshal> + <to uri="bean:newOrder"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: file://data.bin + steps: + - unmarshal: + swiftMx: {} + - to: + uri: bean:newOrder ---- +==== == Dependencies diff --git a/components/camel-telegram/src/main/docs/telegram-component.adoc b/components/camel-telegram/src/main/docs/telegram-component.adoc index 429c296e1ef7..7b3bafefaf26 100644 --- a/components/camel-telegram/src/main/docs/telegram-component.adoc +++ b/components/camel-telegram/src/main/docs/telegram-component.adoc @@ -70,20 +70,40 @@ It can also be used in *reactive chatbot mode* (to consume, then produce message The following is a basic example of how to send a message to a Telegram chat through the Telegram Bot API. -.Telegram producer example in Java DSL +[tabs] +==== +Java:: ++ [source,java] ---------------------------------------------------------- -from("direct:start").to("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"); ---------------------------------------------------------- +---- +from("direct:start") + .to("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"); +---- -.Telegram producer example in Spring XML +XML:: ++ [source,xml] ---------------------------------------------- +---- <route> - <from uri="direct:start"/> - <to uri="telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"/> -<route> ---------------------------------------------- + <from uri="direct:start"/> + <to uri="telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:start + steps: + - to: + uri: telegram:bots + parameters: + authorizationToken: "123456789:insertYourAuthorizationTokenHere" +---- +==== The code `123456789:insertYourAuthorizationTokenHere` is the *authorization token* corresponding to the Bot. @@ -128,25 +148,41 @@ The following message bodies are allowed for a producer endpoint (messages of ty === Consumer The following is a basic example of how to receive all messages that telegram users are sending to the configured Bot. -In Java DSL -.Telegram consumer example in Java DSL +[tabs] +==== +Java:: ++ [source,java] ---------------------------------------------------------- +---- from("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere") -.bean(ProcessorBean.class) ---------------------------------------------------------- + .bean(ProcessorBean.class); +---- -.Telegram producer example in Spring XML +XML:: ++ [source,xml] ---------------------------------------------- +---- <route> - <from uri="telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"/> - <bean ref="myBean" /> -<route> - -<bean id="myBean" class="com.example.MyBean"/> ---------------------------------------------- + <from uri="telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"/> + <bean ref="myBean"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: telegram:bots + parameters: + authorizationToken: "123456789:insertYourAuthorizationTokenHere" + steps: + - bean: + ref: myBean +---- +==== The `MyBean` is a simple bean that will receive the messages diff --git a/components/camel-thrift/src/main/docs/thrift-component.adoc b/components/camel-thrift/src/main/docs/thrift-component.adoc index 853cee90a43b..5e0ba2fb1bd4 100644 --- a/components/camel-thrift/src/main/docs/thrift-component.adoc +++ b/components/camel-thrift/src/main/docs/thrift-component.adoc @@ -76,29 +76,76 @@ Incoming parameters in the service consumer will also be passed to the message b Below is a simple synchronous method invoke with host and port parameters +[tabs] +==== +Java:: ++ [source,java] -------------------------------------------------------------------------------- +---- from("direct:thrift-calculate") -.to("thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator?method=calculate&synchronous=true"); -------------------------------------------------------------------------------- - -Below is a simple synchronous method invoke for the XML DSL configuration + .to("thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator?method=calculate&synchronous=true"); +---- +XML:: ++ [source,xml] ---------------------------------------------------------------------------------------- +---- <route> - <from uri="direct:thrift-add" /> - <to uri="thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator?method=add&synchronous=true"/> + <from uri="direct:thrift-calculate"/> + <to uri="thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator?method=calculate&synchronous=true"/> </route> ---------------------------------------------------------------------------------------- +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:thrift-calculate + steps: + - to: + uri: thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator + parameters: + method: calculate + synchronous: true +---- +==== Thrift service consumer with asynchronous communication +[tabs] +==== +Java:: ++ [source,java] -------------------------------------------------------------------------------- +---- from("thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator") -.to("direct:thrift-service"); -------------------------------------------------------------------------------- + .to("direct:thrift-service"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator"/> + <to uri="direct:thrift-service"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: thrift://localhost:1101/org.apache.camel.component.thrift.generated.Calculator + steps: + - to: + uri: direct:thrift-service +---- +==== It's possible to automate Java code generation for .thrift files using *thrift-maven-plugin*, but before start the thrift compiler binary distribution for your operating system must be present on the running host. diff --git a/components/camel-thrift/src/main/docs/thrift-dataformat.adoc b/components/camel-thrift/src/main/docs/thrift-dataformat.adoc index e8b82c8ab851..37022d9f657e 100644 --- a/components/camel-thrift/src/main/docs/thrift-dataformat.adoc +++ b/components/camel-thrift/src/main/docs/thrift-dataformat.adoc @@ -93,7 +93,7 @@ Camel will throw an exception on route creation if you attempt to tell the Data Format to use a class that does not implement org.apache.thrift.TBase. -== Java DSL +== Examples You can use create the ThriftDataFormat instance and pass it to Camel DataFormat marshal and unmarshal API like this. @@ -111,32 +111,56 @@ default instance class name like this. [source,java] ---- - // You don't need to specify the default instance for the thrift marshaling + // You don't need to specify the default instance for the thrift marshaling from("direct:marshal").marshal().thrift(); from("direct:unmarshalA").unmarshal() .thrift("org.apache.camel.dataformat.thrift.generated.Work") .to("mock:reverse"); - + from("direct:unmarshalB").unmarshal().thrift(new Work()).to("mock:reverse"); ---- -== Spring DSL +The following example shows how to use Thrift to unmarshal: -The following example shows how to use Thrift to unmarshal using Spring -configuring the thrift data type +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:start") + .unmarshal().thrift("org.apache.camel.dataformat.thrift.generated.Work") + .to("mock:result"); +---- +XML:: ++ [source,xml] ---- -<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <unmarshal> - <thrift instanceClass="org.apache.camel.dataformat.thrift.generated.Work" /> - </unmarshal> - <to uri="mock:result"/> - </route> -</camelContext> +<route> + <from uri="direct:start"/> + <unmarshal> + <thrift instanceClass="org.apache.camel.dataformat.thrift.generated.Work"/> + </unmarshal> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:start + steps: + - unmarshal: + thrift: + instanceClass: org.apache.camel.dataformat.thrift.generated.Work + - to: + uri: mock:result ---- +==== == Dependencies diff --git a/components/camel-timer/src/main/docs/timer-component.adoc b/components/camel-timer/src/main/docs/timer-component.adoc index d4ce0f3eaf7a..0dc15e39b48e 100644 --- a/components/camel-timer/src/main/docs/timer-component.adoc +++ b/components/camel-timer/src/main/docs/timer-component.adoc @@ -72,30 +72,63 @@ to the `Exchange`: To set up a route that generates an event every 60 seconds: +[tabs] +==== +Java:: ++ [source,java] ---- from("timer://foo?fixedRate=true&period=60000").to("bean:myBean?method=someMethodName"); ---- -The above route will generate an event and then invoke the -`someMethodName` method on the bean called `myBean` in the -Registry. - -And the route in Spring DSL: - +XML:: ++ [source,xml] ------ +---- <route> <from uri="timer://foo?fixedRate=true&period=60000"/> <to uri="bean:myBean?method=someMethodName"/> </route> ------ +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: timer:foo + parameters: + fixedRate: true + period: 60000 + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + +The above route will generate an event and then invoke the +`someMethodName` method on the bean called `myBean` in the +Registry. === Firing as soon as possible You may want to fire messages in a Camel route as soon as possible, you can use a negative delay: +[tabs] +==== +Java:: ++ +[source,java] +---- +from("timer://foo?delay=-1").to("bean:myBean?method=someMethodName"); +---- + +XML:: ++ [source,xml] ---- <route> @@ -104,6 +137,23 @@ can use a negative delay: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: timer:foo + parameters: + delay: -1 + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + In this way, the timer will fire messages immediately. You can also specify a `repeatCount` parameter in conjunction with a @@ -119,6 +169,17 @@ You may want to fire a message in a Camel route only once, such as when starting the route. To do that, you use the `repeatCount` option as shown: +[tabs] +==== +Java:: ++ +[source,java] +---- +from("timer://foo?repeatCount=1").to("bean:myBean?method=someMethodName"); +---- + +XML:: ++ [source,xml] ---- <route> @@ -127,6 +188,23 @@ To do that, you use the `repeatCount` option as shown: </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: timer:foo + parameters: + repeatCount: 1 + steps: + - to: + uri: bean:myBean + parameters: + method: someMethodName +---- +==== + include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-xmlsecurity/src/main/docs/xmlsecurity-verify-component.adoc b/components/camel-xmlsecurity/src/main/docs/xmlsecurity-verify-component.adoc index 08740fa239b9..0887366d755a 100644 --- a/components/camel-xmlsecurity/src/main/docs/xmlsecurity-verify-component.adoc +++ b/components/camel-xmlsecurity/src/main/docs/xmlsecurity-verify-component.adoc @@ -191,22 +191,50 @@ Elements): The following example shows the basic usage of the component. +[tabs] +==== +Java:: ++ [source,java] ---- -from("direct:enveloping").to("xmlsecurity-sign://enveloping?keyAccessor=#accessor", - "xmlsecurity-verify://enveloping?keySelector=#selector", - "mock:result") +from("direct:enveloping") + .to("xmlsecurity-sign://enveloping?keyAccessor=#accessor") + .to("xmlsecurity-verify://enveloping?keySelector=#selector") + .to("mock:result"); ---- -In Spring XML: - +XML:: ++ [source,xml] ---- -<from uri="direct:enveloping" /> - <to uri="xmlsecurity-sign://enveloping?keyAccessor=#accessor" /> - <to uri="xmlsecurity-verify://enveloping?keySelector=#selector" /> -<to uri="mock:result" /> +<route> + <from uri="direct:enveloping"/> + <to uri="xmlsecurity-sign://enveloping?keyAccessor=#accessor"/> + <to uri="xmlsecurity-verify://enveloping?keySelector=#selector"/> + <to uri="mock:result"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:enveloping + steps: + - to: + uri: xmlsecurity-sign://enveloping + parameters: + keyAccessor: "#accessor" + - to: + uri: xmlsecurity-verify://enveloping + parameters: + keySelector: "#selector" + - to: + uri: mock:result ---- +==== For the signing process, a private key is necessary. You specify a key accessor bean which provides this private key. For the validation, the
