Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Rule Functions

A rule function is a function written in the TIBCO BusinessEvents rule language. All rule functions created for a project are available project-wide.

Rule functions can take arguments and can return a value. The return type can be set to void, indicating that the rule function does not return anything. Like other types of functions, you can use rule functions in rule conditions and rule actions.

You can use project settings to use rule functions as preprocessors (see Event Preprocessors and as startup and shutdown actions.

## Virtual Rule Functions and Decision Tables

A Virtual Rule Function (VRF) has arguments but no body or return type. The implementation of a virtual rule function is a decision table. Decision tables can also be created in the TIBCO BusinessEvents user interface.

Users start by selecting a VRF. They drag and drop entities from an argument explorer to form rows in a decision table. Each row forms a business rule, for example the condition area might specify that age is less than 18, and the action area might specify that credit is refused. More technical users can use the TIBCO BusinessEvents rule language to create more complex rules.

One VRF can have multiple implementations. You can set a priority that determines the order of execution for multiple implementations of a VRF. Functions are also available for choosing an implementation to execute (and other actions specific to decision tables). If there is just one implementation, you can call the virtual rule function in the same way you call any other rule function.

## Startup and Shutdown Rule Functions

Startup and shutdown rule functions are rule functions that are configured to execute during normal system startup and shutdown, respectively.

Startup and shutdown rule functions take no arguments and their Validity setting must be Action (meaning they cannot be used in conditions or queries).

Tip: See Engine Startup and Shutdown Sequence in TIBCO BusinessEvents Administration. Understanding this sequence helps you understand what you can do in startup and shutdown actions.
Startup Rule Functions
Startup rule functions are optional and are used to initialize the system. For example they can provide initial values for scorecards. Startup rule functions can be used to perform more "expensive" operations so that the system is more efficient at runtime. For example, in a startup rule function you might load specified entities from the backing store to the cache.
Startup rule functions may trigger rule actions. However, note that TIBCO BusinessEvents executes all startup rule functions before it begins the first RTC cycle, which completes when all rules eligible to execute have executed and no more actions remain.
Shutdown Rule Functions
Shutdown rule functions are optional and are used to perform various actions during a normal shutdown, for example, they can send events to external systems.

## When Startup Rule Functions Execute

Startup rule functions execute on startup of an active node.

In recovery situations, startup rule functions execute on failback to a failed node that has restarted. However, if recovery is from a situation that does not involve node failure, then startup actions do not execute. For example, the network connection goes down. The agent becomes inactive and fails over to another node. The connection is restored. The agent becomes active again, but does not restart. Startup functions do not execute on the node that became active again.

If you want to execute startup rule functions on only one node in a deployment, use programming logic to do so.

## Creating Entities With a Startup Action in a Multi-Engine Project

Startup (and shutdown) rule functions execute in all active agents. When multi-engine (multi-agent) functionality is used, ensure that multiple agents do not attempt to create the same entity.

## ActiveMatrix BusinessWorks Containers

In ActiveMatrix BusinessWorks integration projects, if ActiveMatrix BusinessWorks is running as the container, do not specify any startup actions that result in starting or invoking an ActiveMatrix BusinessWorks process.

Note that after the ActiveMatrix BusinessWorks engine is initialized, processes that invoke TIBCO BusinessEvents rule functions will fail if the TIBCO BusinessEvents engine has not finished starting up. For example, an ActiveMatrix BusinessWorks process that listens to a JMS queue may attempt to invoke a TIBCO BusinessEvents rule function before the TIBCO BusinessEvents engine has started up.

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.