User Action: Installing an Application or Start the Server With Application Already Deployed User Action: Suspend Application

Overview of Creating Oracle CEP Applications 1-17

1.1.9.3 User Action: Resume Application

Oracle CEP performs the following actions:

1. Oracle CEP calls the ResumableBean.beforeResume method on all

ResumableBeans

2. For each bean that implements RunnableBean, Oracle CEP starts it running in a

thread.

3. Application state is now RUNNING.

1.1.9.4 User Action: Uninstall Application

Oracle CEP performs the following actions: 1. Oracle CEP calls the SuspendableBean.suspend method on all SuspendableBeans. 2. Oracle CEP unregisters MBeans. 3. Oracle CEP calls the DisposableBean.dispose method on all DisposableBeans. 4. Oracle CEP uninstalls application bundle from OSGI.

1.1.9.5 User Action: Update Application

This is equivalent to first unistalling an application and then installing it again. See: ■ Section 1.1.9.4, User Action: Uninstall Application ■ Section 1.1.9.1, User Action: Installing an Application or Start the Server With Application Already Deployed

1.1.9.6 User Action: Calling Methods of Stream and Relation Sources and Sinks

You may not call a method on a stream or relation source or sink from a lifecycle callback because components may not be ready to receive events until after these phases of the application lifecycle complete. For example, you may not call StreamSender method sendInsertEvent from a lifecycle callback such as such as afterConfigurationActive or beforeResume. You can call a method on a stream or relation source or sink from the run method of beans that implement RunnableBean. For more information, see: ■ Section 1.1.9.1, User Action: Installing an Application or Start the Server With Application Already Deployed ■ Section 1.1.3, Transmitting Events in the EPN: Stream and Relation Sources and Sinks

1.1.10 Oracle CEP APIs

Oracle CEP provides a variety of Java APIs that you use in your adapter or event bean implementation. This section describes the APIs in the com.bea.wlevs.ede.api package that you will most typically use in your adapters and event beans. ■ Adapter—Adapters must implement this interface. 1-18 Oracle Complex Event Processing Developers Guide ■ AdapterFactory—Adapter factories must implement this interface. ■ Component life cycle interfaces—If you want some control over the life cycle of the component you are programming, then your component should implement one or more of the following interfaces: – ActivatableBean—Use if you want to run some code after all dynamic configuration has been set and the event processing network has been activated. Implement the afterConfigurationActive method. – DisposableBean—Use if you want to release resources when the application is undeployed. Implement the destroy method in your component code. – InitializingBean—Use if you require custom initialization after Oracle CEP has set all the properties of the component. Implement the afterPropertiesSet method. – ResumableBean—Use if you want to perform some task, such as acquire or configure resources, before the component resumes work. – RunnableBean—Use if you want the component to be run in a thread. The Spring framework implements similar bean life cycle interfaces; however, the equivalent Spring interfaces do not allow you to manipulate beans that were created by factories, while the Oracle CEP interfaces do. – SuspendableBean—Use if you want to suspend resources or stop processing events when the event processing network is suspended. Implement the suspend method. See also Appendix I, Oracle CEP Metadata Annotation Reference for additional lifecycle annotations. ■ EventBuilder—Use to create events whose Java representation does not expose the necessary setter and getter methods for its properties. If your event type is represented with a JavaBean with all required getter and setter methods, then you do not need to create an EventBuilder. ■ EventBuilder.Factory—Factory for creating EventBuilders. ■ StreamSink—Components that want to receive events as an Oracle CEP stream must implement this interface. An Oracle CEP stream has the following characteristics: ■ Append-only, that is, events are always appended to the end of the stream. ■ Unbounded and generally need a window to be defined before it can be processed. ■ Events have non-decreasing time-stamps. The interface has a callback method, onInsertEvent, in which programmers put the code that handles the received events. ■ StreamSource—Components that send events modeling an Oracle CEP stream, such as adapters, must implement this interface. The interface has a setEventSender method for setting the StreamSender, which actually sends the event to the next component in the network. ■ RelationSink—Components that want to receive events modeling an Oracle CEP relation must implement this interface. An Oracle CEP relation has the following characteristics: ■ Supports events that insert, delete, and update its content.