Drools KnowledgeBase Deprecated

前端 未结 1 1547
慢半拍i
慢半拍i 2021-02-05 13:29

I am integrating the Drools Rules engine into my application. 99% of the examples I have found to get started look like:

KnowledgeBuilder kbuilder = KnowledgeBui         


        
相关标签:
1条回答
  • 2021-02-05 13:59

    This is the code I've found to work with 6.x:

        KieServices kieServices = KieServices.Factory.get();
        KieFileSystem kfs = kieServices.newKieFileSystem();
        FileInputStream fis = new FileInputStream( pathToSomeDrl );
        kfs.write( "src/main/resources/simple.drl",
                    kieServices.getResources().newInputStreamResource( fis ) );
        KieBuilder kieBuilder = kieServices.newKieBuilder( kfs ).buildAll();
        Results results = kieBuilder.getResults();
        if( results.hasMessages( Message.Level.ERROR ) ){
            System.out.println( results.getMessages() );
            throw new IllegalStateException( "### errors ###" );
        }
        KieContainer kieContainer =
            kieServices.newKieContainer( kieServices.getRepository().getDefaultReleaseId() );
        KieBase kieBase = kieContainer.getKieBase();
        KieSession kieSession = kieContainer.newKieSession();
    

    References to KnowledgeBase have remained in the documentation, but it is indeed deprecated.

    0 讨论(0)
提交回复
热议问题