Show Table of Contents
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
Messageobject is created with the message text "Hello World" and the statusHELLOand 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.HelloWorldExamplein your Eclipse IDE. - Right-click the class and select
Run as...and thenJava application

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.