Channel Component Configuration File Channel EPN Assembly File

Configuring Channels 9-19 wlevs:listener -- Create business object -- bean id=outputBean class=com.bea.wlevs.POC.citi.OutputBean autowire=byName wlevs:listener wlevs:channel beans 9-20 Oracle Complex Event Processing Developers Guide 10 Configuring Oracle CQL Processors 10-1 10 Configuring Oracle CQL Processors This section contains information on the following subjects: ■ Section 10.1, Overview of Oracle CQL Processor Configuration ■ Section 10.2, Configuring an Oracle CQL Processor ■ Section 10.3, Configuring an Oracle CQL Processor Table Source ■ Section 10.4, Configuring an Oracle CQL Processor Cache Source ■ Section 10.5, Example Oracle CQL Processor Configuration Files

10.1 Overview of Oracle CQL Processor Configuration

An Oracle CEP application contains one or more complex event processors, or processors for short. Each processor takes as input events from one or more adapters; these adapters in turn listen to data feeds that send a continuous stream of data from a source. The source could be anything, from a financial data feed to the Oracle CEP load generator. The main feature of an Oracle CQL processor is its associated Oracle Continuous Query Language Oracle CQL rules that select a subset of the incoming events to then pass on to the component that is listening to the processor. The listening component could be another processor, or the business object POJO that typically defines the end of the event processing network, and thus does something with the events, such as publish them to a client application. For more information on Oracle CQL, see the Oracle Complex Event Processing CQL Language Reference. For each Oracle CQL processor in your application, you must create a processor element in a component configuration file. In this processor element you specify the initial set of Oracle CQL rules of the processor and any optional processor configuration. You can configure additional optional Oracle CQL processor features in the Oracle CQL processor EPN assembly file. The component configuration file processor element’s name element must match the EPN assembly file processor element’s id attribute. For example, given the EPN assembly file processor element shown in Example 10–1 , the corresponding component configuration file processor element is shown in Example 10–2 . Note: Oracle CQL replaces Event Processing Language EPL in Oracle CEP 11g Release 1 11.1.1. Oracle CEP supports EPL for backwards compatibility. For more information, see Chapter 11, Configuring EPL Processors . 10-2 Oracle Complex Event Processing Developers Guide Example 10–1 EPN Assembly File Oracle CQL Processor Id: proc wlevs:processor id=proc wlevs:table-source ref=Stock wlevs:processor Example 10–2 Component Configuration File Oracle CQL Processor Name: proc processor nameprocname rules query id=q1[CDATA[ SELECT ExchangeStream.symbol, ExchangeStream.price, Stock.exchange FROM ExchangeStream [Now], Stock WHERE ExchangeStream.symbol = Stock.symbol ]]query rules procesor You can create a processor element in any of the following component configuration files: ■ The default Oracle CEP application configuration file by default, META-INFwlevsconfig.xml. ■ A separate configuration file. If your application has more than one processor, you can create a processor element for each of them in the default config.xml file, you can create separate XML files in META-INFwlevs for each, or create a single XML file in META-INFwlevs that contains the configuration for all processors, or even all components of your application adapters, processors, and channels. Choose the method that best suits your development environment. By default, Oracle CEP IDE for Eclipse creates one component configuration file and one EPN assembly file. When you create an Oracle CQL processor using Oracle CEP IDE for Eclipse, by default, the processor element is added to the default component configuration file META-INFwlevsconfig.xml file. Using Oracle CEP IDE for Eclipse, you can choose to create a new configuration file or use an existing configuration file at the time you create the Oracle CQL processor. Component configuration files are deployed as part of the Oracle CEP application bundle. You can later update this configuration at runtime using Oracle CEP Visualizer, the wlevs.Admin utility, or manipulating the appropriate JMX Mbeans directly. For more information, see: ■ Section 1.1.5, Component Configuration Files ■ Section 1.1.4, EPN Assembly File ■ Section 4.3, Creating EPN Assembly Files ■ Oracle Complex Event Processing Visualizer Users Guide ■ wlevs.Admin Command-Line Reference in the Oracle Complex Event Processing Administrators Guide ■ Configuring JMX for Oracle CEP in the Oracle Complex Event Processing Administrators Guide For more information on Oracle CQL processor configuration, see: ■ Section 10.1.1, Controlling Which Queries Output to a Downstream Channel Configuring Oracle CQL Processors 10-3 ■ Section 10.2, Configuring an Oracle CQL Processor ■ Section 10.3, Configuring an Oracle CQL Processor Table Source ■ Section 10.4, Configuring an Oracle CQL Processor Cache Source ■ Section 10.5, Example Oracle CQL Processor Configuration Files

