public interface MessageCorrelationBuilder
A fluent builder for defining message correlation
Modifier and Type | Method and Description |
---|---|
void |
correlate()
Executes the message correlation.
|
void |
correlateAll()
Executes the message correlation for multiple messages.
|
List<MessageCorrelationResult> |
correlateAllWithResult()
Executes the message correlation for multiple messages and returns a list of message correlation results.
|
List<MessageCorrelationResultWithVariables> |
correlateAllWithResultAndVariables(boolean deserializeValues)
Executes the message correlation.
|
void |
correlateExclusively()
Behaves like
correlate() , however uses pessimistic locking for correlating a waiting execution, meaning
that two threads correlating a message to the same execution in parallel do not end up continuing the
process in parallel until the next wait state is reached |
ProcessInstance |
correlateStartMessage()
Executes the message correlation.
|
MessageCorrelationResult |
correlateWithResult()
Executes the message correlation and returns a
MessageCorrelationResult object. |
MessageCorrelationResultWithVariables |
correlateWithResultAndVariables(boolean deserializeValues)
Executes the message correlation.
|
MessageCorrelationBuilder |
localVariableEquals(String variableName,
Object variableValue)
Correlate the message such that the execution has a local variable with the given name and value.
|
MessageCorrelationBuilder |
localVariablesEqual(Map<String,Object> variables)
Correlate the message such that the execution has the given variables as local variables.
|
MessageCorrelationBuilder |
processDefinitionId(String processDefinitionId)
Correlate the message such that a process definition with the given id is selected.
|
MessageCorrelationBuilder |
processInstanceBusinessKey(String businessKey)
Correlate the message such that the process instance has a business key with
the given name.
|
MessageCorrelationBuilder |
processInstanceId(String id)
Correlate the message such that a process instance with the given id is selected.
|
MessageCorrelationBuilder |
processInstanceVariableEquals(String variableName,
Object variableValue)
Correlate the message such that the process instance has a
variable with the given name and value.
|
MessageCorrelationBuilder |
processInstanceVariablesEqual(Map<String,Object> variables)
Correlate the message such that the process instance has the given variables.
|
MessageCorrelationBuilder |
setVariable(String variableName,
Object variableValue)
Pass a variable to the execution waiting on the message.
|
MessageCorrelationBuilder |
setVariableLocal(String variableName,
Object variableValue)
Pass a local variable to the execution waiting on the message.
|
MessageCorrelationBuilder |
setVariables(Map<String,Object> variables)
Pass a map of variables to the execution waiting on the message.
|
MessageCorrelationBuilder |
setVariablesLocal(Map<String,Object> variables)
Pass a map of local variables to the execution waiting on the message.
|
MessageCorrelationBuilder |
startMessageOnly()
Specify that only start message can be correlated.
|
MessageCorrelationBuilder |
tenantId(String tenantId)
Specify a tenant to deliver the message to.
|
MessageCorrelationBuilder |
withoutTenantId()
Specify that the message can only be received on executions or process
definitions which belongs to no tenant.
|
MessageCorrelationBuilder processInstanceBusinessKey(String businessKey)
Correlate the message such that the process instance has a business key with the given name. If the message is correlated to a message start event then the given business key is set on the created process instance.
businessKey
- the businessKey to correlate on.MessageCorrelationBuilder processInstanceVariableEquals(String variableName, Object variableValue)
Correlate the message such that the process instance has a variable with the given name and value.
variableName
- the name of the process instance variable to correlate on.variableValue
- the value of the process instance variable to correlate on.MessageCorrelationBuilder processInstanceVariablesEqual(Map<String,Object> variables)
Correlate the message such that the process instance has the given variables.
variables
- the variables of the process instance to correlate on.MessageCorrelationBuilder localVariableEquals(String variableName, Object variableValue)
Correlate the message such that the execution has a local variable with the given name and value.
variableName
- the name of the local variable to correlate on.variableValue
- the value of the local variable to correlate on.MessageCorrelationBuilder localVariablesEqual(Map<String,Object> variables)
Correlate the message such that the execution has the given variables as local variables.
variables
- the local variables of the execution to correlate on.MessageCorrelationBuilder processInstanceId(String id)
Correlate the message such that a process instance with the given id is selected.
id
- the id of the process instance to correlate on.MessageCorrelationBuilder processDefinitionId(String processDefinitionId)
Correlate the message such that a process definition with the given id is selected.
Is only supported for correlateStartMessage()
or startMessageOnly()
flag.
processDefinitionId
- the id of the process definition to correlate on.MessageCorrelationBuilder setVariable(String variableName, Object variableValue)
Pass a variable to the execution waiting on the message. Use this method for passing the message's payload.
Invoking this method multiple times allows passing multiple variables.
variableName
- the name of the variable to setvariableValue
- the value of the variable to setMessageCorrelationBuilder setVariableLocal(String variableName, Object variableValue)
Pass a local variable to the execution waiting on the message. Use this method for passing the message's payload.
Invoking this method multiple times allows passing multiple variables.
variableName
- the name of the variable to setvariableValue
- the value of the variable to setMessageCorrelationBuilder setVariables(Map<String,Object> variables)
Pass a map of variables to the execution waiting on the message. Use this method for passing the message's payload
variables
- the map of variablesMessageCorrelationBuilder setVariablesLocal(Map<String,Object> variables)
Pass a map of local variables to the execution waiting on the message. Use this method for passing the message's payload
variables
- the map of local variablesMessageCorrelationBuilder tenantId(String tenantId)
processInstanceId(String)
or processDefinitionId(String)
.tenantId
- the id of the tenantMessageCorrelationBuilder withoutTenantId()
processInstanceId(String)
or processDefinitionId(String)
.MessageCorrelationBuilder startMessageOnly()
void correlate()
#correlateWithResult()}
MessageCorrelationResult correlateWithResult()
MessageCorrelationResult
object.
The call of this method will result in either:
MessageCorrelationResult.getResultType()
.MismatchingMessageCorrelationException
- if none or more than one execution or process definition is matched by the correlationAuthorizationException
- Permissions.UPDATE
permission on
Resources.PROCESS_INSTANCE
or no Permissions.UPDATE_INSTANCE
permission on
Resources.PROCESS_DEFINITION
.Permissions.CREATE
permission on
Resources.PROCESS_INSTANCE
and no Permissions.CREATE_INSTANCE
permission on
Resources.PROCESS_DEFINITION
.MessageCorrelationResultWithVariables correlateWithResultAndVariables(boolean deserializeValues)
correlateWithResult()
to avoid unnecessary variable access.deserializeValues
- if false, returned SerializableValue
s
will not be deserialized (unless they are passed into this method as a
deserialized value or if the BPMN process triggers deserialization)#correlateWithResult()}
void correlateExclusively()
Behaves like correlate()
, however uses pessimistic locking for correlating a waiting execution, meaning
that two threads correlating a message to the same execution in parallel do not end up continuing the
process in parallel until the next wait state is reached
CAUTION: Wherever there are pessimistic locks, there is a potential for deadlocks to occur. This can either happen when multiple messages are correlated in parallel, but also with other race conditions such as a message boundary event on a user task. The process engine is not able to detect such a potential. In consequence, the user of this API should investigate this potential in his/her use case and implement countermeasures if needed.
A less error-prone alternative to this method is to set appropriate async boundaries in the process model such that parallel message correlation is solved by optimistic locking.
void correlateAll()
#correlateAllWithResult()}
List<MessageCorrelationResult> correlateAllWithResult()
This will result in any number of the following:
Note that the message correlates to all tenants if no tenant is specified using tenantId(String)
or withoutTenantId()
.
AuthorizationException
- Permissions.UPDATE
permission on
Resources.PROCESS_INSTANCE
or no Permissions.UPDATE_INSTANCE
permission on
Resources.PROCESS_DEFINITION
.Permissions.CREATE
permission on
Resources.PROCESS_INSTANCE
and no Permissions.CREATE_INSTANCE
permission on
Resources.PROCESS_DEFINITION
.List<MessageCorrelationResultWithVariables> correlateAllWithResultAndVariables(boolean deserializeValues)
correlateAllWithResult()
to avoid unnecessary variable access.deserializeValues
- if false, returned SerializableValue
s
will not be deserialized (unless they are passed into this method as a
deserialized value or if the BPMN process triggers deserialization)#correlateAllWithResult()}
ProcessInstance correlateStartMessage()
This will result in either:
MismatchingMessageCorrelationException
- if none or more than one process definition is matched by the correlationAuthorizationException
- if one process definition is matched and the user has no
Permissions.CREATE
permission on
Resources.PROCESS_INSTANCE
and no
Permissions.CREATE_INSTANCE
permission on
Resources.PROCESS_DEFINITION
.Copyright © 2022. All rights reserved.