Created attachment 826055 [details] Maven project with reproducer Description of problem: Live queries return results in different order with PHREAK and with RETE. For instance, imagine you define a live query (KieSession.openLiveQuery()) which returns two rows, A and B. If you attach a ViewChangedEventListener to the query, the ViewChangedEventListener.rowInserted(Row) method gets called as follows: PHREAK: ViewChangedEventListener.rowInserted(A), ViewChangedEventListener.rowInserted(B) RETEOO: ViewChangedEventListener.rowInserted(B), ViewChangedEventListener.rowInserted(A) I am not sure if this is by design or a bug, or just the order of query results is not guaranteed in general. Could someone from engineering comment this? Version-Release number of selected component (if applicable): Drools 6.0.0-SNAPSHOT BRMS 6.0.0 ER4 How reproducible: Run LiveQueriesTest from the attached Maven project with setting drools engine to RETE: mvn clean test -Dtest=LiveQueriesTest -Ddrools.ruleEngine=reteoo The query results order is reversed when executed with PHREAK: mvn clean test -Dtest=LiveQueriesTest -Ddrools.ruleEngine=phreak
There is no guarantee on the order the rows will be produced for a single rule. This is something that has and will change over time, as we optimise internal data structures. It's even changed between ReteOO versions.