What's New in Apama > What’s New in Apama 5.0 > Changes to EPL features in Apama 5.0
Changes to EPL features in Apama 5.0
In Apama 5.0, EPL includes the following new features and changes:
*Backwards incompatible change to Time Format correlator plug-in
The Time Format correlator plug-in parse() functions now return NaN when they cannot parse the specified string. In previous releases, these functions returned -1 when they could not parse the specified string. This applies to the parse(), parseTime(), parseUTC(), parseTimeUTC(), parseWithTimeZone(), and parseTimeWithTimeZone() functions.
*Backwards incompatible change to non-parseable objects
In previous releases, if you called the parse() method on one of the following objects, the code compiled but failed at runtime. With this release, such code does not compile.
*An event that contains an unparseable field
*A sequence that contains unparseable items
*A dictionary whose key or item type is unparseable
*Change in enqueue...to behavior
The following code now causes the correlator to terminate the monitor instance because it enqueues an event to a default context value rather than an actual context. In previous releases, this code did nothing silently.
monitor m {
   context c;
   action onload()
   {
      enqueue A() to c;
   }
}
If you enqueue an event to a sequence of contexts and one of the contexts has the default value then the correlator terminates the monitor instance.
*Stream queries
*A stream type can now contain any type of item. Previously, a stream type was restricted to containing boolean, float, integer, string, or event type items.
*You can now specify a having clause to filter the items produced from the stream query's projection.
*Projections are now categorized as one of simple istream, simple rstream or aggregate. Simple istream and rstream projections do not use aggregates and cannot be grouped; the rstream keyword is not useful in conjunction with an aggregate projection, and this usage has been withdrawn.
*EPL now supports the decimal primitive data type. When perfect accuracy in working with decimal fractions is a requirement, use the decimal data type in place of the float data type. When you are not working with decimal values then using float types is the right choice. For example, it makes sense to use decimal types to compute 3.9% interest on $127,729.23 if it is important that the answer be exact. Conversely, there is no reason to use a decimal type to determine the area of circle, for example, because pi is not a decimal fraction. When extremely small floating point variations are acceptable, you might choose to use the float data type to obtain better performance.
A decimal data type is a signed, decimal, floating point number. Either a decimal point (.) or an exponent symbol (e) must be present within the number for it to be a valid decimal. Also, there must be a decimal suffix (d) to distinguish it from a float data type.
Streams of decimal type items are supported. The built-in aggregate functions that you can specify in stream query projections support decimal types.
Correlator plug-ins, Event Modeler, DataViews, and dashboards do not support use of the decimal type.
*New string methods
*The new string.intern() method is an optimization that can reduce memory use. This method takes no arguments, returns the interned version of the string that it is called on, and marks the string as being interned, which means that the correlator uses the same string object for every subsequent occasion that the same string is parsed.
*The new string.replaceAll(string1, string2) method makes a copy of the string that the method is called on, replaces instances of string1 in the copy with instances of string2, and returns the updated copy.
*The new string.split(string) method splits the string that is the argument at occurences of the string that the method is called on and returns a sequence that contains the new strings.
*The new string.tokenize(string) method divides the string argument into tokens where each token is separated from its neighbors by one or more delimiters in the string that the method is called on. The tokenize() method returns a sequence of strings.
*It is now possible to use any comparable type as the key in a dictionary. The comparable types are:
*boolean
*decimal
*float
*integer
*string
*context
*dictionary if it contains items that are a comparable type
*event if it contains only comparable types
*location
*sequence if it contains items that are a comparable type
*New dictionary methods:
*The dictionary.getOr(key, alternative) method either retrieves an existing item by its key or returns the specified alternative.
*The dictionary.getOrDefault(key) method either retrieves an existing item by its key or returns a default instance of the dictionary's item type if the dictionary does not contain the specified key.
*The getOrAdd(key, alternative) method either retrieves an existing item by its key or if the dictionary does not already contain an item with the specified key then it adds the specified key to the dictionary with the specified value and then returns that value.
*The getOrAddDefault(key) method either retrieves an existing item by its key or if the dictionary does not already contain an item with the specified key then it adds the specified key to the dictionary with a default-constructed value and returns that value.
The getOr() methods let you avoid calls to the hasKey() method before you look up a key. This leads to safer, simpler, and faster code.
Before Apama 5.0, the dictionary.getOr() method was called dictionary.getDefault(). The getDefault() method remains only for backwards compatibility and should not be used. It is deprecated and will be removed in a future release. Use the dictionary.getOr() method instead.
*The new sequence.setCapacity(integer) method sets the amount of memory initially allocated for the sequence. Note that this does not limit the amount of memory the sequence can use. By default, as you add more elements to a sequence, the correlator allocates more memory. Calling sequence.setCapacity() can improve performance because it removes the need to add more memory each time you add an element to the sequence. For example, consider a sequence that will contain at least 1000 elements. A call to setCapacity(1000) removes the need to allocate additional memory unless more than 1000 elements are added. A call to this method does not change the behavior of your code.
*The new context.isPublic() method returns a Boolean value that indicates whether the context is public.
*New chunk methods
*empty() – returns true if the chunk is empty. This lets you distinguish between a chunk that contains a default initialization value and a chunk that has been populated by a correlator plug-in.
*getOwner() – returns a string that contains the name of the correlator plug-in that the chunk belongs to. This method returns an empty string if the chunk is empty.
*Keywords
*persistent is now a keyword. It is an error to use it as an identifier unless you prefix it with a hash symbol (#).
*The streamsource keyword is reserved for future use. It is an error to use streamsource as an identifier unless you prefix it with a hash symbol (#).
*The generates keyword is no longer reserved for future use. You can use generates as an identifier.
*The onBeginRecovery() and onConcludeRecovery() actions are now handled by the correlator in the same way as the other special actions, onload(), ondie(), and onunload(). That is, the correlator ensures that any onBeginRecovery() and onConcludeRecovery() actions do not take arguments and do not return values. It is a compile-time error if you define one of these actions with any other signature. Also, you cannot use onBeginRecovery or onConcludeRecovery as the name for any of the following:
*Global variable (monitor scope)
*Event field
*Aggregate function field
*When you expose a MemoryStore table as a DataView you can now specify the display name and/or the description for the exposed DataView. Previously, the MemoryStore always used a default display name and description.
*The names open, close and reset are no longer reserved for future use. A custom aggregate function can have members with these names.
*The following sample event interfaces and monitors, some of which are specific to capital market solutions, have been removed from Apama 5.0:
*DatabaseSupport.mon
*MultiLegOrderManagerSupport.mon
*OrderManagerSupport.mon
*ScenarioOrderService.mon
*SimpleExchangeSimulator.mon
*SimpleNonPersistentDatabase.mon
*SimplePriceGenerator.mon
*TickManagerSupport.mon
*Payload Extraction correlator plug-in is deprecated. All Apama adapter products now use dictionary-format payloads rather than string-format payloads. The dictionary-format payload is considerably more efficient in almost all cases. While string-format payloads are still accepted in Apama 5.0, this support, including the Payload Extraction correlator plug-in, is now deprecated and will be removed in a future release of the Apama platform. It is recommended that all third-party adapters are migrated to dictionary-format payloads as soon as possible.
*The EPL call statement was deprecated in previous releases and has been removed in this release. To invoke an action, see "Defining actions" in Developing Apama Applications with EPL.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.