18.22. Debugging as a JBoss Rules Application

Procedure 18.8. Task

  1. Open the DRL Editor.
  2. Select the main class of your application.
  3. Right-click on it and select the Debug As > sub-menu and select JBoss Rules Application.
    Alternatively, you can also select the Debug ... menu item to open a new dialog for creating, managing and running debug configurations.
  4. Select the Drools Application item in the left tree and click the New launch configuration button (leftmost icon in the toolbar above the tree). This will create a new configuration with some of the properties already filled in based on the main class you selected in the beginning.
  5. Change the name of your debug configuration to something meaningful. You can accept the defaults for all other properties.
  6. Click the Debug button on the bottom to start debugging your application. You only have to define your debug configuration once. The next time you run your JBoss Rules application, you can select the previously defined configuration in the tree as a sub-element of the JBoss Rules tree node, and then click the JBoss Rules button. The Eclipse toolbar also contains shortcut buttons to quickly re-execute one of your previous configurations.
Result

After clicking the Debug button, the application starts executing and will halt if any breakpoint is encountered. Whenever a JBoss Rules breakpoint is encountered, the corresponding DRL file is opened and the active line is highlighted. The Variables view also contains all rule parameters and their value. You can then use the default Java debug actions to decide what to do next: resume, terminate, step over, and so on. The debug view can also be used to inspect the contents of the Working Memory and the Agenda at that time as well. You don't have to select a Working Memory as the current executing working memory is automatically shown.