BusinessEvents - Process Component
In case of a BE Process Component it is necessary to create a Concept with a State Machine which will represent the process component lifecycle.
The concept can be created in a rule that fires on receiving PlanItemExecutionRequest event from Orchestrator to start the Process Component.
This is a good solution in case in the project there are only BE Process Components. In case there are BW and BE Process Components then the rule has to fire only when the Process Component type is BE. To implement this, it is possible to create another channel linked to the PlanItemExecutionRequest Event having a selector such as: processComponentType = 'BE'. In this way the channel will only pick up PlanItemExecutionRequests coming from the Orchestrator and having BE as processComponentType.
The planItemExecuteRequest (Destination) shows how to set the Selector for a BE Channel:
In this case then, to create the BE Concept when the Orchestrator sends the PlanItemExecutionRequest Event for a certain PlanFragment, it is possible to create a rule function having in the declaration the PlanItemExecutionRequest Event and in the body the code to create the concept that represents the Process Component.
In the Arguments for PlanItemExecuteRequestEvent there is the Argument of the Rule Function that creates the BE Concept when the PlanItemExecuteRequestEvent comes:
In the Rule Function Code there is the body of the Rule Function with the code example that checks first if the Concept that needs to be created already exists and if not, it creates the Concept:
Once that the Concept has been created, it is also necessary to send the PlanItemExecuteResponseEvent back to the Orchestrator. This can be done in any state of the State Machine based on the logic of the implementation or alternatively at the END state.
In the Edit Body: StateMachine_End_entryAction there is the code example that shows how to create the PlanItemExecuteResponseEvent and how to send it: