How to handle multiple types of events using the same Preprocessor RuleFunction.

How to handle multiple types of events using the same Preprocessor RuleFunction.

book

Article ID: KB0088743

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:

How to handle multiple types of events using the same Preprocessor RuleFunction.

Issue/Introduction

How to handle multiple types of events using the same Preprocessor RuleFunction.

Resolution

void rulefunction RuleFunctions.Loader.TxnsEnvPreprocessor {

       attribute {

              validity = ACTION;

       }

       scope {

              Event eve;

       }

       body {

              if (eve instanceof Events.Core.Transaction) {

                     Events.Core.Transaction txn = eve;

                     System.debugOut("Transaction received:" + txn.TranType);

              }

              else if (eve instanceof Events…) {

              }             

}

+++++++++++++++++++++++

The other option would be to use inheritance in a similar fashion. Inheritance is demonstrated in the FraudDetection example project as well.

Additional Information

BE Getting Started guide > Chap. 2 > Project Design Tutorial.