summaryrefslogtreecommitdiffstats
path: root/common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java')
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java13
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java23
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java41
-rw-r--r--common/src/main/java/org/onap/so/utils/RetrySequenceLevel.java6
4 files changed, 62 insertions, 21 deletions
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index a72229a25c..9fceed1641 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -57,9 +57,6 @@ public class RequestParameters implements Serializable {
@JsonProperty("rebuildVolumeGroups")
private Boolean rebuildVolumeGroups;
- @JsonProperty("enforceValidNfValues")
- private Boolean enforceValidNfValues = false;
-
@Override
public String toString() {
return new ToStringBuilder(this).append("subscriptionServiceType", subscriptionServiceType)
@@ -67,15 +64,7 @@ public class RequestParameters implements Serializable {
.append("usePreload", usePreload).append("autoBuildVfModules", autoBuildVfModules)
.append("cascadeDelete", cascadeDelete).append("testApi", testApi)
.append("retainAssignments", retainAssignments).append("rebuildVolumeGroups", rebuildVolumeGroups)
- .append("enforceValidNfValues", enforceValidNfValues).toString();
- }
-
- public Boolean getEnforceValidNfValues() {
- return enforceValidNfValues;
- }
-
- public void setEnforceValidNfValues(Boolean enforceValidNfValues) {
- this.enforceValidNfValues = enforceValidNfValues;
+ .toString();
}
public String getSubscriptionServiceType() {
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index e43b431821..4f13cec8f4 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -1,6 +1,8 @@
package org.onap.so.utils;
import java.security.GeneralSecurityException;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import org.camunda.bpm.client.ExternalTaskClient;
import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
@@ -8,21 +10,30 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
+
@Component
public class ExternalTaskServiceUtils {
@Autowired
public Environment env;
+ protected Set<ExternalTaskClient> taskClients = ConcurrentHashMap.newKeySet();
+
+
private static final Logger logger = LoggerFactory.getLogger(ExternalTaskServiceUtils.class);
public ExternalTaskClient createExternalTaskClient() throws Exception {
String auth = getAuth();
ClientRequestInterceptor interceptor = createClientInterceptor(auth);
- return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
- .addInterceptor(interceptor).asyncResponseTimeout(120000).build();
+ ExternalTaskClient client =
+ ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000).build();
+ taskClients.add(client);
+ return client;
}
protected ClientRequestInterceptor createClientInterceptor(String auth) {
@@ -42,5 +53,13 @@ public class ExternalTaskServiceUtils {
return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
}
+ @Scheduled(fixedDelay = 30000)
+ public void checkAllClientsActive() {
+ getClients().stream().filter(client -> !client.isActive()).forEach(ExternalTaskClient::start);
+ }
+
+ protected Set<ExternalTaskClient> getClients() {
+ return taskClients;
+ }
}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
index a2aed638fe..9488187003 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -1,10 +1,7 @@
package org.onap.so.utils;
-import org.camunda.bpm.client.task.ExternalTask;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -17,6 +14,16 @@ public abstract class ExternalTaskUtils {
private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+ private final RetrySequenceLevel retrySequenceLevel;
+
+ public ExternalTaskUtils() {
+ this.retrySequenceLevel = RetrySequenceLevel.MEDIUM;
+ }
+
+ public ExternalTaskUtils(RetrySequenceLevel retrySequenceLevel) {
+ this.retrySequenceLevel = retrySequenceLevel;
+ }
+
public long calculateRetryDelay(int currentRetries) {
int retrySequence = getRetrySequence().length - currentRetries;
return Integer.parseInt(getRetrySequence()[retrySequence]) * getRetryMutiplier();
@@ -27,10 +34,30 @@ public abstract class ExternalTaskUtils {
}
protected String[] getRetrySequence() {
- String[] seq = {"1", "1", "2", "3", "5", "8", "13", "20"};
- if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
- seq = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
+ switch (retrySequenceLevel) {
+ case SHORT:
+ String[] seqShort = {"1", "1"};
+ if (env.getProperty("mso.workflow.topics.retrySequence.short") != null) {
+ seqShort = env.getProperty("mso.workflow.topics.retrySequence.short", String[].class);
+ }
+ return seqShort;
+ case MEDIUM:
+ String[] seqInter = {"1", "1", "2", "3", "5"};
+ if (env.getProperty("mso.workflow.topics.retrySequence.medium") != null) {
+ seqInter = env.getProperty("mso.workflow.topics.retrySequence.medium", String[].class);
+ }
+ return seqInter;
+ case LONG:
+ String[] seqLong = {"1", "1", "2", "3", "5", "8", "13", "20"};
+ if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ seqLong = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
+ }
+ return seqLong;
+ default:
+ String[] seq = {"1"};
+ return seq;
}
- return seq;
+
}
+
}
diff --git a/common/src/main/java/org/onap/so/utils/RetrySequenceLevel.java b/common/src/main/java/org/onap/so/utils/RetrySequenceLevel.java
new file mode 100644
index 0000000000..02964693d2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/RetrySequenceLevel.java
@@ -0,0 +1,6 @@
+package org.onap.so.utils;
+
+public enum RetrySequenceLevel {
+ SHORT, MEDIUM, LONG
+
+}