Designing Intelligent Event Processor (IEP) Projects

Understanding the IEP Database

IEP uses a set of database tables to maintain information about the IEP Service Engine and deployed event processes.

To view the IEP database tables, go to the Services window of the NetBeans IDE. Expand the Databases node, the connection node, and the Tables node.

Screen capture of the IEP database tables in the Services
window.

To view the contents of an IEP database table, right-click the table node and choose View Data. This action causes the SQL SELECT query to be performed on the table. The results of the query appear.

The following screen capture shows the contents of the EMS_PLAN table.

Screen capture of the contents of the EMS_PLAN table.

You can use any of the following database servers for the IEP database:

Configuring the IEP Database to Use Oracle

By default, the IEP database is configured to use Java DB. Java DB is Sun's supported distribution of the open source Apache Derby database.

After installation, you can configure the IEP database to use Oracle instead.

The first task is to create an IEP user in the Oracle database. You run a provided SQL script that creates the IEP user and grants the appropriate privileges. The default version of the script contains the following SQL statements:


CREATE TABLESPACE "IEPSEDB_DB"
 DATAFILE
  'IEPSEDB_DB1.dat' SIZE 2000M,
  'IEPSEDB_DB2.dat' SIZE 2000M;

CREATE USER IEPSEDB IDENTIFIED BY IEPSEDB
DEFAULT TABLESPACE IEPSEDB_DB
QUOTA UNLIMITED ON IEPSEDB_DB
TEMPORARY TABLESPACE temp
QUOTA 0M ON system;

GRANT CONNECT TO IEPSEDB;
GRANT RESOURCE TO IEPSEDB;
GRANT CREATE VIEW TO IEPSEDB;

grant select on sys.dba_pending_transactions to IEPSEDB;
grant select on sys.pending_trans$ to IEPSEDB;
grant select on sys.dba_2pc_pending to IEPSEDB;
grant execute on sys.dbms_system to IEPSEDB;
grant select on SYS.dba_2pc_neighbors to IEPSEDB;
grant force any transaction to IEPSEDB;

You then perform various tasks in the application server. For example, you create two sets of connection pools and JDBC resources. A connection pool is a group of reusable connections for a particular database. The server maintains a pool of available connections to increase performance. A JDBC resource provides applications with a means of connecting to a database.

You also enable automatic recovery of XA transactions. IEP uses automatic recovery of XA transactions to achieve message reliability.

Finally, you modify properties of the IEP Service Engine.

ProcedureTo Create the IEP User in the Oracle Database

  1. Go to http://wiki.open-esb.java.net/Wiki.jsp?page=HowToRunIEPOnOracle and download the create_iepse_user.sql script.

  2. Open the create_iepse_user.sql script and review the instructions.

  3. The names of the tablespace, data files, user, and password include the string IEPSEDB. If you want to change this string to a different string, then replace all occurrences of IEPSEDB with the new string.

  4. Connect to the Oracle database as a user with the SYSDBA privilege.

  5. Run the create_iepse_user.sql script.

ProcedureTo Install the Oracle Database Driver in the Application Server

  1. Go to the computer where the application server is installed.

  2. Place the Oracle database driver (for example, ojdbc14.jar) in the install-dir/appserver/lib directory.

  3. Restart the application server.

ProcedureTo Create the Non-XA Connection Pool

  1. Log in to the Sun Java System Application Server Admin Console.

  2. Expand the Resources node and the JDBC node, and select the Connection Pools node.

  3. Click New.

    The New JDBC Connection Pool wizard appears.

  4. In step 1 of the wizard, do the following:

    1. In the Name field, specify a name for the non-XA connection pool (for example, iepseOraclePoolNonXA).

    2. In the Resource Type drop-down menu, select javax.sql.DataSource.

    3. In the Database Vendor drop-down menu, select Oracle.

    4. Click Next.

  5. In step 2 of the wizard, do the following:

    1. Scroll down to the Additional Properties table.

    2. In the User row, enter the user name of the IEP user (for example, IEPSEDB).

    3. In the Password row, enter the password of the IEP user (for example, IEPSEDB).

    4. In the URL row, enter the string for connecting to the database (for example, jdbc:oracle:thin:@myserver:1521:orcl).

  6. Click Finish.

    The connection pool is created.

  7. Click the connection pool that you just created.

    The Edit Connection Pool page appears.

  8. Click Ping.

    The Admin Console attempts to connect to the database.

    If the connection does not succeed, check to see whether the database is running. Another possible cause is that the URL string is incorrect.

ProcedureTo Create the Non-XA JDBC Resource

  1. Expand the Resources node and the JDBC node, and select the JDBC Resources node.

  2. Click New.

    The New JDBC Resource page appears.

  3. In the JNDI Name field, specify a unique name for the non-XA JDBC resource. By convention, the name begins with the jdbc/ string. For example:

    jdbc/iepseOracleNonXA

    You use the JNDI name in a later procedure.

  4. In the Pool Name drop-down menu, select the non-XA connection pool that you created.

  5. Click OK.

    The JDBC resource is created.

