4 Create a Basic Application

This chapter walks through building a basic Oracle Event Processing application. The steps include explanations of key Oracle Event Processing application programming concepts.

This chapter covers the following topics:

4.1 About the Basic Application

The basic Oracle Stream Analytics application models a simple stock trade alert system. The application receives example data about stock trades, monitors the data for certain characteristics, and based on the results, prints some of the data to the console.

The following illustration shows the finished event processing network (EPN) diagram for the application:

4.2 Before You Begin

This walkthrough requires that you have downloaded and installed the 12c version of Oracle Stream Analytics including Oracle JDeveloper and the Oracle Stream Analytics JDeveloper plug-in. Follow the installation instructions that come with the download to ensure you have the correct setup.

Make sure you set the JAVA_HOME variable to point to JDK7_u55 or above and set the PATH variable to point to the bin directory under your JDK installation:

export JAVA_HOME=<path to installation directory>
export PATH=${JAVA_HOME}/bin:${PATH}

In this walkthrough, the installation directory is /Oracle/Middleware/my_oep/.

Optionally, you can set the WLEVS_HOME variable to point to the installation directory. The Oracle Event Processing JDeveloper plug-in uses this variable to detect the local Oracle Event Processing server.

Note:

This walkthrough introduces features specific to Oracle Event Processing and assumes that you are familiar with basic Java programming.

4.3 Create the Application

In Oracle JDeveloper an application is the highest level in the control structure. An application is a view of all the objects you need while you work. An application keeps track of all your projects while you develop programs. project is a logical container for a set of files that define an Oracle JDeveloper program or portion of a program. A project can contain files that represent different tiers of a multi-tier application or different subsystems of a complex application. Project files can reside in any directory and still be contained within a single project.

Start Oracle JDeveloper

  1. Go to/Oracle/Middleware/my_oep/jdeveloper/jdev/bin.

  2. Type ./jdev.

    The Select Role dialog displays.

  3. In the Select Role dialog, select Studio Developer (All Features) and click OK.

    Wait a few moments while Oracle JDeveloper starts.

Create the TradeReport Application

  1. In Oracle JDeveloper, Click the New Application button.

    The New Gallery dialog displays.

  2. In the New Gallery dialog, select OEP Application and click OK.

    The Create OEP Application screen displays.

  3. In the Create OEP Application Step 1 of 4 dialog, enter the following values:

    Application Name: TradeReport Directory: Accept the default Application Package Prefix: Leave blank

  4. Click Next.

    The Create OEP Application - Step 2 of 4 screen displays.

  5. In the Create OEP Application - Step 2 of 4, dialog, enter the following values:

    Project Name: TradeReport Directory: Accept the default Project Features: OEP Suite

  6. Click Next.

    The Create OEP Application - Step 3 of 4 dialog displays.

  7. In the Create OEP Application - Step 3 of 4 dialog, click Next to accept the defaults:

    The Create OEP Application - Step 4 dialog displays.

  8. In the Create OEP Application - Step 4 of 4 dialog, examine the default values:

    Empty OEP Project: Provides the basic structure of an Oracle Event Processing application.

    OEP Server Connections: Leave blank. In a later step, you create the Oracle Event Processing server connection.

  9. Click Finish to accept the defaults.

    The Oracle Event Processing TradeReport application and project displays.

4.4 TradeReport Project Files

The TradeReport application contains the Projects and Applications Resources windows. The Projects window lists the TradeReport project. The TradeReport project contains an OEP Content folder with the spring and wlevs subfolders. On the right side of Oracle JDeveloper under IDE Connections is the Resources window.

Projects Window

  • spring subfolder that contains the TradeReport.context.xml assembly file. The assembly file conforms to the Spring framework and contains the contents and structure of the TradeReport EPN.

    The assembly file also contains the default configuration for each EPN stage. This default configuration cannot be changed at run time without redeploying the application. As you add and connect stages on the EPN diagram, Oracle JDeveloper captures your work in this file. You can also edit this file manually.

    Note:

    The EPN assembly file XML schema extends the Spring framework configuration file. See the Spring website at http://www.springsource.org/spring-framework.

  • wlevs subfolder that contains the default processor.xml configuration file. The files in the wlevs folder describe components with configurations that can be edited at runtime with Oracle Event Processing Visualizer. As you use Oracle JDeveloper to create components, you can place their configurations in the processor.xml file or specify another component configuration file to group component types in the same file. You can also edit configuration files manually.

  • EPN diagram The EPN diagram represents the components that make up the application. Event data enters your application from the left of the diagram, and moves to the right from stage to stage.

    The EPN diagram shows a graphical representation of the underlying EPN configuration. When you add a component to the EPN, Oracle JDeveloper writes information to the TradeReport.context.xml assembly file and the configuration file.

  • MANIFEST.MF that describes the contents of the OSGi bundle that you deploy to the Oracle Event Processing server.

Resources Window

The Resources window, which is on the right side of Oracle JDeveloper under IDE Connections, provides information about running server connections.

4.5 Create an Event Type to Carry Event Data

Within an Oracle Stream Analytics application, every event has an event type. The event type is a structure that defines a particular kind of event data in terms of the set of values the event can take, and the operations that can be performed on that data.

Oracle Stream Analytics supports several data structures for creating a new event type. These data structures are JavaBean classes, tuples, and java.util.Map classes. A JavaBean class is the best practice structure for new event types and is used in this walkthrough to define trade events.

As raw event data comes into the Oracle Stream Analytics application, the application binds that data to an event of a particular event type. You define the event type in terms of the set of data it can hold and the required type for each data in the set.

In this walkthrough, the event data comes into the application from a CSV file in consistent rows of comma-separated values as follows:

IBM,15.5,3.333333333,3000,15 SUN,10.8,-1.818181818,5000,11
ORCL,14.1,0.714285714,6000,14
GOOG,30,-6.25,4000,32
YHOO,7.8,-2.5,1000,8

The data columns are not labeled in the CSV file, but if they were labeled, they would have the corresponding Java data type shown in Table 4-1. The Java data types that define an event type are referred to as properties in Oracle Event Processing.

Table 4-1 Mapping Event Data to Event Types

Possible Columns Java Data Type

Stock Symbol

String

Price per share

Double

Percent change

Double

Volume of shares transacted

Integer

Last price

Double

Create the TradeEvent JavaBean

  1. Select the TradeReport project.

    Oracle JDeveloper highlights the TradeReport project.

  2. Select File > New > From Gallery.

    The New Gallery dialog displays.

  3. In the New Gallery dialog, select General in the left panel, Java Class in the right panel, and click OK.

    The Create Java Class dialog displays.

  4. In the Create Java Class dialog, enter TradeEvent in the Name field, and enter or review the following default settings:

    Name: TradeEvent Package: tradereport Extends: java.lang.Object Access Modifiers: public Other Modifiers: <None> Constructors from Superclass: checked Implement Abstract Methods: checked

  5. Click OK.

    Oracle JDeveloper adds the tradereport.TradeEvent JavaBean class to the Project under the Application Sources folder. The stub code displays in the Oracle JDeveloper center window in its own tab:

    package tradereport;
    
    public class TradeEvent {
       public TradeEvent() {
          super ();
       }
    }
    

Create Private Variables and Accessor Methods

  1. In the TradeEvent class, add private variables for each of the properties (Java data types) as shown in the following example.

    package tradereport;
    
    public class TradeEvent {
      // One variable for each field in the event data.
      private String symbol;
      private Double price;
      private Double lastPrice;
      private Double percChange;
      private Integer volume;
      public TradeEvent () {
      super();
     }
    }
    
  2. To generate the accessor methods, right click anywhere in the source editor.

    The source editor pop-up menu displays.

  3. In the source editor pop-up menu, select Generate Accessors.

    The Generate Accessors dialog displays.

  4. In the Generate Accessors dialog, click the Select All button and click OK.

  5. Close the TradeEvent.java tab and save the file.

