7 Managing EPL Rules

This section contains the typical application tasks you can perform with Oracle CEP Visualizer to manage EPL rules, including:

Note:

Oracle CQL replaces Event Processing Language (EPL) in Oracle CEP 11g Release 1 (11.1.1.4.0). Oracle CEP supports EPL for backwards compatibility. For more information, see Chapter 6, "Managing Oracle CQL Rules".

Note:

Any changes to rules and Oracle high availability adapters are propagated to the other servers in the same group. That is, all rule and and Oracle high availability adapter configurations is automatically synchronized. Other configuration changes are not synchronized. For example, if you change record/playback or JMS adapter configuration on one server in a multi-server domain, then these changes are not synchronized with the other servers in the same group. For more information, see Chapter 18, "Managing Multi-Server Domains"

For more information, see:

7.1 Creating a Rule in an EPL Processor

You can create a new rule in an existing Oracle CEP application that uses one or more EPL processors.

7.1.1 How to Create a Rule in an EPL Processor

You can create a rule in an EPL processor using the Oracle CEP Visualizer.

To create a rule in an EPL processor:

  1. In the left pane, navigate to and expand the Applications node of the Oracle CEP instance to which the application is deployed.

  2. Expand the appname > Stages node to see a list of the EPN stages in the domain tree, where appname is the name of the application.

  3. Click the EPL processor in which you want to create an EPL rule.

    The Processor panel is displayed as Figure 7-1 shows.

    Figure 7-1 EPL Processor Panel

    Description of Figure 7-1 follows
    Description of "Figure 7-1 EPL Processor Panel"

  4. In the right pane, click the Rules tab.

    The Rules tab appears as Figure 7-2 shows.

  5. Click in the Rule ID field and enter the name of the rule you want to create.

  6. Click in the Rule field and enter the EPL query string.

  7. Click Create Rule.

    A confirmation dialog appears as Figure 7-3 shows.

    Figure 7-3 Create Rule Dialog

    Description of Figure 7-3 follows
    Description of "Figure 7-3 Create Rule Dialog"

  8. Click OK.

7.2 Deleting a Rule From an EPL Processor

You can delete an existing rule in an existing Oracle CEP application that uses one or more EPL processors.

7.2.1 How to Delete a Rule in an EPL Processor

You can delete a rule in an EPL processor using the Oracle CEP Visualizer.

To delete a rule in an EPL processor:

  1. In the left pane, navigate to and expand the Applications node of the Oracle CEP instance to which the application is deployed.

  2. Expand the appname > Stages node to see a list of the EPN stages in the domain tree, where appname is the name of the application.

  3. Click the EPL processor in which you want to create an EPL rule.

    The Processor panel is displayed as Figure 7-1 shows.

    Figure 7-4 EPL Processor Panel

    Description of Figure 7-4 follows
    Description of "Figure 7-4 EPL Processor Panel"

  4. In the right pane, click the Rules tab.

    The Rules tab appears as Figure 7-5 shows.

  5. Decide what rules you want to delete:

    1. To delete a single rule:

    2. To delete all rules:

  6. Click OK.

7.3 Replacing a Rule in an EPL Processor

You can use the replace rule feature of Oracle CEP Visualizer to modify an existing rule. However, you should use this feature with extreme caution; this is because, internally, Oracle CEP Visualizer first deletes the rule and then adds it back again with the replaced text. The deletion of the rule causes all states to be lost before the rule is added again. For this reason, you should replace only stateless rules.

7.3.1 How to Replace a Rule in an EPL Processor

You can replace a rule in an EPL processor using the Oracle CEP Visualizer.

