Creating Application Libraries Application Libraries

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.