Configure the TradeEvent Event Type

  1. In the TradeReport project under the OEP Content folder, double-click the EPN Diagram.

    The EPN diagram displays in the center window and is empty.

  2. Below the EPN diagram select the Event Types tab.

    The Event Type Definitions window displays the TradeReport.context.xml folder with Add (+) and Delete (x) buttons at the top.

  3. In the Event Type Definitions window, select the TradeReport.context.xml folder and click Add.

    Controls to define the event type display below Event Type Details on the right.

  4. In the Type Name field enter TradeEvent.

    The event type name does not have to be similar to the JavaBean class name, but by making them similar, it is easier to track which event types go with which classes.

  5. Select the Properties defined in Java bean radio button and enter or use search to the name of the JavaBean in the Class box.

    The name of the JavaBean is tradereport.TradeEvent.

    Note:

    The Properties defined declaratively radio button is for defining events as tuples.

  6. Close the EPN diagram editor and save the file.

View the EPN Assembly File

  1. In the left panel under TradeReport > OEP Content > Spring, double-click TradeReport.context.xml.

    The TradeReport.context.xml file displays in the Source tab.

  2. In the TradeReport.context.xml file at the bottom of the file, look for the following lines:
    <wlevs:event-type-repository>
        <wlevs:event-type type-name="TradeEvent">
            <wlevs:class>tradereport.TradeEvent</wlevs:class>
        </wlevs:event-type>
    </wlevs:event-type-repository>
    

Notice that Oracle Event Processing manages event types in an event type repository, and that the TradeEvent event type contains (maps to) the tradereport.TradeEvent class.

4.6 Add the csvgen Adapter to Receive Simulated Event Data

Adapters manage data flowing into and out of the EPN. This example uses a csvgen adapter that works with the load generator utility to simulate a data feed to test your application. The load generator reads an ASCII file that contains the sample data feed information and sends each line of data in order to a port. The csvgen adapter listens for data at the same port. The csvgen adapter logic translates data read from the CSV file into an event that has the TradeEvent event type.

Note:

Before you deploy an application to the final production environment, you must switch to an input adapter that can read the type of incoming data your application will receive in production.

In this procedure, you declare the adapter and set its properties. When completed, the EPN diagram displays the adapter to create the first stage in your TradeReport EPN.

Create the csvgen Adapter and Set Its Properties

  1. Open the TradeReport > META-INF > spring > TradeReport.context.xml assembly file.
  2. Below the event-type-repository XML stanza, add the following XML to declare the csvgen adapter.
    <wlevs:adapter id="StockTradeCSVAdapter" provider="csvgen">
     <wlevs:instance-property name="port" value ="9200" />
     <wlevs:instance-property name="EventTypeName" value="TradeEvent" />
     <wlevs:instance-property name="eventPropertyNames" value="symbol,price,percChange,volume,lastPrice" />
    </wlevs:adapter>
    

    Note:

    No white spaces allowed between the instance-property name values. The order of the name values must match the order in the StockData.csv files described in View the Test Data.

    The XML stanza declares an instance of the csvgen adapter and assigns to it three properties that configure it for use in your EPN. The adapter uses the properties to map from incoming raw event data to the properties of the event type you defined.

    id: A unique identifier for the adapter. The provider attribute value must be csvgen to refer to the csvgen implementation included with Oracle Event Processing.

    port: Tells the adapter instance what port to listen on for incoming event data. The value here, 9200, corresponds to the port number to which the load generator will send event data (more on that later).

    The eventTypeName: Tells the instance the name of the event type to which incoming event data should be assigned. Here, you give the name of the TradeEvent type you defined earlier.

    eventPropertyNames. Tells the instance the names of the event type properties to which data should be assigned. Notice in this case that the eventPropertyNames: A comma-separated list of the same properties you defined in the JavaBean for the event type. In order for the csvgen adapter to map from incoming values to event type properties, the names here must be the same as your event type and must be in the same order as corresponding values for each row of the CSV file.

  3. Save and close the TradeReport.context.xml assembly file.

    The StockTradeCSVAdapter displays on the EPN diagram to create the first stage in your TradeReport EPN network.

  4. Open the EPN diagram to see the StockTradeCSVAdapter:

