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:
An IEP project, quotesIEP.
An intelligent event processor, quotes.iep,under the project quotesIEP.
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.
This tutorial assumes that you have some basic knowledge of, or programming experience with, the Java language and platform and the NetBeans IDE.
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:
If the Runtime window is not visible, choose Window > Runtime.
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:
If the Runtime window is not visible, choose Window > Runtime.
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.
In the Choose Server page, from the Server drop-down list, select Sun Java System Application Server.
(Optional) In the Name field, change the default name for the server.
The IDE uses this name to identify the server.
The Platform Location Folder page opens.
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.
Tools Bundle Installation
Mac OS X
Select the Register Local Default Domain radio button and click Next.
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.
To start the Sun Java System Application Server:
In the Runtime window, right-click the Sun Java System Application Server node and choose Start.
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.
Before you create an Intelligent Event Processor Module Project, make sure the IEP Service Engine is started..
Navigate to the Runtime window.
Expand the JBI node until you can select the sun-iep-engine node.
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:
Choose File > New Project..
Select SOA from Categories.
Select Intelligent Event Processing Module from Projects, and click the Next button
Input quotesIEP for the Project Name entry. If necessary, browse to the desired directory to save the Project. Then click Finish.
In the Projects window, expand the quotesIEP project node, right-click the Process Files node and choose New > Intelligent Event Processor.
Input quotes for the File Name field, and click Finish.
The IDE does the following:
Creates quotes.iep under the Source Packages > Default Package.
Opens the quotes.iep file in the IEP design view.
Opens the Palette.
To Add IEP Operators from the Palette to the Design Area
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.
Drag the Tuple Based Window operator from the Stream Converter section of the Palette onto the design area.
Drag the Table Output operator from the Output section of the Palette onto the design area.
Connect the three operators by dragging lines between their ports; that is, connect StreamInput0 to TupleBasedWindow0 to TableOutput0.
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.
To add the first attribute, select the cell under the column header named Attribute Name. Type Symbol.
Select the cell under the column header Data Type. From the drop down list select Varchar.
Select the cell under the column header Size. Type 10.
Click the Add Attribute button to add another Attribute. A blank row appears below the Symbol attribute row.
Type Price for column Attribute Name. Select Double for Data Type.
Click OK to complete the task.
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.
In the Property Editor type 2 for the Size property and click OK.
Double-click the operator TableOutput0 in the design area. The Table Output Property Editor appears.
Check property Is Global, and change the value of property Global Id to
Latest2Quotes. Click OK to finish this task.
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
Choose File > New Project.
Select SOA from Categories.
Select Composite Application from Projects and click Next.
Input quotesJBI for the Project Name and click Finish. If necessary, browse to the directory in which you want to save the project.
Right-click the folder quotesJBI, and select Add JBI Module.
Navigate to the directory under which you created your quotesIEP Project, select the folder quotesIEP , and click the button Add Project JAR Files.
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.
In the Runtime window of NetBeans, right-click Databases and select New Connection. The New Database Connection window opens.
Input jdbc:derby://localhost/iepseDB for Database URL, iepseDB for User Name, and iepseDB for Password.
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.
Expand the folder jdbc:derby://localhost/iepseDB[iepseDB on IEPSEDB] and then expand the subfolder Tables.
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.
Create a directory on your file system named IEPTut and unzip the iepquotesender.zip file into the directory.
From the main window of the Projects window of the IDE, choose File > Open Project.
Browse to the IEPTut directory that you just created and select the iepquotessender project.
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.
Right-click quotesSender project and select Run Project. This sends a SOAP message to the event processor quotes.iep.
In the Output window make sure the quotesSender(run) tab is selected.
In the Output window, Input field, type y and press Enter.
Click the Run SQL button (green arrow) in the SQL command window and you will see the latest quote in the table LATEST2QUOTES .
Repeat steps 6-8 to send another quote from the iepquotessender project. Note the following:
The latest 2 quotes in table LATEST2QUOTES are changed.
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.
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.