To replace a rule in an EPL processor:

  1. In the left pane, navigate to and expand the Applications node of the Oracle CEP instance to which the application is deployed.

  2. Expand the appname > Stages node to see a list of the EPN stages in the domain tree, where appname is the name of the application.

  3. Click the EPL processor in which you want to create an EPL rule.

    The Processor panel is displayed as Figure 7-1 shows.

    Figure 7-8 EPL Processor Panel

    Description of Figure 7-8 follows
    Description of "Figure 7-8 EPL Processor Panel"

  4. In the right pane, click the Rules tab.

    The Rules tab appears as Figure 7-5 shows.

  5. Select the rule you want to replace.

  6. Click in the Rule field and enter the new EPL query string.

  7. Click Replace Rule.

    A confirmation dialog appears as Figure 7-3 shows.

    Figure 7-10 Replace Rule Dialog

    Description of Figure 7-10 follows
    Description of "Figure 7-10 Replace Rule Dialog"

  8. Click OK.

7.4 Changing the dataservices Application Event Filter Rule Using EPL

The com.bea.wlevs.dataservices application includes the MonitorProcessor which in turn is associated with a default rule used to filter the events that are outputted to the diagnostic Dashboard. You can change this rule, or add new ones, if you want to customize this filtering.

You can only change the dataservices application event filter rule using EPL rules.

The event type used in an EPL rule is com.bea.wlev.dataservice.cep.DSMonitorEvent; it has the following properties:

  • profile—Name of the diagnostic profile.

  • date —Date and timestamp.

  • metric—Metric number.

  • start—Start stage name.

  • end—End stage name.

  • type—The type of metric; valid values are avg-latency, avg-throughput or max-latency.

  • application—Application name

For example, if you want to filter the monitoring events by type and metric, you might change the EPL rules to the following:

  SELECT * FROM DSMonitorEvent 
  RETAIN 1 EVENT 
  WHERE metric < 300 AND type = 'avg-latency'
  SELECT * FROM DSMonitorEvent 
  RETAIN 1 EVENT 
  WHERE metric < 300 AND type = 'avg-throughput'
  SELECT * FROM DSMonitorEvent 
  RETAIN 1 EVENT 
  WHERE metric < 300 AND type = 'max-latency'

If you want to continuously view three events where the number of metrics is less than 300 and group the events by type, try this EPL rule:

  SELECT *, COUNT(metric)
  FROM DSMonitorEvent
  RETAIN BATCH OF 3 EVENTS PARTITION BY type
  WHERE metric < 300
  HAVING COUNT(metric) = 3
  OUTPUT LAST 1 EVERY 3 EVENTS

If you want to continuously view three events where the average number of metrics is less than 300 and group the events by type, try this EPL rule:

  SELECT *, AVG(metric)
  FROM DSMonitorEvent
  RETAIN BATCH OF 3 EVENTS PARTITION BY type
  HAVING AVERAGE(metric) < 300
  OUTPUT LAST 1 EVERY 3 EVENTS

For more information, see Oracle Complex Event Processing EPL Language Reference.

7.4.1 How to Change the Dataservices Application Event Filter Rule Using EPL

You can change the dataservices application event filter EPL rule using the Oracle CEP Visualizer.

To change the dataservices application event filter rule using EPL:

  1. In the left pane, click Domain > Server > Applications > com.bea.wlevs.dataservices > Stages > MonitorProcessor, where Domain is the name of your domain and Server is the name of your server.

  2. In the right pane, click the Rules tab.

    The Rules tab appears as Figure 7-11 shows.

    Figure 7-11 EPL Rules Tab

    Description of Figure 7-11 follows
    Description of "Figure 7-11 EPL Rules Tab"

  3. To create a new Rule, enter a the name of the rule in the Rule ID field, enter the EPL query string in the Rule field, then click Create Rule.

    For more information, see Section 7.1, "Creating a Rule in an EPL Processor".

  4. To delete an existing rule, select a rule in the table and click Delete Rule.

    For more information, see Section 7.2, "Deleting a Rule From an EPL Processor".

  5. To change the default rule, click its name in the Rules table, make the change in the Rule field in the Working Area, and click Replace Rule.

    For more information, see Section 7.3, "Replacing a Rule in an EPL Processor".