Drools, as of Version 5.1, provides out-of-the-box integration with the Spring framework. As we've seen in previous chapters, it comes with a custom drools-spring namespace, which is part of the drools-spring module. This section will be an overview of this namespace.
The drools-spring namespace allows us to define and configure knowledge bases, stateless and stateful sessions, listeners, groups of listeners, and custom accumulate functions including advanced features such as session persistency and others. See the Drools integration documentation for the full listing.
Furthermore, we can work with defined sessions through the command interface. Commands can be entered through the drools:batch
element. These commands will then be performed on the session. We can set globals, insert facts, issue fire-all-rules call, start a process, or signal events.
An example XML file that uses the drools-spring namespace is explained in Code listing 11. It will create a validationKnowledgeBase...