How to get evaluated rules in dmn engine

I have different rules in my dmn decision table and want to evaluate it. After evaluation, I want to know which rules are evaluated. I know this can be done with DmnDecisionTableEvaluationListener but I want to get this in return of below line.

result = dmnEngine.evaluateDecisionTable(decision, variables);

Is there a way I can find out which rules are evaluated from result object?

Thanks for your help.

@chetan, when you make a call to dmn engine to evaluate decision table like below:

dmnEngine.evaluateDecisionTable(decision, variables);

Based on the provided DmnEngineConfiguration engine will set the various handlers and listeners to the DefaultDmnDecisionContext:

evaluationListeners = configuration.getDecisionEvaluationListeners();

evaluationHandlers.put(DmnDecisionTableImpl.class, new DecisionTableEvaluationHandler(configuration));

Once DecisionContext was build, it will invoke the below evaluateDecision() function:

public DmnDecisionResult evaluateDecision(DmnDecision decision, VariableContext variableContext);

In this function call, appropriate DmnDecisionLogicEvaluationHandler will be resolved and the evaluation of decisionTable is delegated to the handler.

Next, handler executes the evaluate function. This evaluate function resolves the handler based from the DMNDecision input whether DecisionLiteralExpressionEvaluationHandler or DecisionTableEvaluationHandler.

DmnDecisionLogicEvaluationEvent evaluatedEvent = handler.evaluate(evaluateDecision, variableMap.asVariableContext());

Once handler is resolved, the evaluate() finds the matching rules and set it to DmnDecisionTableEvaluationEvent

List<DmnDecisionTableRuleImpl> matchingRules = new ArrayList<DmnDecisionTableRuleImpl>();
DmnDecisionTableEvaluationEventImpl evaluationResult = new DmnDecisionTableEvaluationEventImpl();

Finally, all the matching rules are will be evaluated and added to the DmnDecisionLogicEvaluationEvent.

Here’s the place where registered DmnDecisionTableEvaluationListener will be get invoked.

for (DmnDecisionTableEvaluationListener evaluationListener : evaluationListeners) {
  evaluationListener.notify(evaluationResult); //executes DmnDecisionTableEvaluationListener


  1. Then evaluated results are returned as DmnDecisionResult. DmnDecisionResult will not contains the matchingRules, it contains only the results of the rule execution output.

  2. So the DmnDecisionTableEvaluationEvent has the matchingRules which can be accessed from registering the DmnDecisionTableEvaluationListener.

@aravindhrs Thank you for your response. This helps.