KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kBuilder.add( new ByteArrayResource( droolsSource.getBytes() ), ResourceType.DRL );
assertFalse(kBuilder.getErrors().toString(), kBuilder.hasErrors());
final RuleBaseConfiguration conf = new RuleBaseConfiguration();
conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.EQUALITY );
conf.setSequentialAgenda( RuleBaseConfiguration.SequentialAgenda.SEQUENTIAL );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( conf );
kbase.addKnowledgePackages( kBuilder.getKnowledgePackages() );
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();