Overview of developing Apama applications

Info
The Apama Plugin for Eclipse is deprecated and will be removed in a future release.

Apama runs in Apama Plugin for Eclipse, which provides an integrated environment for developing Apama applications. The process of developing an Apama application is centered around an Apama project. In Apama Plugin for Eclipse, you create an Apama project and then proceed as follows:

  • Create new Apama resources for the application.
  • Include standard, pre-packaged Apama resources.
  • Include existing Apama resources from other projects or applications.
  • Specify configuration properties necessary for launching the application.
  • Run and monitor the application.
  • Export the initialization information necessary for deploying the application.

When you add resources to your application, Apama Plugin for Eclipse creates the resource’s metadata and launches the appropriate editor where you add the code to implement its behavior. As you create the resource’s application code, Apama Plugin for Eclipse automatically validates it. Where necessary, Apama Plugin for Eclipse launches the Apama tool that is appropriate to the specific resource being added.

Starting Apama Plugin for Eclipse

Apama Plugin for Eclipse is started by running the eclipse executable, located in the Designer\eclipse directory.

When you start Apama Plugin for Eclipse for the first time, you are prompted to select the workspace that is to be used. All projects that you will create will be stored in this workspace folder. By default, this is C:\Users\username\workspacenn.

Tutorials

Apama provides several tutorials in Apama Plugin for Eclipse. These are available from the Welcome page, which appears when you start Apama Plugin for Eclipse for the first time and which is always available by choosing
Help > Welcome from the Apama Plugin for Eclipse menu. On the Welcome page, look for the heading Apama, and then click Tutorials.

The tutorials are interactive instructions that get you quickly up to speed writing Event Processing Language programs. Each tutorial provides a skeleton project and a completed project. At the end of the tutorial instructions, you run the project.

When you open a tutorial for the first time, it is copied into the Eclipse workspace. You can revert to the original tutorial without any changes you’ve made at any time by deleting the project as follows:

  1. Right-click the project.
  2. Click Delete.
  3. Select Also delete contents in the confirmation dialog, and click Yes.

Then open the project again from the Apama Tutorials page.

The Apama interface

Apama Plugin for Eclipse provides the following distinct perspectives for working with Apama projects:

In each of the perspectives, you can create projects, add Apama resources, and launch your application. While developing your application, you can switch from one perspective to the other.

When you debug an Apama application, the Eclipse Debug perspective is used by default.

When profiling an Apama application written in the Apama Event Processing Language (EPL), the Apama Profiler perspective is used. See The Apama Profiler perspective.

Info
When using any of the Apama perspectives, you can redisplay the default perspective layout by selecting Window > Perspective > Reset Perspective… from the menu.

The Apama Workbench perspective

The Workbench perspective presents a more streamlined view of a single Apama project. It shows only the resources related to that project and provides a simplified way of launching an Apama application.

The important interface components of the Apama Workbench perspective are:

Workbench Project view

When you develop an application in the Apama Workbench perspective, you work on a single project at a time. The project appears in the Workbench Project view. This is where you add the various Apama resources that are necessary for the application. This is also where you run the application that is represented by the project.

Use the buttons on the Launch Control Panel to start, stop, or restart the project. See Launching projects.

The Apama Developer perspective

The Apama Developer perspective uses the full Eclipse interface and displays all the Apama projects in the user’s workspace. It is designed for experienced developers and assumes that you are familiar with standard Eclipse features.

The important interface components of the Developer perspective are:

Project Explorer view

The Apama Developer perspective uses the standard Eclipse Project Explorer view. The Project Explorer lists the Apama projects you have defined. You can expand and collapse each project to view or hide its contents. You can add any kind of file to an Apama project. For most files, double-clicking the file opens it in the appropriate editor. The Project Explorer view is where you build and launch your projects. For descriptions of the icons in the Project Explorer view, see Managing project hierarchies.

The Apama Runtime perspective

