Recursive Service Orchestration - Composed Service
- 1
- 2 New building blocks for creating and deleting child services
- 2.1 Build Create-Request
- 2.2 Send Request
- 2.3 Wait for completion
- 2.4 Handle Failure
- 2.5 Update AAI
- 2.6 Create Child Service workflow
- 2.7 Delete Child Service workflow
- 2.8 List of Macro flow "Service-Macro-Create" Building blocks (composed service):
- 2.9 List of Macro flow "Service-Macro-Delete" Building blocks (composed service):
- 3 Message Correlation (from child process)
SO-3811: Recursive Service Orchestration POCClosed
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.
Create Child Service workflow
Request to API-handler for parent service
Validating request for parent service in API-handler
Call WorkflowActionBB for parent service
Call AssignServiceInstanceBB for parent service
Call CreateChildServiceBB for child service
Building create request for child service
Request CREATE for child to ServiceInstances API for child service
Validating request for child service in API-handler
Call WorkflowActionBB for child service
Execute all relevant building blocks for child service
Create AAI relationship between parent service and child service
ActivateServiceInstanceBB for parent service
*bold actions repeats recursively for every child service
Delete Child Service workflow
Request to API-handler for parent service
Call WorkflowActionBB for parent service
Check service instance resources (child services) in AAI for parent service
Call DeleteChildServiceBB for child service
Building delete request for child service
Request DELETE to ServiceInstances API for child service
Call WorkflowActionBB for child service
Execute all relevant building blocks for child service
Call DeactivateServiceInstanceBB for parent service
Call UnassignServiceInstanceBB for parent service
*bold actions repeats recursively for every child service
List of Macro flow "Service-Macro-Create" Building blocks (composed service):
AssignServiceInstanceBB
CreateChildServiceBB
ActivateServiceInstanceBB
List of Macro flow "Service-Macro-Delete" Building blocks (composed service):
DeleteChildServiceBB
DeactivateServiceInstanceBB
UnassignServiceInstanceBB
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
Recursive Orchestration in SO Macro flow details