Last active
March 23, 2017 15:34
-
-
Save berndruecker/5e84238e9bc08d86c9bdf50f77683214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean handleEvent(String type, String eventName, String transactionId, JsonObject event) { | |
VariableMap correlationKeys = getCorrelationKeys(event); | |
MessageCorrelationBuilder correlation = engine.getRuntimeService().createMessageCorrelation(eventName); | |
ExecutionQuery query = engine.getRuntimeService().createExecutionQuery().messageEventSubscriptionName(eventName); | |
for (String key : correlationKeys.keySet()) { | |
correlation.processInstanceVariableEquals(key, correlationKeys.get(key)); | |
query.processVariableValueEquals(key, correlationKeys.get(key)); | |
} | |
// we do a query first to check if somebody is waiting, might be that the event is not targeted at our service | |
if (query.count()==0) { | |
return false; // not handled | |
} | |
// otherwise correlate it add all possible additional correlation keys as variables to the flow | |
correlation.setVariables(getNewVariables(event)); | |
correlation.correlateWithResult(); | |
return true; // handled | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment