Sun Microsystems Documentation
Table of Contents
 
 

IEP Service Engine Tutorial

In this tutorial, you create an Intelligent Event Processor called quotes.iep that monitors a stream of stock quotes and updates a database table called Latest2Quotes.

The table Latest2Quotes always contains the two latest stock quotes.

To create an Intelligent Event Processor and monitor it, you create:

  1. An IEP project, quotesIEP.

  2. An intelligent event processor, quotes.iep,under the project quotesIEP.

  3. A deployment project, quotesJBI,to deploy the intelligent event processor to the application server.

Finally, you insert stock quotes into the event stream and observe the two latest stock quotes in the table, Latest2Quotes .

For more information about working with NetBeans IDE, see the Support and Docs page on the NetBeans website.

Prerequisites

This tutorial assumes that you have some basic knowledge of, or programming experience with, the Java language and platform and the NetBeans IDE.

System Requirements

This tutorial assumes that your system meets the requirements specified in the System Requirements topic of the NetBeans 6.5.1 Release Notes.

Software Needed for the Tutorial

Before you begin, you need to install the following software on your computer: NetBeans IDE 6.5.1 available from Netbeans IDE 6.5.1 Download.

Configuring and Starting the Sun Java System Application Server

Before you can deploy your application, the Sun Java System Application Server must be configured correctly and running.


Note - In the following procedures, Sun  Java System Application  Server node refers to the node that represents the Sun Java System Application Server 9.1 installation of the application server.


To check the status of the Sun Java System Application Server:

  1. If the Runtime window is not visible, choose Window > Runtime.

  2. In the Runtime window, expand the Servers node.

    The Servers node should contain a Sun Java System Application Server subnode. If a Sun Java System Application Server node does not appear, go to To configure the Sun Java System Application Server:.

    If a green arrow badge appears on the Sun Java System Application Server node, the server is running. If a green arrow badge does not appear, go to To start the Sun Java System Application Server:.

To configure the Sun Java System Application Server:

  1. If the Runtime window is not visible, choose Window > Runtime.

  2. In the Runtime window, right-click the Servers node and choose Add Server from the pop-up menu.

    The Add Server Instance dialog box opens.

  3. In the Choose Server page, from the Server drop-down list, select Sun Java System Application Server.

  4. (Optional) In the Name field, change the default name for the server.

    The IDE uses this name to identify the server.

  5. Click Next.

    The Platform Location Folder page opens.

  6. In the Platform Location field, use the Browse button to navigate to and select the installation location of the application server.

    The default installation location is different depending on the type of installation and the platform, as shown in the following table.

    Platform

    Installing As...

    SOA Installation

    Tools Bundle Installation

    Solaris OS 

    Linux

    root

    /opt/SUNWappserver

    /opt/SDK

    Solaris OS

    Linux

    user

    ~/SUNWappserver

    ~/SDK

    Mac OS X

    N/A

    ~/SUNWappserver

    ~/SDK

    Windows

    N/A

    C:\Sun\AppServer

    C:\Sun\SDK

  7. Select the Register Local Default Domain radio button and click Next.

  8. Enter the user name and password for the domain's administrator.

    If you accepted the default values during the installation, the user name is admin and the password is adminadmin.

  9. Click Finish.

To start the Sun Java System Application Server:

  1. In the Runtime window, right-click the Sun Java System Application Server node and choose Start.

  2. Wait until the following message appears in the Output window:

    Application server startup complete.

    When the server is running, the IDE displays a green arrow badge on the Sun Java System Application Server node.

  3. Before you create an Intelligent Event Processor Module Project, make sure the IEP Service Engine is started..

    1. Navigate to the Runtime window.

    2. Expand the JBI node until you can select the sun-iep-engine node.

    3. Right-click, and choose Start.

Creating an Intelligent Event Processor Module Project

You must create a new Intelligent Event Processing project to create an intelligent event processor.

To Create an Intelligent Event Processing Project:

  1. Choose File > New Project..

  2. Select SOA from Categories.

  3. Select Intelligent Event Processing Module from Projects, and click the Next button

  4. Input quotesIEP for the Project Name entry. If necessary, browse to the desired directory to save the Project. Then click Finish.

  5. In the Projects window, expand the quotesIEP project node, right-click the Process Files node and choose New > Intelligent Event Processor.

  6. Input quotes for the File Name field, and click Finish.

  7. The IDE does the following:

    1. Creates quotes.iep under the Source Packages > Default Package.

    2. Opens the quotes.iep file in the IEP design view.

    3. Opens the Palette.

