HowTo - First steps with OpenEngSB (Hello World aka Notification)

Note: At the moment OpenEngSB is only available as development release. Please refer to the Developer Setup HowTo for detailed instructions on building OpenEngSB.

Setting up the example

1. Start servicemix

2. Run quickrun.sh or mvn clean install and then scripts/deploy.sh

3. navigate to $SERVICEMIX_HOME/data/openengsb/rulebase/

create a new file called org/openengsb/notification1.rule and put this rule in it:

  when
    e : Event( name == name )
  then
    Notification n = new Notification();
    n.setSubject("My test notification");
    n.setMessage("Hello World!");
    n.setRecipient("email@example.com");
    notification.notify(n);

4. create the file "reload" in the rulebase-directory to force the directory to reload.

  touch reload

When the file is gone again, the rulebase has been reloaded.

5. Run the OpenEngSB testclient. (testclient.sh)

Enter the following values in the testclient and send the message in the testclient

  <?xml version="1.0" encoding="UTF-8"?>
  <XMLEvent>
    <className>org.openengsb.core.model.Event</className>
    <domain>notification</domain>
    <name>someEvent</name>
  </XMLEvent>

The rules are fired and as a consequence the notification domain becomes active. The domain selects a suitable connector (Email in our case) and passes the notification to the given recipient.

Alternativly you can setup the new rule using the testclient:

  <?xml version="1.0" encoding="UTF-8"?>
  <manageRequest>
    <name>
      <name>test</name>
      <packageName>org.openengsb</packageName>
      <type>Rule</type>
    </name>
    <code>here comes the rule</code>
  </manageRequest>

Select the droolsService as destination, and type "create" as operation. You could use this rule to create email notifications. The rule will be activated on any incoming event. (e.g. quickrun timer)

Coming up next

The Issue ticket example shows how to use a different domain. It is also a good starting point for customizing OpenEngSB.