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
The following commit(s) were added to refs/heads/main by this push:
new 30cdc05 FunctionGraph Update Comments (#5677)
30cdc05 is described below
commit 30cdc05480556c87fc5b294dc71416a2755333dd
Author: Hokutor <[email protected]>
AuthorDate: Wed Jun 16 11:42:25 2021 -0400
FunctionGraph Update Comments (#5677)
* Update FunctionGraph Code comments
* Update code comments
* Update code comments
* Fixed formatting error
---
.../src/main/java/org/apache/camel/FunctionGraphEndpoint.java | 7 ++++++-
.../src/main/java/org/apache/camel/FunctionGraphProducer.java | 11 ++++++++++-
.../src/main/java/org/apache/camel/FunctionGraphUtils.java | 10 +++++++++-
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphEndpoint.java
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphEndpoint.java
index 43d06eb..442b4f2 100644
---
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphEndpoint.java
+++
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphEndpoint.java
@@ -240,13 +240,16 @@ public class FunctionGraphEndpoint extends
DefaultEndpoint {
}
/**
- * Initialize the client
+ * Initialize and return a new FunctionGraph Client
+ *
+ * @return
*/
public FunctionGraphClient initClient() {
if (functionGraphClient != null) {
return functionGraphClient;
}
+ // setup AK/SK credential information. User can input AK/SK through
the ServiceKeys class, which, if provided, overrides the AK/SK passed through
the endpoint
BasicCredentials auth = new BasicCredentials()
.withAk(getServiceKeys() != null
? getServiceKeys().getAuthenticationKey()
@@ -256,6 +259,7 @@ public class FunctionGraphEndpoint extends DefaultEndpoint {
: getSecretKey())
.withProjectId(getProjectId());
+ // setup http information (including proxy information if provided)
HttpConfig httpConfig = HttpConfig.getDefaultHttpConfig();
httpConfig.withIgnoreSSLVerification(isIgnoreSslVerification());
if (ObjectHelper.isNotEmpty(getProxyHost())
@@ -271,6 +275,7 @@ public class FunctionGraphEndpoint extends DefaultEndpoint {
}
}
+ // if an endpoint url is provided, the FunctionGraphClient will be
built with an endpoint. Otherwise, it will be built with the provided region
if (ObjectHelper.isNotEmpty(getEndpoint())) {
return FunctionGraphClient.newBuilder()
.withCredential(auth)
diff --git
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphProducer.java
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphProducer.java
index da04682..2a26a81 100644
---
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphProducer.java
+++
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphProducer.java
@@ -64,6 +64,11 @@ public class FunctionGraphProducer extends DefaultProducer {
}
}
+ /**
+ * Perform invoke function operation and map return object to exchange body
+ *
+ * @param exchange
+ */
private void invokeFunction(Exchange exchange) {
// convert exchange body to Map object
@@ -109,7 +114,11 @@ public class FunctionGraphProducer extends DefaultProducer
{
}
/**
- * Update dynamic client configurations
+ * Update dynamic client configurations. Some endpoint parameters
(operation, function name, package, and
+ * XCFFLogType) can also be passed via exchange properties, so they can be
updated between each transaction. Since
+ * they can change, we must clear the previous transaction and update
these parameters with their new values
+ *
+ * @param exchange
*/
private void updateClientConfigs(Exchange exchange) {
resetDynamicConfigs();
diff --git
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphUtils.java
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphUtils.java
index 7e7d907..1bad9f9 100644
---
a/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphUtils.java
+++
b/components/camel-huawei/camel-huaweicloud-functiongraph/src/main/java/org/apache/camel/FunctionGraphUtils.java
@@ -27,6 +27,10 @@ public final class FunctionGraphUtils {
/**
* Gets the fieldName from the jsonString and returns it as a String
+ *
+ * @param jsonString
+ * @param fieldName
+ * @return
*/
public static String extractJsonFieldAsString(String jsonString, String
fieldName) {
Gson gson = new Gson();
@@ -34,7 +38,11 @@ public final class FunctionGraphUtils {
}
/**
- * returns the urn based on urnFormat and clientConfigurations
+ * Returns the urn based on urnFormat and clientConfigurations
+ *
+ * @param urnFormat
+ * @param clientConfigurations
+ * @return
*/
public static String composeUrn(String urnFormat, ClientConfigurations
clientConfigurations) {
return String.format(urnFormat, clientConfigurations.getRegion(),