4.7 Add an Output Channel to Convey Events

A channel is a conduit that uses logic to transfer events from one stage in the EPN to the next stage. In this step, you add a channel to carry newly generated events from the StockTradeCSVAdapter to the next stage.

Create the AdapterOutputChannel

  1. With the EPN Diagram open, go to Basic Components and drag the Channel component to an empty space on the EPN diagram.

    The New Channel dialog displays.

  2. In New Channel dialog, enter the following values:

    Channel ID: AdapterOutputChannel. Event Type: TradeEvent.

  3. Click OK.

    The AdapterOutputChannel component displays on the EPN diagram.

    The AdapterOutputChannel conveys events of type TradeEvent to the next stage in the EPN diagram. Recall that the TradeEvent event type is implemented with the TradeEvent JavaBean class.

Connect the Adapter to the Channel

  1. Click the StockTradeCSVAdapter icon and drag it to the AdapterOutputChannel icon.

    This action creates a connecting line between the two icons and places the AdapterOutputChannel to the right of the StockTradeCSVAdapter, which indicates that events flow from the adapter to the channel.

  2. Double-click the AdapterOutputChannel icon to view the TradeReport.context.xml assembly file. A blinking cursor displays next to the line with the channel configuration.
    <wlevs:adapter id="StockTradeCSVAdapter" provider="csvgen">
     <wlevs:listener ref="AdapterOutputChannel"/>
     <wlevs:instance-property name="eventType" value="TradeEvent"/>
     <wlevs:instance-property name="eventPropertyNames" value="symbol, price,
       lastPrice, percChange, volume" />
     </wlevs:adapter>
     <wlevs:channel id="AdapterOutputChannel" event-type="TradeEvent"/>
    

    When you created the connection between the adapter and the channel, Oracle JDeveloper added a reference to a listener. The listener ref attribute is set to the id attribute of the channel element meaning that the channel listens for events that come from the adapter.

  3. Close the TradeReport.context.xml tab and save the file.

4.8 Create a Listener Event Sink to Receive and Report Events

Next you add a listener event sink that receives trade events from the channel and checks the information in those events. A listener event sink is a Java class that implements logic to listen for and work on trade events. This type of Java class is also called a listener Java class.

The following procedure shows you how to create a listener event sink that listens for trade events, gets the stock symbol and trade volume information, and prints the stock symbol and trade volume information to the console.

Create the Listener Event Sink

  1. Select the TradeReport project and select File > New > Java Class.

  2. In the Create Java Class dialog, enter TradeListener in the Name field and review the following settings:

    Name: TradeListener Package: tradereport Extends: java.lang.Object Access Modifiers: public Other Modifiers: <NONE> Constructors from Superclass: Checked Implement Abstract Methods: Checked

  3. In the Create Java Class dialog under the Implements area, click the Add (+) button to select the interface your listener needs to implement to be an event sink.

  4. In the Class Browser dialog, use either the Search tab or the Hierarchy tab to locate the com.bea.wlevs.ede.api.StreamSink class.

  5. Under Matching Class, highlight the com.bea.wlevs.ede.api.StreamSink class and click OK.

    You return to the Create Java Class dialog.

  6. In the Create Java Class dialog, click OK.

    Oracle JDeveloper adds the TradeListener JavaBean to the project under the Application Sources folder. The stub code displays in the Oracle JDeveloper middle panel.

    package tradereport;
     
    import com.bea.wlevs.ede.api.EventRejectedException;
    import com.bea.wlevs.ede.api.StreamSink;
     
    public class TradeListener implements StreamSink {
        public TradeListener() {
            super();
        } 
        @Override
        public void onInsertEvent(Object object) throws EventRejectedException {
            // TODO Implement this method
        }
    }
    
  7. In the TradeListener class, edit the onInsertEvent method as follows:

    @Override
    public void onInsertEvent(Object event) throws EventRejectedException {
     
        if (event instanceof TradeEvent){
            String symbolProp = ((TradeEvent) event).getSymbol();
            Integer volumeProp = ((TradeEvent) event).getVolume();
            System.out.println(symbolProp + ":" + volumeProp);
        }
    }
    

    The onInsertEvent method listens for trade events, and when it hears a TradeEvent, it calls the tradereport.TradeEvent get methods to get the stock symbol and the trade volume, and to print the stock symbol and trade volume information to the console.

  8. Close the TradeListener.java tab and save the file.