10.1.1 Controlling Which Queries Output to a Downstream Channel

If you configure an Oracle CQL processor with more than one query, by default, all queries output their results to the downstream channel. You can control which queries may output their results to a downstream channel using the channel selector element to specify a space delimited list of query names that may output their results on this channel. You may configure a channel element with a selector before creating the queries in the upstream processor. In this case, you must specify query names that match the names in the selector. For more information, see Section 9.1.5, Controlling Which Queries Output to a Downstream Channel: selector .

10.2 Configuring an Oracle CQL Processor

You can configure a processor manually or by using the Oracle CEP IDE for Eclipse. See Section B.2, Component Configuration Schema wlevs_application_config.xsd for the complete XSD Schema that describes the processor component configuration file. See Section 10.5, Example Oracle CQL Processor Configuration Files for a complete example of an Oracle CQL processor component configuration file and assembly file. This section describes the following topics: ■ Section 10.2.1, How to Configure an Oracle CQL Processor Using Oracle CEP IDE for Eclipse ■ Section 10.2.2, How to Create an Oracle CQL Processor Component Configuration File Manually

10.2.1 How to Configure an Oracle CQL Processor Using Oracle CEP IDE for Eclipse

The most efficient and least error-prone way to create and edit a processor is to use the Oracle CEP IDE for Eclipse. Optionally, you can create and edit a processor manually see Section 10.2.2, How to Create an Oracle CQL Processor Component Configuration File Manually . To configure an Oracle CQL processor using Oracle CEP IDE for Eclipse: 1. Use Oracle CEP IDE for Eclipse to create a processor. See Section 6.4.1.3, How to Create a Processor Node . When you use the EPN editor to create an Oracle CQL processor, Oracle CEP IDE for Eclipse prompts you to choose either the default component configuration file or a new component configuration file. For more information, see Chapter 6, Oracle CEP IDE for Eclipse and the Event Processing Network .

2. Right-click the processor node and select Go to Configuration Source.

10-4 Oracle Complex Event Processing Developers Guide Oracle CEP IDE for Eclipse opens the appropriate component configuration file. The default processor component configuration is shown in Example 10–3 . The default processor component configuration includes a name element and rules element. Use the rules element to group the child elements you create to contain the Oracle CQL statements this processor executes, including: ■ rule: contains Oracle CQL statements that register or create user-defined windows. The rule element id attribute must match the name of the window. ■ view: contains Oracle CQL view statements the Oracle CQL equivalent of subqueries. The view element id attribute defines the name of the view. ■ query: contains Oracle CQL select statements. The query element id attribute defines the name of the query. The default processor component configuration includes a dummy query element with id Query. Example 10–3 Default Processor Component Configuration processor nameprocname rules query id=Query-- [CDATA[ select from MyChannel [now] ]] -- query rules processor 3. Replace the dummy query element with the rule, view, and query elements you create to contain the Oracle CQL statements this processor executes. For more information, see Introduction to Oracle CQL Queries, Views, and Joins in the Oracle Complex Event Processing CQL Language Reference.

4. Select File Save.

5. Optionally, configure additional Oracle CQL processor features in the assembly file: ■ Section 10.1.1, Controlling Which Queries Output to a Downstream Channel ■ Section 10.3, Configuring an Oracle CQL Processor Table Source ■ Section 10.4, Configuring an Oracle CQL Processor Cache Source

10.2.2 How to Create an Oracle CQL Processor Component Configuration File Manually

Although the most efficient and least error-prone way to create and edit a processor configuration is to use the Oracle CEP IDE for Eclipse see Section 10.2.1, How to Configure an Oracle CQL Processor Using Oracle CEP IDE for Eclipse , alternatively, you can also create and maintain a processor configuration file manually. This section describes the main steps to create the processor configuration file manually. For simplicity, it is assumed in the procedure that you are going to configure all processors in a single XML file, although you can also create separate files for each processor.