Apama Documentation : Using Apama with Software AG Designer : Working with Projects : Adding resources to Apama projects : Creating new blocks : Creating a block from an EPL event definition
Creating a block from an EPL event definition
In cases where you want to create an event from a scenario or to update the scenario types from an Apama event, you should create a block based on the event type.
Creating a block from an existing EPL event definition consists of selecting the event definition from which you want to create the block, specifying whether you want to create an input block or an output block, and specifying what fields in the event are to be used when the block is generated. For input blocks, the specified fields are used to construct listeners; for output blocks, the specified fields are used to set the values of output parameters.
To add a new block to an Apama project from an existing EPL event definition
1. In the Project Explorer or Workbench Project view, right-click the default block folder (typically catalogs\project_name\blocks) and select New > Block from the pop-up context menu. The New Event Modeler Block dialog appears.
2. In the New Event Modeler Block dialog, specify the name of the project in the Containing folder field if you want to use an event definition in a different project; you can also click Browse to select the project from a list of projects in the workspace.
3. Also in the New Event Modeler Block dialog, select EPL event definition in the Generate block using field and click Next. The Select the Block type and Event type dialog appears.
4. In the Select the Block type and Event type dialog, click Browse to display the Event Type Selection dialog. Note, that events with field types chunk, listener, or stream are not listed because they cannot be emitted, routed, or enqueued.
a. In the Event Type Selection dialog‘s Choose an Event Type field, enter the name of the event. As you type, event types that match what you enter are shown in the Matching Events list.
b. In the Matching Events list, select the name of the event type you want to use to generate the block. The name of the EPL file that defines the selected event appears in the status area at the bottom of the dialog.
c. Click OK.
5. In the Select the Block type and EPL type dialog, specify whether you want to generate an input block or an output block. Also, in the Include comments field, add a check if you want to include ApamaDoc comments from the event definition in the generated block code and click Next. The Create New Apama Block dialog appears.
6. In the Create a New Apama Block dialog, specify the name, version, type and description of the new block. By default, Software AG Designer uses the name of the event as the basis for the name of the block. The Type field specifies what type of code will be generated for the block. The choices are:
*Callback — Implements the block as an event type; this is the default. Generates EPL code to which you can add custom code.
*Callback (DEBUG) — Implements the block as an event type. Generates EPL code to which you can add custom code. Also generates statements that can help you debug the EPL you are adding. You can easily switch your block between Callback and Callback (DEBUG).
When you finish entering information, click Next. The Select Block Parameters from Event Fields dialog appears.
7. In the Select Block Parameters from Event Fields dialog, in the Event Fields field, specify the fields to be used to create the block.
Note, for input blocks, fields with inner event fields, and fields of dictionary or sequence types are not displayed. Also, for both input and output blocks, constant, action, and context fields are not displayed.
*When you create a new input block, code is generated for a block parameter and listener for a specified field. If you select more than one field, block parameters and listeners are created for all combinations of all the selected fields. The maximum number of fields you can select is ten.
For input blocks, code is also generated for an output feed that includes all the fields in the specified event, as well as start and stop actions that activate and deactivate the listeners.
*When you create a new output block, code is generated for parameters for the event fields you specify. This means that values for those fields can be specified when the block is used.
8. Click Finish.
The block's .bdf file (the block definition file) is created and opened in the block editor. The left side of the Builder tab displays the parameters, input feeds, output feeds, and operations that are automatically generated from the information you specified for the block. For details about adding EPL code to a block, see Adding EPL code to a block.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback