Deployment and Deployment Order

24-12 Oracle Complex Event Processing Developers Guide

24.2.4 Assembling a Custom Adapter or Event Bean in Its Own Bundle

Typically, custom adapters and event beans are bundled in the same application JAR file that contains the other components of the EPN, such as the processor, streams, and business logic POJO. However, you might sometimes want to bundle the adapter in its own JAR file and then reference the adapter in other application bundles. This is useful if, for example, two different applications read data coming from the same data feed provider and both applications use the same event types. In this case, it makes sense to share a single adapter and event type implementations rather than duplicate the implementation in two different applications. There is no real difference in how you configure an adapter and an application that uses it in separate bundles; the difference lies in where you put the configuration. This section describes: ■ Section 24.2.4.1, How to Assemble a Custom Adapter in its Own Bundle ■ Section 24.2.4.2, How to Assemble a Custom Event Bean in its Own Bundle

24.2.4.1 How to Assemble a Custom Adapter in its Own Bundle

You can assemble a custom adapter and its dependent classes in its own bundle. To assemble a custom adapter in its own bundle: 1. Create an OSGI bundle that contains only the custom adapter Java class, the custom adapter factory Java class, and optionally, the event type Java class into which the custom adapter converts incoming data. In this procedure, this bundle is called GlobalAdapter. 2. In the EPN assembly file of the GlobalAdapter bundle: ■ Register the adapter factory as an OSGI service as Section 14.4.1, Registering the Custom Adapter Factory describes. ■ If you are also including the event type in the bundle, register it as Section 2.8, Sharing Event Types Between Application Bundles describes. ■ Do not declare the custom adapter component using the wlevs:adapter element. You will use this element in the EPN assembly file of the application bundle that actually uses the adapter. ■ If you want to further configure the custom adapter, follow the usual procedure as Section 14.5, Configuring the Custom Adapter Component Configuration File describes. ■ If you are including the event type in the GlobalAdapter bundle, export the JavaBean class in the MANIFEST.MF file of the GlobalAdapter bundle using the Export-Package header as Section 4.7.4, How to Export a Package desribes. 3. Assemble and deploy the GlobalAdapter bundle as Section 24.5, Deploying Oracle CEP Applications describes. 4. In the EPN assembly file of the application that is going to use the custom adapter, declare the custom adapter component as Section 14.4.2, Declaring the Custom Adapter Components in your Application describes. Assembling and Deploying Oracle CEP Applications 24-13 You still use the provider attribute to specify the OSGI-registered adapter factory, although in this case the OSGI registration happens in a different EPN assembly file of the GlobalAdapter bundle from the EPN assembly file that actually uses the adapter. 5. If you have exported the event type in the GlobalAdapter bundle, you must explicitly import it into the application that is going to use it. You do this by adding the package to the Import-Package header of the MANIFEST.MF file of the application bundle as Section 24.2.2.1, Creating the MANIFEST.MF File describes.

24.2.4.2 How to Assemble a Custom Event Bean in its Own Bundle

You can assemble a custom event bean and its dependent classes in its own bundle. To assemble a custom event bean in its own bundle: 1. Create an OSGI bundle that contains only the custom event bean Java class and the custom event bean factory Java class. In this procedure, this bundle is called GlobalEventBean. 2. In the EPN assembly file of the GlobalEventBean bundle: ■ Register the custom event bean factory as an OSGI service as Section 15.3.1, Registering the Custom Event Bean Factory describes. ■ Do not declare the custom event bean component using the wlevs:adapter element. You will use this element in the EPN assembly file of the application bundle that actually uses the adapter. ■ If you want to further configure the custom event bean, follow the usual procedure as Section 15.4, Configuring the Custom Event Bean Component Configuration File describes. 3. Assemble and deploy the GlobalEventBean bundle as Section 24.5, Deploying Oracle CEP Applications describes. 4. In the EPN assembly file of the application that is going to use the custom event bean, declare the custom event bean component as Section 15.3.2, Declaring the Custom Event Bean Components in your Application describes. You still use the provider attribute to specify the OSGI-registered custom event bean factory, although in this case the OSGI registration happens in a different EPN assembly file of the GlobalEventBean bundle from the EPN assembly file that actually uses the adapter. 5. If you have exported the event type in the GlobalEventBean bundle, you must explicitly import it into the application that is going to use it. You do this by adding the package to the Import-Package header of the MANIFEST.MF file of the application bundle as Section 24.2.2.1, Creating the MANIFEST.MF File describes.

24.3 Managing Application Libraries

The Oracle CEP application library gives you a convenient location to deploy shared libraries and gives you complete control over the order in which shared libraries are deployed at Oracle CEP server start up time.