The Apama Runtime perspective is similar to the Apama Developer perspective but is designed for inspecting and interacting with a running Apama application. This perspective is designed for experienced developers and assumes that you are familiar with standard Eclipse features.

To open the Apama Runtime perspective

  1. Select Window > Perspective > Open Perspective > Other… from the menu.
  2. Select Apama Runtime from the Open Perspective dialog.
  3. Click OK.

The Apama Runtime perspective is made up of these views:

About Apama projects

An Apama project typically manages a single Apama application. A project provides a means of keeping the application’s resources organized. In the process of developing an application with Apama Plugin for Eclipse, you add the various resources that make up the application to the project. For example, you can include:

  • EPL files — These files define monitors and associated event types that are used by your application. EPL files have a .mon extension.
  • Bundles — These are pre-packaged collections of Apama objects.
  • Event files — Event files have an .evt extension.

Apama Plugin for Eclipse provides a variety of ways to manage and interact with the resources in your application’s project.

This section briefly describes these Apama features. For more information on how to use them, see Working with Projects and Launching Projects.

Managing project hierarchies

Apama Plugin for Eclipse organizes your project into a hierarchy that is displayed in the Project Explorer view (if you are using the Apama Developer perspective) or the Workbench Project View (if you are using the Apama Workbench perspective). The hierarchy is made up of nodes that group Apama resource files by type. The Project Explorer view lists all your Apama projects, while the Workbench Project View lists just the current project. A different icon is shown for each type of resource.

For example, the following icons can be shown in the above-mentioned views:

Icon Description
(Icon) Apama project.
(Icon) Node with the fix name Connectivity and Adapters which includes all connectivity or IAF adapter bundles that have been added. This is a virtual folder which is not available in the file system. It is provided for your convenience, and it is recommended that you use this folder where possible. The files in the virtual folder are also available in the nodes for the physical folders. For example, connectivity plug-in configuration files that are managed by bundles in this node are also available in the config node of the project and thus in the physical config folder in the file system. It is safe to edit the files in either node.
(Icon) Container node for a specific type of connectivity bundle or IAF adapter bundle.
(Icon) Instance of a connectivity bundle (see also Connectivity bundles) or IAF adapter bundle.
(Icon) YAML configuration file (.yaml). Shown for an instance of a connectivity bundle. See also Configuration file for connectivity plug-ins.
(Icon) Properties file (.properties) that is used together with a YAML configuration file. Shown for an instance of a connectivity bundle. The same icon is also used for .ini files. See also Using properties files.
(Icon) Node with the fix name Linked Resources which contains common configuration files shared by the connectivity bundle instances. See also Linked Resources.
(Icon) Node with the fix name Dependent Bundles which contains references to required connectivity bundles or adapter bundles.
(Icon) Node with the fix name EPL Bundles which includes all EPL bundle instances that have been added. See also Adding bundles to projects.
(Icon) EPL bundle instance.
(Icon) Node for the contents of a bundle, such as EPL files, event files or correlator deployment packages (CDPs).
(Icon) Correlator deployment package file (.cdp). See also Exporting correlator deployment packages.
(Icon) Nodes with the fix names JRE System Library (jvm) and ApamaJavaLibray which contain references to required .jar files. These are virtual folders for content that is not available in the workspace.
(Icon) Node with the fix name java/src which contains the .java files that have been added. This corresponds to the physical java/bin and java/src folders in the file system.
(Icon) Physical folder that is available in the file system.
(Icon) EPL file (.mon) containing monitors or event definitions. See also Creating new monitor files for EPL applications and Creating new event definition files for EPL applications.
(Icon) Apama event file (.evt). See also Creating new event files.
(Icon) EPL plug-in written in Java file (.java); located in the java/src node.

If a monitor file contains an error, an error icon is shown over the file name, over the folder that contains the file that has the error, and over the project folder. For example, a monitor file that contains an error would look like this: (Icon)

Editors