ProcedureTo Create the XA Connection Pool

  1. Expand the Resources node and the JDBC node, and select the Connection Pools node.

  2. Click New.

    The New JDBC Connection Pool wizard appears.

  3. In step 1 of the wizard, do the following:

    1. In the Name field, specify a name for the XA connection pool (for example, iepseOraclePoolXA).

    2. In the Resource Type drop-down menu, select javax.sql.XADataSource.

    3. In the Database Vendor drop-down menu, select Oracle.

    4. Click Next.

  4. In step 2 of the wizard, do the following:

    1. Scroll down to the Connection Validation section.

    2. Select the Enabled check box that appears to the right of the Allow Non Component Callers label.

    3. Scroll down to the Additional Properties table.

    4. In the User row, enter the user name of the IEP user (for example, IEPSEDB).

    5. In the Password row, enter the password of the IEP user (for example, IEPSEDB).

    6. In the URL row, enter the string for connecting to the database (for example, jdbc:oracle:thin:@myserver:1521:orcl).

  5. Click Finish.

    The connection pool is created.

  6. Click the connection pool that you just created.

    The Edit Connection Pool page appears.

  7. Click Ping.

    The Admin Console attempts to connect to the database.

    If the connection does not succeed, check to see whether the database is running. Another possible cause is that the URL string is incorrect.

ProcedureTo Create the XA JDBC Resource

  1. Expand the Resources node and the JDBC node, and select the JDBC Resources node.

  2. Click New.

    The New JDBC Resource page appears.

  3. In the JNDI Name field, specify a unique name for the XA JDBC resource. By convention, the name begins with the jdbc/ string. For example:

    jdbc/iepseOracleXA

    You use the JNDI name in a later procedure.

  4. In the Pool Name drop-down menu, select the XA connection pool that you created.

  5. Click OK.

    The JDBC resource is created.

ProcedureTo Enable Automatic Recovery of XA Transactions

  1. Expand the Configuration node and select the Transaction Service node.

  2. Select the Enabled check box that appears to the right of the On Restart label.

  3. Click Save.

ProcedureTo Configure the IEP Service Engine to Use the JDBC Resources

  1. Go to the NetBeans IDE.

  2. In the Services window, expand the Servers node, the GlassFish V2 node, the JBI node, and the Service Engines node.

  3. Right-click the sun-iep-engine node and choose Properties.

    The Properties dialog box appears.

  4. Set the Non XA Data Source Name property to the non-XA JDBC resource that you created (for example, jdbc/iepseOracleNonXA).

  5. Set the XA Data Source Name property to the XA JDBC resource that you created (for example, jdbc/iepseOracleXA).

  6. Set the Database Schema Name property to the user name of the IEP user (for example, IEPSEDB).

    In an Oracle database, the database schema name is identical to the user name.

  7. Click OK.

ProcedureTo Restart the IEP Service Engine

  1. If any Composite Application projects that contain event processes are currently deployed, then undeploy the projects.

  2. In the Services window, expand the Servers node, the GlassFish V2 node, the JBI node, and the Service Engines node.

  3. Right-click the sun-iep-engine node and choose Stop.

  4. Right-click the sun-iep-engine node and choose Start.

  5. If you undeployed any Composite Application projects, then you can now redeploy the projects.

IEP Service Engine-Specific Database Tables

When you start the IEP Service Engine for the first time, the following tables are created in the IEP database. These tables apply to the IEP Service Engine as a whole.


Caution – Caution –

Do not delete or alter these tables.


EMS_PLAN Table

The EMS_PLAN table maintains information about the event processes that are deployed to the IEP Service Engine. The EMS_PLAN table contains the following columns:

EMS_OUTPUT Table

The EMS_OUTPUT table maintains information for event processes that have a Table Output operator. The EMS_OUTPUT table contains the following columns:

EMS_ENGINE Table

The EMS_ENGINE table is used when you are running IEP in cluster mode. The EMS_ENGINE table contains the following columns:

EMS_TOKEN Table

The EMS_TOKEN table is used when you are running IEP in cluster mode. The EMS_TOKEN table contains the following columns:

Event Process-Specific Database Tables

When you deploy an event process, the following tables are created in the IEP database. If you undeploy the event process, then the tables are deleted.


Caution – Caution –

Do not delete or alter these tables.


EMS_PROCESSING_STATE_N Tables

The EMS_PROCESSING_STATE_N tables are used by the IEP Service Engine to maintain execution state for an event process. The EMS_PROCESSING_STATE_N tables contain the following columns:

EMS_TABLE_USAGE_N Tables

The EMS_TABLE_USAGE_N tables are used in garbage collection. The EMS_TABLE_USAGE_N tables contain the following columns:

Operator-Specific Database Tables

In the IEP Service Engine, one or more tables are created per operator. These tables are specific to operator behavior and functionality.


Caution – Caution –

Do not delete or alter these tables.


The following table names illustrate how the names are formatted.

The first character of the table name is always Q.

The character after the first underscore is the ID of the event processor in the EMS_PLAN table.

The characters after the second underscore are the ID of the operator. You can view the operator ID in the IEP design view by selecting the operator and displaying the Properties window.

Screen capture of a selected operator and the Properties
window.

The operator ID is automatically generated. You cannot change the ID.