Uploaded image for project: 'External API Framework'
  1. External API Framework
  2. EXTAPI-140

Update polling execution_task processing to use time rather than nbRetries

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Medium Medium
    • Casablanca Release
    • None
    • None
    • None

       

      Update the polling mechanism to continue polling for a default of 6 hours ( set via new property in application.properties called soPollingTimeoutInMins which is defaulted to 360 mins) . After this time the execution_task will be marked as FAILED and an order message of "Service Orchestrator Service Instantiation timed out" .

      Update ExecutionTask.java

      Add

      private Date firstAttemptDate;

      and use

      private Date lastAttemptDate;   

      You could remove

      private int nbRetries;

       

      In SoTaskManager.java method registerOrderItemExecutionPlan 

      remove 

      task.setnbRetries(3);

      replace with

      task.setfirstAttemptDate(new Date());

       Calculate if the execution task is taking longer than the allowed number of hours ( add default soPollingTimeoutInMins to 360 mins in application.properties )

      In SoTaskProcessor.java, replace the

      executionTask.getNbRetries() > 0   with logic to compare

      Instead with comparing the difference in time between lastAttemptDate and firstAttemptDate ,

      Sometime like ((lastAttemptDate.getTime() - firstAttemptDate.getTime())  / (60 * 1000) % 60)) > soPollingTimeoutInMins 

       

      Move executionTask.setLastAttemptDate(new Date());  above this check

      remove

      int nbRetries = executionTask.getNbRetries(); executionTask.setNbRetries(--nbRetries);

      and change the else to just do

      executionTaskRepository.save(executionTask);

      also remove

      private boolean shouldDecrementNbRetries(ServiceOrderItem serviceOrderItem) {

              return ActionType.MODIFY!=serviceOrderItem.getAction() || (StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND ==serviceOrderItem.getState() || StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND

                  ==serviceOrderItem.getState());

          }

       

      Add Ordermessage for SO timeout before calling updateFailedTask  ( maybe Romain can help with what kind of OrderMessage we want for SO Timeout?

       

      Also remove the local 3 times polling in both 

      pollSoRequestStatus & 

      pollE2ESoRequestStatus methods in SOGetStatusManager.java 

      i.e. remove the for while (!stopPolling) loop for "nbRetries", i..e. only one call for SO service status in these methods per orderItem. in these methods remove the int nbRetries and stopPolling variables. 

       

      Also update the ApiTest.java where nbRetries assertions are made. Also update ServiceOrderAssertions.java where serNbRetries are used.   

            infy_28900 infy_28900
            aosull01 aosull01
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: