You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/02/01 22:02:41 UTC
[camel] 01/03: ServiceKeys registry lookup and XML dsl - Related to
CAMEL-16001
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 5440b1428e0ff8fb8f2999b312a184c4f102b923
Author: mathewsreji <co...@gmail.com>
AuthorDate: Mon Feb 1 14:39:35 2021 -0500
ServiceKeys registry lookup and XML dsl - Related to CAMEL-16001
---
.../src/main/docs/hwcloud-smn-component.adoc | 57 ++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/components/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc b/components/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc
index 06bdc37..2051d32 100644
--- a/components/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc
+++ b/components/camel-huaweicloud-smn/src/main/docs/hwcloud-smn-component.adoc
@@ -136,7 +136,42 @@ with the following path and query parameters:
- publishAsTextMessage
- publishAsTemplatedMessage
+== Inline Configuration of Route
+==== publishAsTextMessage
+Java DSL
+[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&authKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4")
+--------------------------------------------------------------------------------
+
+
+
+XML DSL
+[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&authKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc&region=cn-north-4"/>
+ </route>
+--------------------------------------------------------------------------------
+
+
+==== publishAsTemplatedMessage
+Java DSL
[source,java]
--------------------------------------------------------------------------------
from("direct:triggerRoute")
@@ -147,3 +182,25 @@ from("direct:triggerRoute")
.setProperty("CamelHwCloudSmnTemplateName", constant("hello-template"))
.to("hwcloud-smn:publishMessageService?operation=publishAsTextMessage&authKey=*********&secretKey=********&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4")
--------------------------------------------------------------------------------
+
+== Using ServiceKey configuration Bean
+Authentication key and secret keys are required to authenticate against cloud smn service. You can avoid having them being exposed
+and scattered over in your endpoint uri by wrapping them inside a bean of class ```org.apache.camel.component.huaweicloud.smn.models.ServiceKeys```.
+Add it to the registry and let camel look it up by referring the object via endpoint query parameter ```serviceKeys```.
+Check the following code snippets
+
+[source,xml]
+----
+ <bean id="myServiceKeyConfig" class="org.apache.camel.component.huaweicloud.smn.models.ServiceKeys">
+ <property name="authenticationKey" value="your_auth_key"/>
+ <property name="secretKey" value="your_secret_key"/>
+ </bean>
+----
+[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&projectId=9071a38e7f6a4ba7b7bcbeb7d4ea6efc®ion=cn-north-4&serviceKeys=#myServiceKeyConfig")
+--------------------------------------------------------------------------------