- SO-3811Getting issue details... STATUS
New building blocks for creating and deleting child services
- CreateChildServiceBB
- DeleteChildServiceBB
The 2 new BPMN's will be very similar and perform the same steps as illustrated above.
Each child service defined in the request will map to a building block, i.e. a request with 3 child services will run CreateChildServiceBB 3 times.
Child requests are processed sequentially.
Build Create-Request
Parse request payload and build ServiceInstancesRequest object for child service. Use Service Instance name to differentiate which child to parse.
Service Instance Id for the child service should be generated in WorkflowAction, and passed in the new request object.
A correlation id should be generated and passed in requestDetails.requestInfo.correlator, this will be used to correlate message from child process to parent.
Parent request id should be passed in requestDetails.requestInfo.requestorId
Parent instance and model details should be passed in the relatedInstanceList with instanceDirection=source. This will indicate a child request.
"relatedInstanceList": [ { "relatedInstance": { "instanceId": "351262fb-4a32-4c43-b600-c6514f6ff808", "modelInfo": { "modelVersion": "{{svc_modelVersion}}", "modelVersionId": "{{svc_modelVersionId}}", "modelInvariantId": "{{svc_modelInvariantId}}", "modelName": "{{svc_modelName}}", "modelType": "service" }, "instanceDirection": "source" } } ],
Count levels of recursion and number of children to calculate appropriate TimeOut
Set Execution Variables:
CHILD_SVC_REQ_PAYLOAD
CHILD_SVC_REQ_CORRELATION_ID
CHILD_SVC_REQ_TIMEOUT
Send Request
Send via REST to apihandler. If request fails throw WorkflowException
Set Execution Variables:
CHILD_SVC_REQ_ID
Wait for completion
When child create process finishes, it should create a message which will be correlated using messageName and correlation id in requestInfo. Variables will to be passed in message:
CHILD_SVC_REQ_STATUS = FAILED | COMPLETED
CHILD_SVC_REQ_ERROR = workflow error message
Handle Failure
Build a workflow exception using error message from child request (CHILD_SVC_REQ_ERROR)
Update AAI
Set relationship between parent and child service.
Message Correlation (from child process)
The process creating the child service, must be able to identify that it is a child process. An Execution variable IS_CHILD_PROCESS should be set early in WorkflowActionBB.
In each update method which runs before the process ends, we need to add logic to check the IS_CHILD_PROCESS variable. If true, then a message should be created and correlated to its parent process using the provided correlation id in the request and the predefined message name constant (CHILD_SVC_REQ_MESSAGE_NAME). The message should set variables:
CHILD_SVC_REQ_STATUS = FAILED | COMPLETED
CHILD_SVC_REQ_ERROR = error message or blank