final KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.addResource( new InputStreamReader( FibonacciExample.class.getResourceAsStream( "Fibonacci.drl" ) ),
KnowledgeType.DRL );
final KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages( builder.getKnowledgePackages() );
<BUG>final StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();
session.insert( new Fibonacci( 10 ) );
session.fireAllRules();
session.dispose(); // Stateful rule session must always be disposed when finished</BUG>
}

final KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.addResource( new InputStreamReader( FibonacciExample.class.getResourceAsStream( "Fibonacci.drl" ) ),
KnowledgeType.DRL );
final KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages( builder.getKnowledgePackages() );
final StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();
final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( session );
logger.setFileName( "log/fibonacci" );
session.insert( new Fibonacci( 10 ) );
session.fireAllRules();
logger.writeToDisk();
session.dispose(); // Stateful rule session must always be disposed when finished
}
