Terminology
- Broadcast message: a message for all participants (participantId=null and participantType=null)
- Message to a participant: a message only for a participant (participantId and participantType properly filled).
- ThreadPoolExecutor: ThreadPoolExecutor executes the given task, into SupervisionAspect class is configured to execute tasks in ordered manner, one by one.
- Spring Scheduling: into SupervisionAspect class, the @Scheduled annotation invokes "schedule()" method every "runtime.participantParameters.heartBeatMs" milliseconds with a fixed delay
- MessageIntercept: "@MessageIntercept" annotation is used into SupervisionHandler class to intercept "handleParticipantMessage" method calls using spring aspect oriented programming. In details is used to into SupervisionHandler class to intercept "handleParticipantMessage" methods.
Design of a creation of a Control Loop Type
- GUI calls POST "/commission" endpoint with a Control Loop Type Definition (Tosca Service Template) as body
- saves to DB the Tosca Service Template using PolicyModelsProvider
- if there are participants registered, it triggers the execution to send a broadcast PARTICIPANT_UPDATE message
- the message is built by ParticipantUpdatePublisher using Tosca Service Template data (to fill the list of ParticipantDefinition).
Design of a deletion of a Control Loop Type
...
- GUI calls DELETE "/instantiation" endpoint
- checks that Control Loop is in UNINITIALISED status
- deletes the Control Loop from DB
Design of
...
"issues control loop commands to control loops" - case UNINITIALISED to PASSIVE
- GUI calls "/instantiation/command" endpoint with PASSIVE as orderedState
- checks if participants registered are matching with the list of control Loop Element
- updates control loop and control loop elements to DB (orderedState = PASSIVE)
- validates the status order issued
- triggers the execution to send a broadcast CONTROL_LOOP_UPDATE message
- the message is built by ControlLoopUpdatePublisher using Tosca Service Template data and ControlLoop data. (with startPhase = 0)
- updates control loop and control loop elements to DB (state = UNINITIALISED2PASSIVE)
Design of
...
"issues control loop commands to control loops" - case PASSIVE to UNINITIALISED
- GUI calls "/instantiation/command" endpoint with UNINITIALISED as orderedState
- checks if participants registered are matching with the list of control Loop Element
- updates control loop and control loop elements to DB (orderedState = UNINITIALISED)
- validates the status order issued
- triggers the execution to send a broadcast CONTROL_LOOP_STATE_CHANGE message
- the message is built by ControlLoopStateChangePublisher with controlLoopId
- updates control loop and control loop elements to DB (state = PASSIVE2UNINITIALISED)
Design of
...
"issues control loop commands to control loops" - case PASSIVE to RUNNING
- GUI calls "/instantiation/command" endpoint with RUNNING as orderedState
- checks if participants registered are matching with the list of control Loop Element.
- updates control loop and control loop elements to DB (orderedState = RUNNING)
- validates the status order issued
- triggers the execution to send a broadcast CONTROL_LOOP_STATE_CHANGE message
- the message is built by ControlLoopStateChangePublisher with controlLoopId
- updates control loop and control loop elements to DB (state = PASSIVE2RUNNING)
Design of
...
"issues control loop commands to control loops" - case RUNNING to PASSIVE
- GUI calls "/instantiation/command" endpoint with UNINITIALISED as orderedState
- checks if participants registered are matching with the list of control Loop Element.
- updates control loop and control loop elements to db (orderedState = RUNNING)
- validates the status order issued
- triggers the execution to send a broadcast CONTROL_LOOP_STATE_CHANGE message
- the message is built by ControlLoopStateChangePublisher with controlLoopId
- updates control loop and control loop elements to db (state = RUNNING2PASSIVE)
...
- A Participant starts and send a PARTICIPANT_REGISTER message
- ParticipantRegisterListener collects the message from DMaap
- if not present, saves participant reference with status UNKNOWN to DB
- if is present a Control Loop Type, triggers the execution to send a PARTICIPANT_UPDATE message to the participant registered (message of Priming).
- the message is built by ParticipantUpdatePublisher using Tosca Service Template data (to fill the list of ParticipantDefinition).
- triggers the execution to send a PARTICIPANT_REGISTER_ACK message to the participant registered
- MessageIntercept intercepts that event, if PARTICIPANT_UPDATE message has been sent, it will be add a task to handle PARTICIPANT_REGISTER in SupervisionScanner
- SupervisionScanner starts the monitoring for participantUpdate
...
- Participants sends CONTROLLOOP_UPDATE_ACK messages in response to a CONTROLLOOP_UPDATE message. It will send a CONTROLLOOP_UPDATE_ACK for each CL-elements moved to the ordered state as indicated by the CONTROLLOOP_UPDATE.
- ControlLoopUpdateAckListener collects the message from DMaap
- checks the status of all control loop elements and checks if the control loop is primed
- updates the CL to DB if it is changed
- MessageIntercept intercepts that event and adds a task to handle a monitoring execution in SupervisionScanner
...
- to determinate of the next startPhase in a CONTROLLOOP_UPDATE message.
- to upgrade CL state: in a scenario that CL state are in kind of transitional state (example UNINITIALISED2PASSIVE), if all CL-elements are moved properly to the specific state, the CL state will be upgrade to that.
- to retry CONTROLLOOP_UPDATE/CONTROL_LOOP_STATE_CHANGE messages. if there is a CL Element not in the proper state, it will retry a broadcast message.
- to retry PARTICIPANT_UPDATE message to the participant in a scenario that CL-runtime do not receive PARTICIPANT_UPDATE_ACT from it.
- to send PARTICIPANT_STATUS_REQ to the participant in a scenario that CL-runtime do not receive PARTICIPANT_STATUS from it,
The solution Design of retry, timeout, and reporting for all Participant message dialogues are implemented into the monitoring execution.
...