Add the Event Sink to the EPN Diagram as an Event Bean

  1. Open the EPN Diagram.
  2. Under Base Components, drag the Event Bean component onto an empty area of the EPN Diagram.

    The New Event Bean wizard displays.

  3. In the EventBean ID field, enter ListenerBean.
  4. In the EventBean class field, enter tradereport.TradeListener and click OK
  5. In the EPN diagram, select AdapterOutputChannel and drag it to ListenerBean to connect them.

    The connection enables trade events to pass from the channel to the listener bean.

  6. Double-click the AdapterOutputChannel.

    The TradeReport.context.xml file displays with a blinking cursor next to the channel line. The ref attribute of the channel listener points to ListenerBean.

    <wlevs:channel id="AdapterOutputChannel" event-type="TradeEvent">
      <wlevs:listener ref="ListenerBean" />
    </wlevs:channel>
    <wlevs:event-bean id="ListenerBean"
      class="tradereport.TradeEvent" />
    
  7. Close the TradeReport.context.xml tab and save the file.

Note:

There are no configuration file entries for the channel beyond the default configuration. You can edit the processor.xml file to customize the channel configuration or create a separate configuration file, such as channel.xml, for channels and add custom channel configuration to it. See Add Configuration Settings to a Component.

4.9 Add an Oracle CQL Processor to Filter Events

Next add an Oracle CQL processor to filter events based on certain criteria. The Oracle CQL processor goes between AdapterOutputChannel and an output channel that you create in the next section.

The Oracle CQL processor contains Oracle CQL code that you write. The Oracle CQL code queries the events sent to the processor from AdapterOutputChannel. The query retrieves only those trade events that have a volume that is greater than 4000. Oracle Event Processing passes the retrieved events to the output channel, which then sends the events to ListenerBean for processing. Recall that ListenerBean listens for trade events, gets the stock symbol and trade volume information, and prints the stock symbol and trade volume information to the console.

The CQL query selects the symbol and volume properties from each incoming trade event, tests the volume property for a value higher than 4000, and outputs a set of 1 qualifying event at a time. The NOW operator creates a window of time that contains the event that happened at the last tick of the system.

<query id="GetHighVolume"><![CDATA[
    select trade.symbol, trade.volume
    from AdapterOutputChannel [now] as trade
    where trade.volume > 4000
    ]]>
</query>

Add a GetHighVolume Processor and Query

  1. In the Components window under Basic Components, drag the Processor component to an empty space on the EPN diagram.

    The New Processor dialog displays.

  2. In the New Processor dialog in the Processor ID field, enter GetHighVolumeProcessor, keep the default File name, which is processor.xml, and click OK.

    Oracle Event Processing requires that you have at least one configuration file with the name processor.xml that contains the processor configuration. You can add other component configurations to this file or create additional configuration files.

  3. Right-click the connector from the AdapterOutputChannel icon to the ListenerBean icon and click Delete.
  4. Click the AdapterOutputChannel component, and drag from it to the GetHighVolumeProcessor icon.

    Creating this connection makes the Oracle CQL processor aware of the channel. After you connect the channel to the Oracle CQL processor, you can refer to the channel by its ID value in the Oracle CQL code.

  5. Right-click the GetHighVolumneProcessor stage.

    The context menu displays.

  6. From the context menu, select Go To Configuration Source.

    Oracle JDeveloper opens a source editor where you place the Oracle CQL rules to be applied to the streaming event data. The source editor provides a sample query that you can edit or replace.

  7. Replace the sample Oracle CQL code with the Oracle CQL code provided here:

    You replace the sample Oracle CQL between <rules> </rules> with the following Oracle CQL code:

    <query id="GetHighVolume"><![CDATA[
        select trade.symbol, trade.volume
        from AdapterOutputChannel [now] as trade
        where trade.volume > 4000
        ]]>
    </query>
    
  8. Close the configuration file tab and save your work.

