-
Language:
English
-
Language:
English
19.4. HelloWorld Example: Execution
final Message message = new Message(); message.setMessage("Hello World"); message.setStatus(Message.HELLO); ksession.insert(message); ksession.fireAllRules(); logger.close(); ksession.dispose();
- A single
Message
object is created with the message text "Hello World" and the statusHELLO
and then inserted into the engine, at which pointfireAllRules()
is executed. - All network evaluation is done during the insert time. By the time the program execution reaches the
fireAllRules()
method call the engine already knows which rules are fully matches and able to fire.
Note
To execute the example as a Java application:
- Open the class
org.drools.examples.helloworld.HelloWorldExample
in your Eclipse IDE. - Right-click the class and select
Run as...
and thenJava application