Apama 10.15.0 | Using Apama with Software AG Designer | Using Query Designer | Creating queries in Query Designer | Adding query actions | Adding query custom EPL actions
 
Adding query custom EPL actions
In the Query Designer Actions pane, add the custom EPL actions you want Apama to perform when it finds a match for the event pattern specified in the query. You can specify one or more custom actions as well as one or more send actions. See Adding query actions for an understanding of these two kinds of actions.
Before you define query actions, you should add the query input events and specify the query pattern. If this is a parameterized query, you should add the query parameters before you add actions. You can then refer to the parameters in the actions.
*To add a custom action to a query
1. In the Query Designer Actions pane, click the down arrow to the right of the plus sign Plus sign and down arrow and select Custom EPL to display the New Query Custom EPL Action dialog.
2. In the Name field, enter a name for the custom action.
3. In the Description field, optionally enter a description of what the actions does.
4. In the Custom EPL code editor, enter the EPL code that defines the action. You define an action in a query in the same way that you define an action in a monitor except that when you use the New Query Custom EPL Action wizard, you cannot specify action arguments nor an action return value. The numbers in the left column approximately indicate the lines that the code you enter will be on if you click the Source tab to view the query code.
As define your action, Query Designer can help you with completion proposals. See Obtaining content assistance and Using auto-completion.
5. The Errors field displays information about any errors in the EPL you enter. You must resolve any errors before you can save the action.
6. Click OK when the action definition is complete.
If you look at the Source view of the query, you can see that for each action you define, Query Designer inserts a %custom statement in the EPL query definition. The %custom() statements appear in the find statement block and can be interleaved with regular EPL.
In the Source view, the modifications you can make to %custom statements are to modify the quoted name, the quoted description, or the EPL in the block. The block contains the action definition you entered in the Custom EPL code editor. Any changes you make in the Source view will appear in Query Designer. If you make an invalid change in the source then you cannot display the Design view until you correct the error.
The recommendation is that only the Query Designer should insert %custom()statements.
7. At runtime, when the query finds a match it executes all specified actions in the order in which they are listed in the Actions pane. Two arrows at the top of the Actions pane let you change this order. To change the order, select the action you want to move and then click the appropriate arrow as many times as needed.