Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Updating the Event Preprocessor

Procedure
1. In TIBCO BusinessEvents Studio, open the RuleFunctions > PreProcessor rule function.

2. Click the Source tab at the bottom of the editor to work in the Source view.

   In the Project Design Tutorial you worked in the Form view. You could stay in that view, but it’s good to become familiar with both views.

3. In the Scope section, replace `Event request`with `Events.AccountOperations request`. The section looks like the following:

          scope {
             Events.AccountOperations request;
          }

   The reason you have to narrow the scope is that the base Event class does not have an `AccountId` property, so it cannot be used in the function you’ll add in the next step.

4. In the Body section, add two new lines (shown in bold), just before the closing bracket:

          body {
             // Replies to the request event, in order to close the HTTP request.
             // To keep it simple, uses the request event as the response.
             Event.replyEvent(request, request);
             // Attempts to load any existing matching account.
             Cluster.DataGrid.CacheLoadConceptByExtIdByUri(request.AccountId, false, "/Concepts/Account");
          }

   The `Cluster.DataGrid.CacheLoadConceptByExtIdByUri()` function loads any matching items from the cache into the Rete network. In this case, it loads any concept whose `ExtId` matches the `AccountId` in the incoming event.

   Note: For legacy ID lookup implementations, use the Cluster.DataGrid.CacheLoadConceptByExtId(request.AccountId, false) function.

   For details about legacy ID and enabling it for a project, see Primary Key Strategies.

   The loading is done before the event is asserted, so the Rete network will contain any matching Account concepts. The `BadCreateAccount` rule then fires and as in the Project Design Tutorial, to prevent creation of duplicate accounts.

ResultYou have modified the basic FraudDetection project to load instances from the cache into the Rete network using an event preprocessor. This enables the project code to check for existing instances first, when creating new ones.
What to do nextNext you will work in the Cluster Deployment Descriptor to create two agents of different types.

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.