public class MessageCorrelationBuilderImpl extends Object implements MessageCorrelationBuilder
Modifier and Type | Field and Description |
---|---|
protected String |
businessKey |
protected CommandContext |
commandContext |
protected CommandExecutor |
commandExecutor |
protected Map<String,Object> |
correlationProcessInstanceVariables |
protected boolean |
isExclusiveCorrelation |
protected String |
messageName |
protected Map<String,Object> |
payloadProcessInstanceVariables |
protected String |
processInstanceId |
Constructor and Description |
---|
MessageCorrelationBuilderImpl(CommandContext commandContext,
String messageName) |
MessageCorrelationBuilderImpl(CommandExecutor commandExecutor,
String messageName) |
Modifier and Type | Method and Description |
---|---|
void |
correlate()
Executes the message correlation.
|
void |
correlateAll()
Executes the message correlation for multiple messages.
|
void |
correlateExclusively()
Behaves like
MessageCorrelationBuilder.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 |
protected void |
ensurePayloadProcessInstanceVariablesInitialized() |
String |
getBusinessKey() |
CommandContext |
getCommandContext() |
CommandExecutor |
getCommandExecutor() |
Map<String,Object> |
getCorrelationProcessInstanceVariables() |
String |
getMessageName() |
Map<String,Object> |
getPayloadProcessInstanceVariables() |
String |
getProcessInstanceId() |
boolean |
isExclusiveCorrelation() |
MessageCorrelationBuilder |
processInstanceBusinessKey(String businessKey)
Correlate the message such that the process instance has a
business with the given name and value.
|
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 |
setVariable(String variableName,
Object variableValue)
Pass a 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.
|
protected CommandExecutor commandExecutor
protected CommandContext commandContext
protected boolean isExclusiveCorrelation
protected String messageName
protected String businessKey
protected String processInstanceId
protected Map<String,Object> correlationProcessInstanceVariables
public MessageCorrelationBuilderImpl(CommandExecutor commandExecutor, String messageName)
public MessageCorrelationBuilderImpl(CommandContext commandContext, String messageName)
public MessageCorrelationBuilder processInstanceBusinessKey(String businessKey)
MessageCorrelationBuilder
Correlate the message such that the process instance has a business with the given name and value.
processInstanceBusinessKey
in interface MessageCorrelationBuilder
businessKey
- the businessKey to correlate on.public MessageCorrelationBuilder processInstanceVariableEquals(String variableName, Object variableValue)
MessageCorrelationBuilder
Correlate the message such that the process instance has a variable with the given name and value.
processInstanceVariableEquals
in interface MessageCorrelationBuilder
variableName
- the name of the process instance variable to correlate on.variableValue
- the value of the process instance variable to correlate on.public MessageCorrelationBuilder processInstanceId(String id)
MessageCorrelationBuilder
Correlate the message such that a process instance with the given id is selected.
processInstanceId
in interface MessageCorrelationBuilder
id
- the id of the process instance to correlate on.public MessageCorrelationBuilder setVariable(String variableName, Object variableValue)
MessageCorrelationBuilder
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.
setVariable
in interface MessageCorrelationBuilder
variableName
- the name of the variable to setvariableValue
- the value of the variable to setpublic MessageCorrelationBuilder setVariables(Map<String,Object> variables)
MessageCorrelationBuilder
Pass a map of variables to the execution waiting on the message. Use this method for passing the message's payload
setVariables
in interface MessageCorrelationBuilder
variables
- the map of variablesprotected void ensurePayloadProcessInstanceVariablesInitialized()
public void correlate()
MessageCorrelationBuilder
This will result in either:
correlate
in interface MessageCorrelationBuilder
public void correlateExclusively()
MessageCorrelationBuilder
Behaves like MessageCorrelationBuilder.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.
correlateExclusively
in interface MessageCorrelationBuilder
public void correlateAll()
MessageCorrelationBuilder
This will result in any number of the following:
correlateAll
in interface MessageCorrelationBuilder
public CommandExecutor getCommandExecutor()
public CommandContext getCommandContext()
public String getMessageName()
public String getBusinessKey()
public String getProcessInstanceId()
public Map<String,Object> getCorrelationProcessInstanceVariables()
public boolean isExclusiveCorrelation()
Copyright © 2018. All rights reserved.