Skip to content

Instantly share code, notes, and snippets.

@victor-ferrer
Last active February 22, 2016 22:15
// Init a new stateful session
KieSession kSession = kieContainer.newKieSession();
// Insert a placeholder for operations and statistics
TradingSession session = new TradingSession();
kSession.insert(session);
// We add an empty indicator to our stocks
quotations.forEach(quot -> quot.getIndicators().put("SCORE", new ScoreIndicator()));
// Submit each quotation and fire
for (AnalizedStockQuotation quot : quotations){
kSession.insert(quot);
kSession.fireAllRules();
}
// Recover results and clean up the memory
List<Operation> toReturn = session.getOperationList();
kSession.dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment