if audit fails write sub interface data to a ai
[so.git] / adapters / mso-openstack-adapters / src / main / java / org / onap / so / adapters / audit / AuditStackService.java
index 6ea14dc..499c113 100644 (file)
@@ -46,30 +46,10 @@ public class AuditStackService {
        public Environment env;
 
        @Autowired
-       private AuditCreateStackService auditCreateStack;
-       
-       @Autowired
-       private AuditDeleteStackService auditDeleteStack;
+       private AuditStackServiceData auditStack;
 
        @PostConstruct
-       public void auditAddAAIInventory() {
-               String auth = "";
-               try {
-                       auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
-               } catch (IllegalStateException | GeneralSecurityException e) {
-                       logger.error("Error Decrypting Password", e);
-               }
-               ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"),
-                               auth);
-               ExternalTaskClient client = ExternalTaskClient.create()
-                               .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
-                               .asyncResponseTimeout(120000).build();
-               client.subscribe("InventoryAddAudit").lockDuration(60000)
-                               .handler(auditCreateStack::executeExternalTask).open();
-       }
-       
-       @PostConstruct
-       public void auditDeleteAAIInventory() {
+       public void auditAAIInventory() {
                String auth = "";
                try {
                        auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
@@ -80,9 +60,9 @@ public class AuditStackService {
                                auth);
                ExternalTaskClient client = ExternalTaskClient.create()
                                .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
-                               .asyncResponseTimeout(120000).build();
-               client.subscribe("InventoryDeleteAudit").lockDuration(60000)
-                               .handler(auditDeleteStack::executeExternalTask).open();
+                               .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
+               client.subscribe("InventoryAudit").lockDuration(60000)
+                               .handler(auditStack::executeExternalTask).open();
        }
 
 }