Workflow for async SDNC call

I try to undestand the workflow for pb note : SO Weekly Meeting 2021-04-28

It's not a documentation but a debug note



SDNCAdapterV1.bpmn

1- Process message

Call  SDNCAdapter.preProcessRequest (groovy)

Prepare SDNC HTTP call (body and header)

Header "X-ONAP-RequestID" is set with variable "mso-request-id"

This workFlow have an input message : "sdncAdapterWorkflowRequest"

It's a XML with a tag "RequestHeader" and inside a tag "RequestId" this RequestId will be set as value of variable "SDNCA_requestId"

2- Invoke SDNC Adapter

No groovy code, juste a HTTP call to SDNC with data from step 1

3- Test : "is Response Ok?"

Test Http response code from step 2, if it's 200 go to step 4.

4- Reset callback request and set timer value

Call SDNCAdapter.resetCallbackRequest (groovy)

Remove var sdncAdapterCallbackRequest and set timeout (5 minutes by default can be change with param : mso.adapters.sdnc.timeout )

Launch SubProcess "Wait for asynchronous message" and wait SDNC callBack.

In this workflow it's waiting for a message "sdncAdapterCallbackRequest"

5- Timeout

If SubProcess "Wait for asynchronous message" still running after 5 minutes (timeout set step 4)

Call SDNCAdapter.setTimeout (groovy)

With Thread.sleep(1000) → to remove ?

Only debug and tace log, why no warning or error log ?



Callback Webservice

WS implementation is into org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl

@WebMethod(operationName = "SDNCAdapterCallback") @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") public SDNCAdapterResponse sdncAdapterCallback(@WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) { String method = "sdncAdapterCallback"; Object message = sdncAdapterCallbackRequest; String messageEventName = "sdncAdapterCallbackRequest"; String messageVariable = "sdncAdapterCallbackRequest"; String correlationVariable = "SDNCA_requestId"; String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); CallbackResult result = callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable, correlationValue, logMarker); if (result instanceof CallbackError) { return new SDNCAdapterErrorResponse(((CallbackError) result).getErrorMessage()); } else { return new SDNCAdapterResponse(); } }



All code to link the Http to process are into CallbackHandlerService.correlate() method

In this code we create a query to Camunda runtime to find process waiting for message "sdncAdapterCallbackRequest" with variable "SDNCA_requestId" set to value of requestID

If we don't find any process the code wait 1 minute to find a process (with sleep code..)

The problem

If the time between the call back and the "catch event" step is more than one minute we fail... and we need to wait the timeout (5 minutes) to exit the "Wait for asynchronous message" step.

The callBack request is synchronous, so in case of 1 minute timeout, the client are wating a long time... it's not a good point (imagine we have a proxy between SDNC and SO with a 30s timeout...)

One solution

Start listening for event earlier. I will also check error management on SDNC