audit poller is polling too fast 80/79480/1
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Fri, 1 Mar 2019 19:55:31 +0000 (14:55 -0500)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Fri, 1 Mar 2019 19:56:16 +0000 (14:56 -0500)
Fix version incompatibility in external task client
Fix the openstack external task to poll slower

Change-Id: I376366f4848afd1eb356f43b556b7de20961ba88
Issue-ID: SO-1587
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
adapters/mso-openstack-adapters/pom.xml
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java

index f2ee073..f2f411d 100644 (file)
@@ -13,8 +13,8 @@
 
        <build>
                <finalName>${project.artifactId}-${project.version}</finalName>
-               
-               <plugins>                       
+
+               <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                </executions>
                        </plugin>
 
-<!--  run the following plugin only when there's a wsdl change and you need to recompile the java classes
+                       <!-- run the following plugin only when there's a wsdl change and you 
+                               need to recompile the java classes <plugin> <groupId>org.codehaus.mojo</groupId> 
+                               <artifactId>jaxws-maven-plugin</artifactId> <version>2.4.1</version> <executions> 
+                               <execution> <id>generate-network-async-stubs</id> <phase>process-classes</phase> 
+                               <goals> <goal>wsimport</goal> </goals> <configuration> <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> 
+                               </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> <wsdlFiles> 
+                               <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation> 
+                               <packageName>org.onap.so.adapters.network.async.client</packageName> <xnocompile>false</xnocompile> 
+                               <keep>true</keep> </configuration> </execution> <execution> <id>generate-vnf-async-stubs</id> 
+                               <phase>process-classes</phase> <goals> <goal>wsimport</goal> </goals> <configuration> 
+                               <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> 
+                               <wsdlFiles> <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation> 
+                               <packageName>org.onap.so.adapters.vnf.async.client</packageName> <xnocompile>false</xnocompile> 
+                               <keep>true</keep> </configuration> </execution> </executions> </plugin> <plugin> 
+                               <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> 
+                               <version>3.0.0</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> 
+                               <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated-sources/wsimport/</source> 
+                               </sources> </configuration> </execution> </executions> </plugin> -->
                        <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>jaxws-maven-plugin</artifactId>
-                               <version>2.4.1</version>
-                               <executions>
-                                       <execution>
-                                               <id>generate-network-async-stubs</id>
-                                               <phase>process-classes</phase>
-                                               <goals>
-                                                       <goal>wsimport</goal>
-                                               </goals>
-                                               <configuration>
-                            <vmArgs>
-                                <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
-                            </vmArgs>
-                                                       <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
-                                                       <wsdlFiles>
-                                                               <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile>
-                                                       </wsdlFiles>
-                                                       <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation>
-                                                       <packageName>org.onap.so.adapters.network.async.client</packageName>
-                                                       <xnocompile>false</xnocompile>
-                                                       <keep>true</keep>
-                                               </configuration>
-                                       </execution>
-                                       
-                                       <execution>
-                                               <id>generate-vnf-async-stubs</id>
-                                               <phase>process-classes</phase>
-                                               <goals>
-                                                       <goal>wsimport</goal>
-                                               </goals>
-                                               <configuration>
-                                               <vmArgs>
-                                                   <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
-                                               </vmArgs>
-                                                       <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
-                                                       <wsdlFiles>
-                                                               <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile>
-                                                       </wsdlFiles>
-                                                       <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation>
-                                                       <packageName>org.onap.so.adapters.vnf.async.client</packageName>
-                                                       <xnocompile>false</xnocompile>
-                                                       <keep>true</keep>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
-                       <plugin>
-                           <groupId>org.codehaus.mojo</groupId>
-                           <artifactId>build-helper-maven-plugin</artifactId>
-                           <version>3.0.0</version>
-                           <executions>
-                               <execution>
-                                   <id>add-source</id>
-                                   <phase>generate-sources</phase>
-                                   <goals>
-                                       <goal>add-source</goal>
-                                   </goals>
-                                   <configuration>
-                                       <sources>
-                                           <source>${project.build.directory}/generated-sources/wsimport/</source>
-                                       </sources>
-                                   </configuration>
-                               </execution>
-                           </executions>
-                        </plugin>                      
- -->           <plugin>
                                <groupId>org.jacoco</groupId>
                                <artifactId>jacoco-maven-plugin</artifactId>
                        </plugin>
                                        </execution>
                                </executions>
                        </plugin>
-               </plugins>              
-               
-               
+               </plugins>
+
+
                <pluginManagement>
                        <plugins>
-                               <!--This plugin's configuration is used to store Eclipse m2e settings
+                               <!--This plugin's configuration is used to store Eclipse m2e settings 
                                        only. It has no influence on the Maven build itself. -->
                                <plugin>
                                        <groupId>org.eclipse.m2e</groupId>
        </build>
 
        <dependencies>
-       <!-- added for spring boot support -->  
+               <!-- added for spring boot support -->
                <dependency>
-               <groupId>org.springframework.boot</groupId>
-               <artifactId>spring-boot-starter-actuator</artifactId>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-actuator</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
-                       <version>${cxf.version}</version>
+                       <version>${cxf.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <version>${cxf.version}</version>
                </dependency>
                <dependency>
-               <groupId>org.apache.cxf</groupId>
-               <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
-               <version>${cxf.version}</version>
+                       <groupId>org.apache.cxf</groupId>
+                       <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+                       <version>${cxf.version}</version>
                </dependency>
                <dependency>
-            <groupId>org.webjars</groupId>
-            <artifactId>swagger-ui</artifactId>
-            <version>3.5.0</version>
-        </dependency>
+                       <groupId>org.webjars</groupId>
+                       <artifactId>swagger-ui</artifactId>
+                       <version>3.5.0</version>
+               </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-test</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
-               <groupId>janino</groupId>
-               <artifactId>janino</artifactId>
-               <version>2.5.15</version>
+                       <groupId>janino</groupId>
+                       <artifactId>janino</artifactId>
+                       <version>2.5.15</version>
                </dependency>
-        
-       <!-- end added for spring boot support -->      
-       
-       
-       
-       <!-- added for unit testing -->         
+
+               <!-- end added for spring boot support -->
+
+
+
+               <!-- added for unit testing -->
                <dependency>
                        <groupId>org.onap.so.adapters</groupId>
                        <artifactId>mso-adapter-utils</artifactId>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                        <scope>test</scope>
-               </dependency>           
+               </dependency>
                <dependency>
                        <groupId>org.mariadb.jdbc</groupId>
                        <artifactId>mariadb-java-client</artifactId>
-               </dependency>           
+               </dependency>
                <dependency>
                        <groupId>org.onap.so</groupId>
                        <artifactId>common</artifactId>
                        <version>${project.version}</version>
                </dependency>
                <dependency>
-            <groupId>ch.vorburger.mariaDB4j</groupId>
-            <artifactId>mariaDB4j</artifactId>
-            <version>2.2.3</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
+                       <groupId>ch.vorburger.mariaDB4j</groupId>
+                       <artifactId>mariaDB4j</artifactId>
+                       <version>2.2.3</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
                        <groupId>org.springframework.cloud</groupId>
                        <artifactId>spring-cloud-contract-wiremock</artifactId>
                        <version>1.2.4.RELEASE</version>
                </dependency>
                <dependency>
                        <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
-            <artifactId>nova-model</artifactId>
+                       <artifactId>nova-model</artifactId>
                        <version>${openstack.version}</version>
                </dependency>
                <dependency>
-                       <groupId>org.camunda.bpm</groupId>
-                       <artifactId>camunda-external-task-client</artifactId>
-                       <version>1.2.0-SNAPSHOT</version>
-               </dependency>   
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-external-task-client</artifactId>
+                       <version>1.0.0</version>
+               </dependency>
        </dependencies>
 </project>
index aace75f..499c113 100644 (file)
@@ -59,9 +59,9 @@ public class AuditStackService {
                ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"),
                                auth);
                ExternalTaskClient client = ExternalTaskClient.create()
-                               .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(5).addInterceptor(interceptor)
-                               .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(5000, 2, 30000)).build();
-               client.subscribe("InventoryAudit").lockDuration(5000)
+                               .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
+                               .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
+               client.subscribe("InventoryAudit").lockDuration(60000)
                                .handler(auditStack::executeExternalTask).open();
        }
 
index d1f952c..773705d 100644 (file)
@@ -72,7 +72,7 @@ public class AuditStackServiceData {
                        }else if(externalTask.getRetries() != null &&
                                        externalTask.getRetries()-1 == 0){
                                logger.debug("The External Task Id: {}  Failed, All Retries Exhausted", externalTask.getId());
-                               externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
+                               externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure");
                        }else{
                                logger.debug("The External Task Id: {}  Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
                                externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
index 52b67b8..d7739e5 100644 (file)
@@ -105,7 +105,7 @@ public class AuditStackServiceDataTest extends AuditStackServiceData {
                doReturn(1).when(mockExternalTask).getRetries();
                auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);               
                Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask,
-                               "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
+                               "AuditAAIInventoryFailure");
        }
 
        @Test