List of executed Rules DMN Decision Table

I’m trying the following example (camunda examples git hub)
/dmn-engine/dmn-engine-java-main-method

to create my own simulator
camunda.com dmn simulator
(trying to highlight the rules that are satisfied for the given input)

Where/How can i get the list of rules that got executed/satisfied for the given input (All meta data that is related to the current execution)

JBoss DROOLS Equivalent will be something like below
stackoverflow.com\ questions\ 19951880 \ drools-how-to-find-out-which-all-rules-were-matched

Hello Mallesh,

After we talked about the listener in JBoss drools during dinner last night, you got me thinking. Did a little bit of digging into Camunda’s code base and found this Listener

DmnDecisionEvaluationListener that receives this event DmnDecisionEvaluationEvent from which you can get DmnDecisionLogicEvaluationEvent which has getExecutedDecisionElements method that seems to be returning what we are looking for. Did not try this but seems promising…

try running this test…

Confirming. This is working. Pl see below code

// create a new default DMN engine
DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration)
        DmnEngineConfiguration.createDefaultDmnEngineConfiguration();

dmnEngineConfiguration.customPostDecisionTableEvaluationListeners(Collections.singletonList(
			new DmnDecisionTableEvaluationListener(){
    @Override
    public void notify(DmnDecisionTableEvaluationEvent event)
    {
        Map<String, TypedValue> inputVars = event.getInputs().stream().collect(Collectors.toMap(DmnEvaluatedInput::getName, DmnEvaluatedInput::getValue));
        System.out.println("InputVars :"+inputVars);
    }
}));

//DmnEngine dmnEngine = DmnEngineConfiguration.createDefaultDmnEngineConfiguration().buildEngine();
DmnEngine dmnEngine = dmnEngineConfiguration.buildEngine();
// parse decision from resource input stream
InputStream inputStream = DishDecider.class.getResourceAsStream("dish-decision.dmn11.xml");

try {
	
  // Mallesh
  List<DmnDecision> decisions = dmnEngine.parseDecisions(inputStream);
  //DmnDecision decision = dmnEngine.parseDecision("decision", inputStream);
  DmnDecision decision = decisions.get(0);
  if(decision.isDecisionTable()) {
	 //HitPolicy hitPolicy =   decisionTable.getHitPolicy();
  }
  // evaluate decision
  DmnDecisionTableResult result = dmnEngine.evaluateDecisionTable(decision, variables);
  
  // print result
  String desiredDish = result.getSingleResult().getSingleEntry();
  System.out.println("Dish Decision:\n\tI would recommend to serve: " + desiredDish);

}
finally {
  try {
    inputStream.close();
  }
  catch (IOException e) {
    System.err.println("Could not close stream: "+e.getMessage());
  }
}