5 Channels
A channel represents the logical conduit through which events flow between other types of components (stages). For example, between adapters and Oracle CQL processors or between Oracle CQL processors and event beans.
This chapter includes the following sections:
5.1 When to Use a Channel
Channels provide buffering, queuing, and concurrency capabilities that enable you to tune the performance of your application later in the design life cycle.
By default, the channel max-threads
attribute is set to 0, which means the channel is in pass-through
mode and incurs no performance penalty.
When constructing your EPN, consider the following rules:
-
A channel is mandatory when you connect an Oracle CQL processor to a downstream stage.
-
A channel is mandatory when you connect a stream or relation to an Oracle CQL processor.
Note that based on the previous two points, it is mandatory to have a channel between an adapter and a processor. When you use Oracle JDeveloper to connect an adapter to a processor, the channel wizard displays for you to create the channel.
-
A channel is optional when you connect any of the following components to an Oracle CQL processor: an external relation, cache, or table source.
A channel is not needed between a pull source, such as a cache or table, and a processor because the pull source represents an external relation. For an external relation, the only valid operation is a join between a stream and a NOW window operator, and hence it is considered a pull source. The join actually happens outside of the Oracle CQL processor. Because it is a pull, the Oracle CQL processor does not need to be aware of its shape (that is, no DDL is required) and does not need the channel to act as intermediary.
In general, use a channel between components when:
-
Buffering is needed between the emitting component and the receiver.
-
Queueing or concurrency is needed for the receiving component.
-
If a custom adapter is used and thread control is necessary.
5.2 Channel Configuration
When you add a channel to your Event Processing Network (EPN), it has a default configuration. The default channel has a name, an ID, is a system time-stamped stream channel, and has a default heartbeat time out of 100 milliseconds or 100,000,000 nanoseconds.
The default configuration is adequate for most applications.You can modify the configuration by editing the application assembly file or by editing the component configuration file.
When a channel is time stamped by the system, Oracle Stream Analytics assigns a new time from the CPU clock when a new event arrives and when the configurable heartbeat time out expires.
When a channel is time stamped by an application, the time stamp of an event is determined by the wlevs:expression
element. A common example of an expression is a reference to a property on the event. If no expression is specified, then the time stamp can be propagated from a prior event. For example, when a channel that is time stamped by the system from one Oracle CQL processor feeds events into a channel that is time stamped by an application of another downstream Oracle CQL processor. In addition, an application can use the StreamSender.sendHeartbeat
method to send an event of type heart-beat
downstream to StreamSink
listeners in the EPN.
Note:
When a channel is both application time stamped and map-based (uses a hash map event type), Oracle Stream Analytics adds a time stamp. A delete or update operation without a key does not work on a channel with this configuration because application time stamped events hold an always changing timestamp
property.
This chapter describes some of the assembly and configuration file channel settings.
5.2.1 Assembly File
The assembly file shows the channel settings for the helloworldInputChannel. The settings indicate that helloworldProcessor listens to the channel for events, and that events flow into the channel from helloworldAdapter.
<wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
<wlevs:listener ref="helloworldProcessor"/>
<wlevs:source ref="helloworldAdapter"/>
</wlevs:channel>
To configure the channel as a relation, add the is-relation
setting to the assembly file as follows:
<wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent"
is-relation="true" primary-key="myprimarykey" />
If you make the channel a relation, you must also configure
the primary-key
attribute. The primary key is a list
of event property names separated by white space or a comma that uniquely
identifies each event.
To configure the channel to be application time stamped,
add the application-timestamped
and expression
elements to the assembly file as follows. When you set the is-total-order
element to true
, the application
time published is always strictly greater than the last value used.
<wlevs:application-timestamped is-total-order="true">
<wlevs:expression>mytime+10</wlevs:expression>
</wlevs:application-timestamped>
5.2.2 Configuration File
The configuration file shows the channel configuration settings. The settings customize the channel to buffer process events asynchronously (max-size
), to use a maximum of 4 threads (max-threads), and to use a heartbeat time out of 10000 nanoseconds (heartbeat).
<channel> <name>helloworldInputChannel</name> <max-size>10000</max-size> <max-threads>4</max-threads> <heartbeat>10000</name> </channel>
5.3 Control Which Queries Output to a Downstream Channel
If you configure an Oracle CQL processor with more than one query, then by default, all queries send their results to the downstream channel. You can control which queries send their results to the downstream channel with the selector
element.
Figure 5-1 shows an EPN with channel filteredStream
connected to the upstream Oracle CQL processor, filteredFanoutProcessor
.
Figure 5-1 EPN With Oracle CQL Processor and Downstream Channel

Description of "Figure 5-1 EPN With Oracle CQL Processor and Downstream Channel"
The following example shows the queries configured for the Oracle CQL processor.
<processor> <name>filterFanoutProcessor</name> <rules> <query id="Yr3Sector"><
Description of "Figure 5-2 EPN with Oracle CQL Processor and Downstream Channel"
Security
Secure Sockets Layer (SSL) is used to secure network traffic between the distributed EPN nodes.
Configuration
You must configure the Oracle CQL Processor to support local partitioning. See Define a Local Partition Channel and Configure an Oracle CQL Processor for Parallel Query Execution.
Examples
Here are a few examples of a simple EPN:
Example 5-1 EPN Example 1
An event is defined as the relation P of any pair (PN, PV), representing property names and property values. For the purpose of this document, there is no need to define the domain of property names and property values.
EPN1 = ({adapter1, channel1, processor, channel2, adapter2},
{(adapter1,channel1), (channel1, processor), (processor, channel2), (channel2, adapter2)})
Example 5-2 EPN Example 2
As an EPN node may contain more than one event, we define the set E as an ordered sequence of events.
Note:
E is ordered which is different from other cases.The runtime state S = (N,E) of the EPN can thus be presented as a two-place relation from N to E. Note that the relation S is not injective, meaning that the same event(s) may be present in more than one node. However, it is surjective, as all events of the total set of events in the EPN must be in at least one node.
e1 = {(price, 10), (volume, 200), (symbol, 'ORCL')}
e2 = {(p1, v1), (p2, v2), (p3, v3)}