Controlling Which Queries Output to a Downstream Channel: selector

Configuring Channels 9-7 The most efficient and least error-prone way to create and edit a channel configuration in the default component configuration file is to use the Oracle CEP IDE for Eclipse. Optionally, you can create a channel configuration file manually see Section 9.2.3, How to Create a Channel Component Configuration File Manually . For more information, see: ■ Section 9.1.3, System-Timestamped Channels ■ Chapter 6, Oracle CEP IDE for Eclipse and the Event Processing Network To configure a channel using Oracle CEP IDE for Eclipse: 1. Use Oracle CEP IDE for Eclipse to create a channel. See Section 6.4.1.1, How to Create a Basic Node . 2. Optionally, override the default channel assembly file configuration by adding additional wlevs:channel attributes and child elements:

a. Right-click the channel node and select Go To Assembly Source.

b. Add the appropriate wlevs:channel attributes. Required attributes include: – id – event-type In particular, specify whether this channel is a stream or relation by configuring attribute is-relation: – To specify this channel as stream , set is-relation to false default. – To specify this channel as a relation, set is-relation to true. If you specify this channel as a relation, you must also configure the chan- nel attribute primary-key. See Table C–9, Attributes of the wlevs:channel Application Assembly Element . c. Add the appropriate wlevs:channel child elements. – Appendix C.17, wlevs:instance-property – Appendix C.18, wlevs:listener – Appendix C.21, wlevs:property – Appendix C.22, wlevs:source 3. In the Project Explorer, expand your META-INFwlevs directory. 4. Choose the component configuration file you want to use: a. To use the default component configuration file, right-click the META-INFwlevsconfig.xml file and select Open With XML Editor. The file opens in an XML Editor. b. To create a new component configuration file: – Right-click the wlevs directory and select New File. The New File dialog appears. – Enter a file name. 9-8 Oracle Complex Event Processing Developers Guide You can name the file anything you want but the name of the file must end in .xml. – Click Finish. Oracle CEP IDE for Eclipse adds the component configuration file to the wlevs directory.

5. Right-click the component configuration file you chose to use and select Open

With XML Editor . The file opens in an XML Editor. 6. If you created a new component configuration file, add the header and config element shown in Example 9–8 . Otherwise, proceed to step 7. Example 9–8 Component Configuration File Header and config Element ?xml version=1.0 encoding=UTF-8? n1:config xsi:schemaLocation=http:www.bea.comnswlevsconfigapplication wlevs_application_config.xsd xmlns:n1=http:www.bea.comnswlevsconfigapplication xmlns:xsi=http:www.w3.org2001XMLSchema-instance config 7. Add a channel element for the channel as Example 9–9 shows. Example 9–9 Component Configuration File Channel Element ?xml version=1.0 encoding=UTF-8? n1:config xsi:schemaLocation=http:www.bea.comnswlevsconfigapplication wlevs_application_config.xsd xmlns:n1=http:www.bea.comnswlevsconfigapplication xmlns:xsi=http:www.w3.org2001XMLSchema-instance processor ... processor ... channel channel config 8. Add a name child element to the channel element. The name element value must match the corresponding EPN assembly file channel element’s id attribute. For example, given the EPN assembly file channel element shown in Example 9–10 , the corresponding configuration file channel element is shown in Example 9–11 . Example 9–10 EPN Assembly File Channel Id: priceStream wlevs:channel id=priceStream event-type=PriceEvent wlevs:listener ref=filterFanoutProcessor wlevs:source ref=PriceAdapter wlevs:channel Example 9–11 Component Configuration File Channel Name: priceStream channel namepriceStreamname Configuring Channels 9-9 channel 9. Optionally, override the default channel configuration by adding additional channel child elements: ■ Add a max-threads child element to specify the maximum number of threads that Oracle CEP server uses to process events for this channel. Setting this value has no effect when max-size is 0. The default value is 0. channel namepriceStreamname max-threads2size channel When set to 0, the channel acts as a pass-through. When max-threads 0, the channel acts as classic blocking queue, where upstream components are producers of events and the downstream components are the consumers of events. The queue size is defined by the configuration max-size. There will be up to max-threads number of threads consuming events from the queue. ■ Add a max-size child element to specify the maximum size of the channel. Zero-size channels synchronously pass-through events. Non-zero size channels process events asynchronously, buffering events by the requested size. The default value is 0. channel namepriceStreamname max-size10000size channel ■ Add a heartbeat child element to specify the number of nanoseconds a channel can be idle before Oracle CEP generates a heartbeat event to advance time. The heartbeat child element applies to system-timestamped relations or streams only when no events arrive in the event channels that are feeding the processors and the processor has been configured with a statement that includes some temporal operator, such as a time-based window or a pattern matching with duration. channel nameMatchOutputChannelname heartbeat10000heartbeat channel ■ Add a selector child element to specify which up-stream Oracle CQL processor queries are permitted to output their results to the 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, Section 9.1.5, Controlling Which Queries Output to a Downstream Channel: selector . Caution: Identifiers and names in XML files are case sensitive. Be sure to specify the same case when referencing the components identifier in the EPN assembly file.