Apama 10.3 | Apama Documentation | Using Apama with Software AG Designer | Working with Projects | Adding resources to Apama projects | Creating new blocks | Creating a block with the block editor
Creating a block with the block editor
Creating a block in Software AG Designer consists of two main steps. In the first step you create the block metadata and specify its interface. In the second step you add the EPL code that implements the block's behavior.
* To add a new block to an Apama project using the block editor
1. In the Project Explorer or Workbench Project view, right-click the default block folder (typically catalogs\project_name blocks) and select New > Block button 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 create the block 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 Block Editor in the Generate block using field and click Next. The Create a new Apama Block dialog appears.
4. In the Create a new Apama Block dialog, fill in the various fields or accept the default values. The most important fields to set at this point are the Block name and Version. 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).
5. Click Finish. The block definition file for the new block is added to the project and the block's metadata appears in the Builder tab of the block editor.
6. The Builder tab displays the parameters, input feeds, output feeds, and operations that make up the block; a new block will not contain any entries here. To add one of these elements:
a. Select the block name and fill in the following fields:
*Name — The name you specify for the block.
*Description — A phrase or sentence or two that indicates what this block does. Software AG Designer does not do anything with this information.
*Code Type — Select one of the following:
*Callback is the recommended code type for all blocks. It implements your block by defining actions on events.
*Callback (DEBUG) is the same as Callback plus it generates verbose logging to help you diagnose problems during development.
You can switch between these two code types. When your block is complete, the recommended code type is Callback.
*ID — Indicates the version number of the block. Then enables you to update your block and maintain multiple versions.
*Creation Date — The date you create the block.
*Author — Your name.
*Comments — Any other information you want to include that might be helpful to other developers using this block in Software AG Designer.
*Parallel-aware — Check this box if the block you are creating can be used in a parallel-aware scenario. When you select this box, it means you are taking responsibility for ensuring that multiple instances of the block can safely, concurrently run in multiple contexts.
*Deprecated — Check this box if you are editing a block that uses a pre-Apama 4.2 code type. The Template, Template(DEBUG), and Interface code types were deprecated in the 4.2 release, and will be removed in a future release. You will need to convert any blocks created with those code types to Callback or Callback (DEBUG). Information for doing this is in the Apama 5.0 migration guide.
b. Right-click the element you want to add and select Add Parameter, Add Input Feed, Add Output Feed, or Add Operation. The right side of the Builder tab displays the item's properties.
Parameter. Parameters are set to initialize the block and whenever its core behavior needs to be modified. Parameters are typed in the same way as scenario variables. The information for field validation is specific to the parameter type.
Input Feed. An input feed can be connected to a live stream of event data, like a price quote stream. Within it, an input feed will define one or more input fields, which can be mapped to data in the stream. When event data arrives, the fields' values get updated. Right-click the Input Feed to add field validation properties.
Output Feed. An output feed corresponds to an event that can be generated by the Block, and embeds one or more output fields as event parameters. The fields are updated as a result of operations carried out by the block. Right-click the Output Feed to add field validation properties.
Operations. You can add explicit operations to a block that can be invoked by the scenario. For example, you can add operations to start and stop processing data.
c. Fill in the values for the properties.
7. For input feeds and output feeds, right-click the element and select Add Field.
8. In the Properties panel for the field you added in the previous step, fill in the values for the properties and field validation specifications. Repeat for each field you want to add to an input or output feed.
9. When you finish specifying the block's metadata, save the file.
For details about adding EPL code to a block, see Adding EPL code to a block.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.