Package org.kie.internal.process

## Interface CorrelationAwareProcessRuntime

-     public interface CorrelationAwareProcessRuntime

  Classes that implement this interface will provide additional capabilities based on correlation. Most important to allow users to define custom correlation keys as an alternative to considered internal process instance id.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `org.kie.api.runtime.process.ProcessInstance` | `createProcessInstance​(String processId, CorrelationKey correlationKey, Map<String,​Object> parameters)` | Creates a new process instance (but does not yet start it).
    `org.kie.api.runtime.process.ProcessInstance` | `getProcessInstance​(CorrelationKey correlationKey)` | Returns the process instance with the given correlationKey.
    `org.kie.api.runtime.process.ProcessInstance` | `startProcess​(String processId, CorrelationKey correlationKey, Map<String,​Object> parameters)` | Start a new process instance.
    `org.kie.api.runtime.process.ProcessInstance` | `startProcessFromNodeIds​(String processId, CorrelationKey key, Map<String,​Object> params, String... nodeIds)` | Starts a process with the values supplied from the current nodes

- - ### Method Detail

    - #### startProcess

          org.kie.api.runtime.process.ProcessInstance startProcess​(String processId,
                                                                   CorrelationKey correlationKey,
                                                                   Map<String,​Object> parameters)

      Start a new process instance. The process (definition) that should be used is referenced by the given process id. Parameters can be passed to the process instance (as name-value pairs), and these will be set as variables of the process instance.
      Parameters:
        `processId` - the id of the process that should be started
        `correlationKey` - custom correlation key that can be used to identify process instance
        `parameters` - the process variables that should be set when starting the process instance
      Returns:
        the `ProcessInstance` that represents the instance of the process that was started

    - #### createProcessInstance

          org.kie.api.runtime.process.ProcessInstance createProcessInstance​(String processId,
                                                                            CorrelationKey correlationKey,
                                                                            Map<String,​Object> parameters)

      Creates a new process instance (but does not yet start it). The process (definition) that should be used is referenced by the given process id. Parameters can be passed to the process instance (as name-value pairs), and these will be set as variables of the process instance. You should only use this method if you need a reference to the process instance before actually starting it. Otherwise, use startProcess.
      Parameters:
        `processId` - the id of the process that should be started
        `correlationKey` - custom correlation key that can be used to identify process instance
        `parameters` - the process variables that should be set when creating the process instance
      Returns:
        the `ProcessInstance` that represents the instance of the process that was created (but not yet started)

    - #### startProcessFromNodeIds

          org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds​(String processId,
                                                                              CorrelationKey key,
                                                                              Map<String,​Object> params,
                                                                              String... nodeIds)

      Starts a process with the values supplied from the current nodes
      Parameters:
        `processId` - The process's identifier
        `correlationKey` - correlation key to be assigned to process instance - must be unique
        `params` - process variables
        `nodeIds` - list of unique node ids that would be triggered once the process is created
      Returns:
        process instance identifier
      Throws:
        `RuntimeException` - in case of encountered errors
        `DeploymentNotFoundException` - in case deployment with given deployment id does not exist
        `DeploymentNotActiveException` - in case deployment with given deployment id is not active

    - #### getProcessInstance

          org.kie.api.runtime.process.ProcessInstance getProcessInstance​(CorrelationKey correlationKey)

      Returns the process instance with the given correlationKey. Note that only active process instances will be returned. If a process instance has been completed already, this method will return `null`.
      Parameters:
        `correlationKey` - the custom correlation key assigned when process instance was created
      Returns:
        the process instance with the given id or `null` if it cannot be found