Here is the Code Snippet:

            currentTimeStamp = getCurrentTimeStamp(tuple, schArray);// the method will the timestamp of the tuple 
            this.clock.advanceTime(currentTimeStamp - clock.getCurrentTime(), TimeUnit.MILLISECONDS);

I use Pseudoclock. The events are fed into the engine as stream of data.

2009/7/2 Edson Tirelli <>

   Since you are not declaring to the rules engine what is the timestamp attribute, the engine uses the timestamp of the session clock at event insertion. What kind of session clock are you using? how are you firing your rules (fireAllRules() or fireUntilHalt())? How frequently are you feeding the events into the working memory?


2009/7/2 PriyaSha <>


To identify those tickets with "critical" severity  which occurs after
2minutes but before 5minutes of a ticket with severity 'warning', provided
both are of different application name.

This rule though not meaningful, is considered to understand the temporal

This is the rule:

declare OMNewTicket
   @role( event )
   @expires (10m)

rule "Sample Temporal"
salience 10
no-loop true
       $ticket : OMNewTicket(severity == "warning", $appName : appName)
       $ticket1 : OMNewTicket(this after[2m, 5m] $ticket, severity == "critical",
appName != $appName)
       String $s = "";
       String $s1 = "";
       if ( $ticket != null) {
               $s = formatDate($ticket.getReceivingTime());
       if ( $ticket1 != null ) {
               $s1 = formatDate($ticket1.getReceivingTime());
       drools.getWorkingMemory().setGlobal( "output", "found");
       drools.getWorkingMemory().setGlobal( "output1", $s);
       drools.getWorkingMemory().setGlobal( "output2", $s1);

function String formatDate( String inputDate ) {
   try {
       DateFormat formatter = new SimpleDateFormat("MM/dd/yy:hh:mm:aaa");
       Date date = (Date)formatter.parse(inputDate);
       return date.toString();
   } catch (ParseException e) {
       System.out.println("Exception :"+e);
       return null;


14178           10/25/2008:9:33:AM              critical                TCS_Tibco_AMS_Email
14178           10/25/2008:9:49:AM              warning         NETLOGON
14178           10/25/2008:9:58:AM              warning         NETLOGON
14178           10/25/2008:10:00:AM             warning         crypt32
14178           10/25/2008:10:00:AM             warning         crypt32
14178           10/25/2008:10:00:AM             warning         crypt32
14178           10/25/2008:10:03:AM             warning         crypt32
14178           10/25/2008:10:04:AM             warning         Symantec
14178           10/25/2008:10:05:AM             critical                Windows SharePoint Services 3
14178           10/25/2008:10:08:AM             critical                OVIS
14178           10/25/2008:10:10:AM             critical                Office SharePoint Server
14225           12/11/2008:3:25:AM              warning         ASBDSM
14225           12/11/2008:3:25:AM              warning         WinDiskSpace
14225           12/11/2008:3:25:AM              critical                OVIS
14225           12/11/2008:3:30:AM              normal          OVIS
14225           12/11/2008:3:34:AM              critical                TCS_Tibco_AMS_Email

Status         Time of Ticket            Timestamp of  Ticket1  Time (Clock)
found               Sat Oct 25 10:00:00    Sat Oct 25 10:05:00    Sat Oct 25
found               Sat Oct 25 10:00:00    Sat Oct 25 10:08:00    Sat Oct 25
found               Sat Oct 25 10:04:00    Sat Oct 25 10:10:00    Sat Oct 25
found               Thu Dec 11 03:25:00   Thu Dec 11 03:34:00 Thu Dec 11

Here Time of Ticket is output1 from rule and Timestamp of  Ticket1 is
output2 of the consequence.

Problem :

The output  'found               Thu Dec 11 03:25:00   Thu Dec 11 03:34:00
Thu Dec 11 03:34:00 ' is not satisfying the rule condition.
After first three output, there are no tuples matching the criteria
mentioned. Unable to predict the occurence of this in the output.

May I know what i miss here?

View this message in context:
Sent from the drools - user mailing list archive at

rules-users mailing list

 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @

rules-users mailing list