4.10 Add an Output Channel

The next step is to add an output channel.

  1. From Base Components, drag the Channel component to an empty area on the EPN diagram.
  2. In the New Channel wizard in the Channel ID field, enter ProcessorOutputChannel and select TradeEvent as the event type.
  3. Click OK.
  4. Select the GetHighVolumeProcessor component and drag it to the new channel component to connect the Oracle CQL processor and channel.
  5. Select the ProcessorOutputChannel component and drag it to the ListenerBean component to connect the channel to the listener.

    All of the components in the EPN diagram are now connected.

  6. Double-click the ProcessorOutputChannel icon to see the channel configuration in the TradeReport.context.xml file.

    The entry for the ProcessorOutputChannel specifies that events of type TradeEvent pass through this channel.

     <wlevs:channel id="ProcessorOutputChannel" event-type="TradeEvent">
        <wlevs:listener ref="ListenerBean"/>
        <wlevs:source ref="GetHighVolumeProcessor"/>
      </wlevs:channel>
    
  7. Save all of the files in the project.

4.11 Deploy

To deploy the example application for testing, you must perform certain actions.

Create an Oracle Event Processing Domain

To create a domain, start the Oracle Event Processing Configuration wizard:

  1. Start the Configuration Wizard:

    1. On Windows, navigate to \Oracle\Middleware\my_oep\oep\common\bin\ and type config.cmd.

    2. On UNIX, navigate to /Oracle/Middleware/my_oep/oep/common/bin and type ./config.sh.

    The Configuration wizard Welcome screen displays.

  2. On the Welcome screen, click Next.

    The Choose Create or Update Domain screen displays.

  3. On the Choose Create or Update Domain screen, select Create a new OEP domain and click Next.

    The Create or Update Domain screen displays.

  4. In the Create or Update Domain screen, in the User Name field, enter oepadmin, and enter and confirm the password, welcome1.

  5. Click Next, accept the Configure Server defaults, and click Next.

    The Configure Domain Identity Keystore screen displays.

  6. In the Configure Domain Identity Keystore screen, enter and confirm the password welcome1 and click Next.

    The Configuration Options screen displays.

  7. In the Configuration Options screen, click Next to not perform any optional configuration.

    The Create OEP Domain screen displays.

  8. In the Create OEP Domain screen, enter basicapp_domain and make a note of its location.

    The location will be something like /Oracle/Middleware/my_oep/user_projects/domains.

  9. Click Create, and after a few moments, click Done.

Start the Oracle Event Processing Server

  1. Go to /Oracle/Middleware/my_oep/user_projects/domains/basicapp_domain/defaultserver.

  2. Execute the appropriate startup script:

    1. On Windows:

      • prompt> startwlevs.cmd
        
    2. On UNIX:

      • prompt> ./startwlevs.sh
        

    The terminal window displays messages as the server starts. When you see, <The application context for "com.bea.wlevs.dataservices" was started successfully >, the Oracle Event Processing server is ready.

Create an Oracle Event Processing Server Connection

  1. Select File > New > From Gallery.

    The New Gallery dialog displays.

  2. In the New Gallery dialog under Categories > General, select Connections.

  3. In the New Gallery dialog under Items, select OEP Connection, and click OK.

    The Create OEP Server Connection dialog displays.

  4. In the Create OEP Server Connection dialog, provide the following information:

    Connection will be created in: IDE Connections: Selected Remote OEP Server: Not checked OEP Server Connection Name: OEPBasicAppConnection OEP Server Home Path: /Oracle/Middleware/my_oep/ Use Default Values: Unchecked. OEP Server Projects Directory: user_projects/domains/ basicapp_domain/defaultserver Use Default Values: Checked Host: 127.0.0.1 Port: 9002 Use Default Values: Unchecked Username: oepadmin User Password: welcome1 Additional Parameters for OEP Server: blank

  5. In the Create OEP Server Connection dialog, click Test Connection.

    If you see Success in the area below the Test Connection button, you entered the information correctly. If you see errors, correct them and test again until you see Success.

  6. When you see the Success message, click OK.

