Foreign Stages Components of the Oracle CEP Event Processing Network

1-6 Oracle Complex Event Processing Developers Guide wlevs:stream Example 1–4 Foreign Stage in Application 2 wlevs:event-bean id=HelloWorldBeanSource class=com.bea.wlevs.example.helloworld.HelloWorldBeanSource advertise=true The following stages cannot be foregin stages: ■ Cache When creating Oracle CEP applications with foreign stages, you must consider foreign stage dependencies when assembling, deploying, and redeploying your application. For more information, see Section 24.2.3, Assembling Applications With Foreign Stages .

1.1.2 Oracle CEP Event Types

Event types define the properties of the events that are handled by Oracle CEP applications. Adapters receive incoming events from different event sources, such as the Java Messaging System JMS, or financial market data feeds. You must define an Oracle CEP event type for these events before a processor is able to handle them. You then use these event types in adapter and POJO Java code, and in the Oracle CQL and EPL rules you associate with the processors. Events are JavaBean or Java class instances in which each property represents a data item from the event source. Oracle CEP supports a variety of event type implementations. For more information, see Chapter 2, Overview of Oracle CEP Events .

1.1.3 Transmitting Events in the EPN: Stream and Relation Sources and Sinks

All components in an EPN either produce events or consume events. Some components can do both, such as an event bean in the middle of an EPN that receives events from an upstream component, such as an adapter, and then sends events to a downstream component, such as a processor. Components can act on the events they receive from an upstream component, pass events on to a downstream component, and create new events and insert them into an upstream or downstream channel. In general, predefined components such as JMS and HTTP publish-subscribe adapters, channels, and processors all implement the required interfaces to operate as stream and relation sources and sinks. You can use them as is or configure their behavior using the EPN assembly file. For custom adapters, event beans, and Spring beans, you must implement the appropriate interfaces to use these components as stream and relation sources and sinks. This section describes: ■ Section 1.1.3.1, Streams and Relations ■ Section 1.1.3.2, Stream and Relation Sources ■ Section 1.1.3.3, Stream and Relation Sinks ■ Section 1.1.3.4, Transmitting Events in the EPN: Examples Overview of Creating Oracle CEP Applications 1-7 For more information, see Section 1.1.9.6, User Action: Calling Methods of Stream and Relation Sources and Sinks .

1.1.3.1 Streams and Relations

Oracle CEP models event flow as either streams or relations: ■ A stream S is a bag multi-set of elements s,T where s is in the schema of S and T is in the time domain. Stream elements are tuple-timestamp pairs, which can be represented as a sequence of timestamped tuple insertions. In other words, a stream is a sequence of timestamped tuples. There could be more than one tuple with the same timestamp. The tuples of an input stream are required to arrive at the system in the order of increasing timestamps. You specify a channel as a stream by setting EPN assembly element wlevs: attribute is-relation to false the default. ■ A relation is an unordered, time-varying bag of tuples: in other words, an instantaneous relation. At every instant of time, a relation is a bounded set. It can also be represented as a sequence of timestamped tuples that includes insertions, deletions, and updates to capture the changing state of the relation. You specify a channel as a relation by setting EPN assembly element wlevs:channel attribute is-relation to true. For more information, see: ■ Section 9.1.2, Channels Representing Streams and Relations ■ Streams and Relations in the Oracle Complex Event Processing CQL Language Reference

1.1.3.2 Stream and Relation Sources

All components that produce events must implement one of the following interfaces: ■ com.bea.wlevs.ede.api.StreamSource ■ com.bea.wlevs.ede.api.RelationSource com.bea.wlevs.ede.api.StreamSource The StreamSource interface has one method, setEventSender; at runtime the event source component is injected with a com.bea.wlevs.ede.api.StreamSender instance. The StreamSender instance, in turn, has a sendInsertEvent method that the component invokes to actually send events to the next component in the EPN. The StreamSender instance also provides a sendHeartbeat method. The sendHeartBeat method applies only to application-timestamped channels. If you enable batching on a channel, then components that send events to that channel must implement the com.bea.wlevs.ede.api.BatchStreamSender interface. The BatchStreamSender interface has a sendInsertEvents method that the component invokes to send a batch of events of type insert downstream to a BatchStreamSink. For more information, see Section 9.1.6, Batch Processing Channels .