I Need some clarifications for a java class

Hello all,

I have the following java class:

public void execute (DelegateExecution execution) throws Exception{
     execution.getProcessEngineServices().getRuntimeService()
                    .createMessageCorrelation("Mymessage")
                    .correlate();
}

Could anyone please explain what the .getProcessEngineServices() and .getRuntimeService() methods actually do?

Is there any page in docs related to execution methods?

Base interface providing access to the process engine’s public API services.

From docs,

From the ProcessEngine, you can obtain the various services that contain the workflow/BPM methods. ProcessEngine and the services objects are thread safe.


From docs,

While the RepositoryService is about static information (i.e., data that doesn’t change, or at least not a lot), the RuntimeService is quite the opposite. It deals with starting new process instances of process definitions. As mentioned above, a process definition defines the structure and behavior of the different steps in a process. A process instance is one execution of such a process definition. For each process definition there are typically many instances running at the same time. The RuntimeService is also the service which is used to retrieve and store process variables. This is data specific to the given process instance and can be used by various constructs in the process (e.g., an exclusive gateway often uses process variables to determine which path is chosen to continue the process). The RuntimeService also allows to query on process instances and executions. Executions are a representation of the ‘token’ concept of BPMN 2.0. Basically an execution is a pointer pointing to where the process instance currently is. Lastly, the RuntimeService is used whenever a process instance is waiting for an external trigger and the process needs to be continued. A process instance can have various wait states and this service contains various operations to ‘signal’ the instance that the external trigger is received and the process instance can be continued.

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.14/org/camunda/bpm/engine/RuntimeService.html

2 Likes

@aravindhrs Many thanks for your fully detailed answer.
It helped me a lot.

1 Like