Apama provides wizards and editors in Apama Plugin for Eclipse to create and modify the resource files that define the following:

  • Monitors
  • Events

When you add a resource, Apama Plugin for Eclipse generates the definition file and opens it in the appropriate Apama editor.

As you edit resource files, you can take advantage of the Apama Plugin for Eclipse editing features, including content assistance, auto-bracketing, templates for frequently entered constructs, and problem detection. After you build an Apama project, Apama Plugin for Eclipse flags each line that contains an error.

Outline view

The Outline view shows the structure of the EPL file that is open in an Apama editor. The following illustration displays an Outline view of an EPL file.

(Icon)

When you click on an event type or action in the outline, the editor pane highlights and displays the line of code that defines that item in the file.

Scenario Browser view

The Scenario Browser view displays the DataView definitions that are loaded in the correlator along with the metadata for the DataViews. If you want to add or delete a DataView item, you must use EPL, that is, you have to send another event to the EPL which will then issue the creation or deletion.

For more information on using the view, see Using the Scenario Browser view.

Engine Receive view

The Engine Receive view shows all events generated from the connected correlator.

For more information on the Engine Receive view, see Using the Engine Receive view.

Engine Status view

The Engine Status view displays the information about the correlator status. The information is the same as the output of Apama command line tool engine_watch.

For more information on the Engine Status view, see Using the Engine Status view.

Engine Information view

The Engine Information view inspects a running correlator and displays defined contents of the correlator. It shows the same information as the Apama command line tool engine_inspect.

For more information on the Engine Information view, see Using the Engine Information view.

Console view

The Console view displays information concerning a running Apama application. An application can have several consoles:

  • Correlator — Displays output from the correlator.
  • Engine Inject —Displays initialization information injected to the correlator.
  • Engine Send — Displays information from Apama components that stream data to the correlator.
  • Correlator Initialization — Displays information about the correlator initialization including the Java files, and the .mon files (monitors) that have been injected and the .evt files (events) that have been sent and whether the actions succeeded or failed.

To view one of these consoles, click the drop-down arrow of the Display Selected Console button (Icon) and select the console you want.

Problems view

The Problems view is a standard Eclipse view that lets you view a list of any errors in your EPL files, and ODBC-ADBC and JDBC-ABDC adapter instances. When you build an Apama project, if Apama Plugin for Eclipse detects errors in your project’s files, or file dependency errors, it lists them here. The Problems view appears when you run an application.

Data Player Control view

The Data Player Control view allows you to control how Apama data is played back in an application running in a project. For example, you can specify how fast to play back the event data, step through events one at a time, or specify a Data Player query to filter what events are played back.

For more information on the Data Player Control, see Using the Data Player.

Building Apama projects

Apama Plugin for Eclipse validates Apama projects, in a process known as “building” the project. During validation, Apama Plugin for Eclipse

  • Checks the syntax to ensure that it is valid EPL or Java code.
  • Checks that only valid values have been specified. For example, if you specify integer as the type of a field, it ensures that you specify an integer as the value of the field.
  • Ensures that the dependencies are valid throughout the project.

In summary, Apama Plugin for Eclipse validates that its launcher can inject the project’s EPL files into the correlator.

For more information, see Building Apama projects.

Launching Apama projects

Apama Plugin for Eclipse can launch an Apama project in a test environment. When Apama Plugin for Eclipse launches a project, the default is that it starts an instance of the correlator and injects all the resources that are included in the project. You can change the default launch behavior by editing the launch configuration for the project.

You can specify multiple launch configurations for each Apama project, including configurations for debugging and profiling applications. For each launch configuration, you can:

  • Add correlator arguments.
  • Specify event files that should be sent to initialize/start the application.
  • Specify what adapters to use.
  • Define environment variables, for example, appending directories to the PATH used to start the correlator and any IAF processes.
  • Indicate whether the configuration can be shared among Apama installations.

For more information on creating launch configurations and launching Apama projects, see Launching Projects.