Apama 10.3 | Apama Documentation | Using Apama with Software AG Designer | Using Query Designer | Creating queries in Query Designer | Adding query actions | Adding query route event actions
Adding query route event actions
In the Query Designer Actions pane, add the route event 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 route actions as well as one or more custom actions.
Before you define query actions, you should add the query input events and specify the query pattern. If this query uses parameters, you should add the query parameters before you add actions. You can then refer to the parameters in the actions.
* To add a route action to a query
1. In the Actions pane of the Query Designer, click the drop down arrow to the right of the plus sign and select Route Event to create a route event action. The New Query Route Event Action dialog appears.
2. Click Choose, and select the Event type.
Note: The Event Type Selection dialog displays the automatically generated query output event definition from other queries in the project. You can select the automatically generated query output event definition as an input to the query. For more information, see Using the output of another query as query input.
3. In the Name field, enter a name for the route event action.
4. In the Description field, optionally enter a description of what the action performs.
5. In the Fields table, specify a value to every field name.
To specify a value to a field name, select the field name and click the edit sign . The Edit dialog appears.
In the Edit dialog:
*To insert an expression, right-click in the text box and select the required expression. Click OK.
*To convert an expression to a plain text:
i. Select the expression that you want to convert to plain text
ii. Right-click the selected expression
iii. Select switch to plain text [ctrl-p]
iv. Click OK
*To convert plain text to an expression:
i. Select the plain text that you want to convert to an expression
ii. Right-click the selected plain text
iii. Select switch to expression [ctrl-e]
iv. Click OK
The Fields table displays event fields and the values to be specified for the event. Values can be any valid EPL expression. Only string literals need to be enclosed within quotes. If any fields that are not present in the event definition have been incorrectly added to the Route Event action's event in the Source editor tab, then these fields are listed in the missing fields table. These missing fields and values are persisted with the Route Event action when you click OK. If you do not want these missing fields and values to persist, click Clear List. Clear List removes all the missing fields and values from the Route Event action.
6. If you have used an or operator in the query pattern, you can select the events to be matched in the Require these events to be matched by the pattern section. Events that are on one side of an or operator in the pattern are optional as they may not be matched by the pattern if the alternative events are matched instead. The Require these events to be matched by the pattern section sets which events must be matched by the pattern in order for the route event action to route the event. If the value from an optional event is used in the route event action, then it must be selected in the Require the events to be matched by the pattern. It is not legal to use the optional events without setting them as required. It is also possible to add optional terms to the Require these events to be matched by the pattern section manually, if routing the event should be conditional on the events being matched.
If the names of the co-assignments in the pattern are modified or removed, then the route event action may refer to old names. Click Clear missing events to remove the missing coassignments.
7. Click OK when the route 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 %route statement in the EPL query definition. The %route() statements appear in the find statement block and can be interleaved with regular EPL.
In the Source view, the modifications you can make to %route statements are to modify the quoted name, the quoted description, and the channel. Any changes you make in the Source view will appear in Query Designer. If there is a syntax error in the Source view, you cannot display the Design view until you correct the error. The recommendation is that only Query Designer should insert %route() statements. 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, provided any Required events set by the route event action have been matched by the pattern.
To edit a route event action, select the route event action and click the edit sign .
To delete a route event action, select the route event action and click the delete sign .
The 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.

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.