Modifying context definition conditions

By using the Context Definition editor, you can modify the conditions for a context definition and add or delete events that are included in the context. You can set or modify the default verbalization, the events list, the context identifier, the termination conditions, and the context retention time.

Procedure

  1. In the Event Explorer view, click to expand the assets folder and the context definitions asset category, then double-click the context definition name.
  2. In the Context Definition editor, you can modify the default verbalization of the context definition. Place the edit cursor in the Phrase field and edit or type over the default verbalization. You can also remove the verbalization, but when you write event rules, you must select the verbalization to set the context definition in the Rule editor. Therefore, if you remove the verbalization, you cannot associate any rules with the context definition.
  3. In the Events in this Context section, you can add or remove events from the context definition, sort the list of events, set the context identifier, or modify the Terminate After setting for each event.
    1. To add more participating events to the context definition, click Add Event, then select an event from the list. You can also set the context identifier and the Terminate After setting when you add an event.

      You can add participating events that do not invoke any rules. This allows your application to make decisions based on the occurrence of a particular event even though the event has no specific rule processing associated with it.

    2. To set the Terminate After option for an event, select the event name in the event table, then click Edit. You can enable the Terminate After setting to specify when the context ends. By default, the value of the Terminate After setting for events that participate in the context definition is no. This means that when the event is complete and the event is processed by the event runtime, the context remains active, and additional information can be added to the context.

      If you change the Terminate After setting for an event to yes, then the context ends when the event is complete and the event runtime finishes processing the event and sending any actions related to the event. Rules and actions for a terminating event must be processed at the time of the event, which means that the processing cannot be delayed to a later time. Additional limitations apply to events when the Terminate After setting is enabled, as described in the Results section.

    3. To change the order of the events in the event table, click the Event Name column header. The sort options are: ascending by event name, descending by event name, or no sort order. You can also sort the events according to the context identifier.
    4. You can set or modify the context identifier for an event in the event table. Select the event name in the event table, then click Edit. Using the context identifier list, select a parameter or business object field to identify the context, then click Finish.
  4. In the Termination section, you can set an end time, such as an interval or a duration, for the context. The default termination setting is Don't end by time, which means that the context continues indefinitely, or until a terminating event is processed.

    There are two ways to end a context: you can terminate the context at a specific time (duration or interval), or you can specify one or more specific events as terminating events. If both a termination time and terminating events are included in the context definition, then the context ends when any one of the termination criteria occurs.

    To set the termination time for a context, select one of the following termination options, then click Edit to set the time duration or interval.

    Don't end by time
    This option is the default. The context ends when a terminating event is complete, not at a specific time.
    End after a duration of time
    The context ends when the specified number of weeks, days, hours, or minutes has elapsed from the time of the first event in the context instance.
    End after a duration of inactivity
    If no events or actions are processed within the specified number of weeks, days, hour, or minutes, the context ends.
    End on every repeating interval
    The context ends on the specified day of the week and time of day. The smallest time interval is hourly, at a specified number of minutes past the hour. You can also set a repeating termination interval to occur on a specific day of the month, or the last day of the month.
  5. In the Retention section, you can select the Retain state information for specified amount of time option. By default, the option is not selected, so the context state information is deleted when the context ends, or when the state is no longer relevant, for example if the time specified in the rule expression has expired.

    For performance reasons, you can specify a retention period which is shorter than the life of the context. When you select the retain time option, the state information is deleted after the specified amount of time. For example, if the context remains active for 24 hours, but your application needs to reference the context state information for only 1 hour, you can set the retention time to 1 hour. This means that the context state information is deleted after 1 hour, even though the context remains active. If the Retain state information for specified amount of time option is not set in the context definition, then the system-wide retention setting is used. See Pruning the context table automatically.

    Context information older than the retention period is deleted unless a rule expression includes a specific time. A rule expression such as past occurrences of my event within 1 week in a rule or filter causes the context data to be retained for a week even if the default retention setting is 5 days. The default retention setting is applied to an open-ended expression such as past occurrences of my event.

Results

The following limitations apply to an event, and the rule that references the event, when Terminate After is set to yes in the context definition.
  • The rule cannot fire an action with a result event that participates in the same context definition.
  • The rule cannot be delayed.
  • The rule cannot fire a delayed action.
  • The rule cannot fire a synthetic event that participates in the same context definition.