This documentation is for WSO2 Business Rules Server 2.1.0.View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »


This sample demonstrates how to use the BRS for a simple greetings service.


Before building the sample, the following needs to be done:

Sample Rule Definition


Rule 1 : If the time is between 12 and 18, say good afternoon.

Rule 2 : If the time is between 6 and 12, say good morning.

Rule 3 : If the time is between 18 and 24, say good night.


There is one fact named A user logged in into the system and a result named GreetingMessage.

package samples.greeting;
import java.util.Calendar;

 * User
public class User {
    private String name ;

    public String getName() {
        return name;
    public void setName(String name) { = name;
    public int now(){
        Calendar cal = Calendar.getInstance();
        return cal.get(Calendar.HOUR_OF_DAY);
package samples.greeting;
 * greeting message
public class GreetingMessage {
    private String message ;
    public String getMessage() {
        return message;
    public void setMessage(String message) {
        this.message = message;


Building the sample


Executing the sample


Analyzing the output

  • No labels