Create a Deployment Profile

  1. Right-click the TradeReport project and select Deploy > New Deployment Profile.

    The Create Deployment Profile dialog displays.

  2. In the Create Deployment Profile dialog, provide the following values.

    Profile Type: OEP Project Deployment Profile.

    Note:

    Make sure you select the correct Profile Type, which is OEP Project Deployment Profile.

    Deployment Profile Name: basicapp_profile.

  3. Click OK.

    The Deployment Properties dialog displays.

  4. In the Deployment Properties dialog, verify the information:

    Connection to Local OEP Server: OEPBasicAppConnection (127.0.0.1:9002) Symbolic Name: TradeReport.TradeReport Bundle Name: TradeReport.TradeReport Bundle Version: 1.0.0 OSGi JAR file: /home/<username>/jdeveloper/mywork/TradeReport/TradeReport/deploy/basicapp_profile.jar.

  5. Click OK.

Deploy the Application

  1. Right-click the TradeReport project.

    The context menu displays.

  2. In the context menu, select Deploy > basicapp_profile.

    The Deployment Action dialog displays.

  3. In the Deployment Action dialog, select Deploy OSGi bundle to target platform.

  4. Click Next.

    The Summary dialog displays.

  5. In the Summary dialog, confirm the information.

  6. Click Finish.

    In the Deployment - Log panel at the bottom of the middle panel, messages indicate the successful deployment.

  7. In the Resources window on the right side under IDE Connections, navigate to OEP Server > OEPBasicAppConnection > Applications.

    The BasicApplication.BasicApp[Running} connection displays.

A deployment profile creates an OSGi bundle that contains the required library JAR file.

4.12 Set Up and Start the Load Generator

The load generator enables you to load test data so that you can see how your Oracle Stream Analytics application behaves when it is deployed into production.

Normally, you start the load generator after you deploy the application. However, you can start the load generator before you deploy, but you will get a message that there is no listener on port 9200. The message goes away after you deploy application.

View the Test Data

  1. In the text editor of your choice, open the StockData.csv file included with Oracle Event Processing installation.

    By default, the file is at the following location:

    /Oracle/Middleware/my_oep/oep/utils/load-generator/StockData.csv.

  2. Take a look at the StockData.csv file, which contains comma-separated values in rows where each row represents a trade.

    Note:

    The order of the event properties in the StockData.csv file must match the order of event properties specified in Create the csvgen Adapter and Set Its Properties.

Verify the Load Generator Properties

  1. In the text editor of your choice, open the StockData.prop files included with Oracle Event Processing installation.

    By default, the files are at the following location:

    /Oracle/Middleware/my_oep/oep/utils/load-generator/StockData.prop.

  2. In the StockData.prop file, verify the following properties:

    • test.csvDataFile: The name of the CSV file that the load generator reads. For this example, the value is StockData.csv.

    • test.port: The port number to which the load generator sends event data. This should be the port value you specified when you configured the CSV adapter, which is 9200.

    • test.packetType: The type of data format that the load generator will handle. For this example, the value is CSV.

    The load generator requires the test.csvDataFile and test.port properties. The other properties are optional, but you need to set at least test.packetType so that the load generator knows that your input is in CSV form.

  3. Close the StockData.prop file and save if you made any changes.

Start the Load Generator

  1. Run the load generator with the StockData.prop properties file:

    1. On Windows:

      prompt> runloadgen.cmd StockData.prop
      
    2. On UNIX:

      prompt> ./runloadgen.sh StockData.prop
      

4.13 Stop the Load Generator and the Server

When you are finished with the example, you can stop the load generator and the Oracle Stream Analytics server.

Stop the Load Generator

  1. Change directory to /Oracle/Middleware/my_oep/oep/utils/load-generator.

  2. Type Ctrl-c

Stop the Server

  1. Change directory to /Oracle/Middleware/my_oep/user_projects/domains/basicapp_domain/defaultserver.
  2. Execute the stopwlevs command.