Developing Apama Applications > Developing Apama Applications in Event Modeler > Using Standard Blocks > Blocks for working with scenario blocks > Change Observer v2.0
Change Observer v2.0
The Change Observer block watches sub-scenarios for changes in the value of one of the sub-scenario variables. You specify which variable you want to watch. When the value changes, the Change Observer block sends data to its change output feed. The output feed indicates the old value and the new value.
Description
To use the Change Observer block, wire output fields from the scenario block to input fields of the Change Observer block. Typically, you want to map the scenario block instance id output field to the Change Observer stream input field. Then map one of the sub-scenario variables from the scenario block output feed to the Change Observer watchValue input field. When the Change Observer block detects a change in a variable value, it sends notification of this change to its output feed.
Typically, you use the sub-scenario instance ID as the key. The key’s associated value is the variable whose value you want to watch.
You can specify a filter so that you obtain results from a particular set of sub-scenarios.
You can also remove keys and their associated values from the Change Observer block’s internal data store. This lets you exclude certain data from calculations. One way to do this is to define a global rule that watches for sub-scenarios to terminate. When a sub-scenario terminates, you can specify its instance ID as the key and remove the data for that key from the Change Observer block’s store of data.
For a detailed example of using the Change Observer block, see Observing changes in sub-scenarios.
Parameters
Parameter
Description
filter
String that indicates that you want to observe those key/value pairs for which the input filter field matches this field. An empty string as the value of either the filter parameter or the input filter field indicates that there is no filtering. If the value of the filter is "not equal to" parameter is true, and you specify a value for the filter parameter, the Change Observer block observes key/value pairs for which the input filter field does NOT match the value of the filter parameter.
keyToDelete
String that indicates a key for which you want to delete data from the Change Observer block’s internal store of data. Invoke the deleteKey operation to delete the data associated with this key.
filter is "not equal to"
Boolean that indicates whether you want to match or not match the value of the filter parameter. When the filter is "not equal to" parameter is true, the Change Observer block observes key/value pairs for which the input filter field does NOT match the value of the filter parameter.
Operations
Operation
Description
reset
The Change Observer block stores data about the number of unique keys it has observed and their most recent associated values. This operation flushes that data; it is no longer accessible to the Change Observer block.
deleteKey
Deletes the key defined by the keyToDelete parameter. This operation deletes data from the Change Observer block’s internal store of data. If the value of the keyToDelete parameter is an empty string, this operation does nothing.
Input feed
The Change Observer input input feed provides the key, the value, and possibly a filter.
Feed
Fields
Description
input
stream
String that contains the key for which you want the Change Observer block to observe changes. Typically, the key is the instance ID of a sub-scenario. The Change Observer block ignores blank keys, that is, a key that is an empty string.
watchValue
String that contains the field you want to watch. Typically, this is the value of a sub-scenario variable.
filter
String that contains a filter for determining the key/value pairs you are interested in.
Output feed
The Change Observer change output feed indicates the key, its old value, and its new value.
Feed
Fields
Description
change
stream
String that contains the key that this change is for. Typically, this is the instance ID of a sub-scenario.
oldValue
String that contains the value of the variable being observed just before the value changed.
newValue
String that contains the new value of the variable being observed.
Copyright © 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.