To Add IEP Operators from the Palette to the Design Area

  1. Drag the Stream Input operator from the Input section of the Palette onto the design area. If the Palette is not visible, from the Window menu, choose the Palette item to display it.

  2. Drag the Tuple Based Window operator from the Stream Converter section of the Palette onto the design area.

  3. Drag the Table Output operator from the Output section of the Palette onto the design area.

  4. Connect the three operators by dragging lines between their ports; that is, connect StreamInput0 to TupleBasedWindow0 to TableOutput0.

  5. To configure operator StreamInput0, double-click the StreamInput0 operator. You will see a

    pop-up window that is the Stream Input Property Editor. In this window, you will add attributes to define the incoming stream's data format.

    1. To add the first attribute, select the cell under the column header named Attribute Name. Type Symbol.

    2. Select the cell under the column header Data Type. From the drop down list select Varchar.

    3. Select the cell under the column header Size. Type 10.

  6. Click the Add Attribute button to add another Attribute. A blank row appears below the Symbol attribute row.

  7. Type Price for column Attribute Name. Select Double for Data Type.

  8. Click OK to complete the task.

  9. To configure the operator TupleBasedWindow0 so that it will retain only the two latest quotes, double-click operator TupleBasedWindow0.

    The pop-up window called TupleBasedWindow Property Editor opens.

  10. In the Property Editor type 2 for the Size property and click OK.

  11. Double-click the operator TableOutput0 in the design area. The Table Output Property Editor appears.

  12. Check property Is Global, and change the value of property Global Id to

    Latest2Quotes. Click OK to finish this task.

  13. Click Save to save the IEP Process.

    Note that once you save the IEP process, the IDE creates the IEP WSDL file.

Creating and Deploying the Composite Application

  1. Choose File > New Project.

  2. Select SOA from Categories.

  3. Select Composite Application from Projects and click Next.

  4. Input quotesJBI for the Project Name and click Finish. If necessary, browse to the directory in which you want to save the project.

  5. Right-click the folder quotesJBI, and select Add JBI Module.

  6. Navigate to the directory under which you created your quotesIEP Project, select the folder quotesIEP , and click the button Add Project JAR Files.

  7. Right-click the folder quotesJBI, and select Deploy Project.

Testing the quotesJBI Application

To Test the quotesJBI Application, create a connection to the Java DB database server from within your NetBeans IDE. This connection enables you to view the content of the database tables.

You will use a Java Project to insert new quotes into the event stream, and you can then observe the two latest stock quotes in the table Latest2Quotes.

To Create the Database Connection

In this section, you create a connection to the Java DB database server from within your NetBeans IDE and examine the appropriate table in the database.

  1. In the Runtime window of NetBeans, right-click Databases and select New Connection. The New Database Connection window opens.

  2. Input jdbc:derby://localhost/iepseDB for Database URL, iepseDB for User Name, and iepseDB for Password.

  3. Check Remember password during this session, and click OK. Notice the folder jdbc:derby://localhost/iepseDB[iepseDB on IEPSEDB] now exists under the folder Databases. A connection to the Java DB database server from within NetBeans IDE is created.

  4. Expand the folder jdbc:derby://localhost/iepseDB[iepseDB on IEPSEDB] and then expand the subfolder Tables.

  5. Right-click LATEST2QUOTES, and select View Data. Notice that this table is empty.

    Next you will insert stock quotes into the event stream, and observe the two latest stock quotes as updates in the Latest2Quotes table.

To Run the Java Project

In this section, you open the Java application provided with this tutorial to send an event stream to test the IEP project.

  1. Create a directory on your file system named IEPTut and unzip the iepquotesender.zip file into the directory.

  2. From the main window of the Projects window of the IDE, choose File > Open Project.

  3. Browse to the IEPTut directory that you just created and select the iepquotessender project.

  4. Leave the checkbox Open as Main Project selected and click Open Project Folder. A progress dialog box appears and then a node for the quotesSender project appears in the Projects window.

  5. Right-click quotesSender project and select Run Project. This sends a SOAP message to the event processor quotes.iep.

  6. In the Output window make sure the quotesSender(run) tab is selected.

  7. In the Output window, Input field, type y and press Enter.

  8. Click the Run SQL button (green arrow) in the SQL command window and you will see the latest quote in the table LATEST2QUOTES .

  9. Repeat steps 6-8 to send another quote from the iepquotessender project. Note the following:

    1. The latest 2 quotes in table LATEST2QUOTES are changed.

    2. Quote (ADBE, 63) is deleted from the table. This is because the TupleBasedWindow operator in quotes.iep is configured to only keep the latest 2 events.

Summary

In this tutorial, you created an Intelligent Event Processor Module, created and deployed a Composite Application, and tested the deployed Intelligent Event Processor Module application.

ContactAbout SunNewsEmploymentSite MapPrivacyTerms of UseTrademarksCopyright Sun Microsystems, Inc.