High Availability and Scalability

Overview of Creating Oracle CEP Applications 1-15 For more information, see: ■ Part V, Developing Applications for High Availability ■ Part VI, Developing Applications for Scalability

1.1.9 Oracle CEP Application Lifecycle

Figure 1–2 shows a state diagram for the Oracle CEP application lifecycle. In this diagram, the state names STARTING, INITIALIZING, RUNNING, SUSPENDING, SUSPENDED, and FAILED correspond to the ApplicationRuntimeMBean method getState return values. These states are specific to Oracle CEP; they are not OSGi bundle states. Figure 1–2 Oracle CEP Application Lifecycle State Diagram This section describes the lifecycle of an application deployed to the Oracle CEP server and the sequence of com.bea.wlevs.ede.api API callbacks. The lifecycle description is broken down into actions that a user performs, including: ■ Section 1.1.9.1, User Action: Installing an Application or Start the Server With Application Already Deployed ■ Section 1.1.9.2, User Action: Suspend Application ■ Section 1.1.9.3, User Action: Resume Application ■ Section 1.1.9.4, User Action: Uninstall Application ■ Section 1.1.9.5, User Action: Update Application ■ Section 1.1.9.6, User Action: Calling Methods of Stream and Relation Sources and Sinks Note: For information on Oracle CEP server lifecycle, see Oracle CEP Server Lifecycle in the Oracle Complex Event Processing Administrators Guide. 1-16 Oracle Complex Event Processing Developers Guide This information explains how Oracle CEP manages an applications lifecycle so that you can better use the lifecycle APIs in your application. For a description of these lifecycle APIs such as RunnableBean and SuspendableBean, see: ■ Section 1.1.10, Oracle CEP APIs ■ Appendix I, Oracle CEP Metadata Annotation Reference ■ Oracle Fusion Middleware Java API Reference for Oracle Complex Event Processing

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

Oracle CEP performs the following actions: 1. Oracle CEP installs the application as an OSGI bundle. OSGI resolves the imports and exports, and publishes the service. 2. Oracle CEP creates beans for both standard Spring beans and those that correspond to the Oracle CEP tags in the EPN assembly file. For each bean, Oracle CEP: ■ Sets the properties on the Spring beans. The wlevs:instance-property values are set on adapters and event-beans. ■ Injects appropriate dependencies into services specified by Service or ServiceReference annotations. ■ Injects appropriate dependencies into static configuration properties. ■ Calls the InitializingBean.afterPropertiesSet method. ■ Calls configuration callbacks Prepare,Activate on Spring beans as well as factory-created stages. For more information, see Section 1.4, Configuring Oracle CEP Resource Access . 3. Application state is now INITIALIZING. 4. Oracle CEP registers the MBeans. 5. Oracle CEP calls the ActivatableBean.afterConfigurationActive method on all ActivatableBeans. 6. Oracle CEP calls the ResumableBean.beforeResume method on all ResumableBeans. 7. For each bean that implements RunnableBean, Oracle CEP starts it running in a thread. 8. Application state is now RUNNING.

1.1.9.2 User Action: Suspend Application

Oracle CEP performs the following actions: 1. Oracle CEP calls the SuspendableBean.suspend method on all SuspendableBeans. 2. Application state is now SUSPENDED.