BPMN SequenceFlow condition result in java

Good day to all!
I want to get the result of evaluating an expression from SequenceFlow for a specific ExecutionId.
At SequenceFlow (org.camunda.bpm.model.bpmn.instance) is an expression that is calculated during the process and depends on variables.
I get the expression this way: sequenceFlow.getConditionExpression().getTextContent().
Let’s say there is an expression like ${FIRST_PARAM== ‘true’ AND SECOND_PARAM== ‘word’}
How do I get the result of this expression in Java now? I don’t want to write a huge parser for all possible expressions. There should be a simpler version using the Java libraries org.camunda.bpm.*
Thanks for your attention!

Hi @rkuznetsov,

maybe thats a use case for take listeners.

The result can only be true (otherwise the sequence flow won’t be followed), and you can add a listener to each sequence flow behind the gateway to set a variable of your choice to true.

Hope this helps, Ingo


I need to predict which IntermediateThrowEvent (circle with envelope) is currently available subject to conditions. And you need to do this in Java code.
The screenshot shows that the process is located in the Gateway.
I need to get the results of SequenceFlow calculations (conditions) and use them to determine which IntermediateThrowEvent are available to the process and to prevent the attempt to call 3-rd IntermediateThrowEvent when only the first one is available.

Hi @rkuznetsov,

what about querying for available events with runtimeService().createEventSubscriptionQuery()....list()? (https://docs.camunda.org/javadoc/camunda-bpm-platform/7.12/org/camunda/bpm/engine/RuntimeService.html#createEventSubscriptionQuery--)

There is also internal API available to evaluate expressions explicitly, for example in the field injection for JavaDelegates: https://docs.camunda.org/manual/7.12/user-guide/process-engine/delegation-code/#field-injection-on-listener.

But I would for the subscription query.

Hope this helps, Ingo