<Default Package>
Type chunk


EPL plug-in data objects.

Values of the chunk type are references to dynamically allocated opaque objects whose contents cannot be seen or directly manipulated in EPL. They are used by EPL plug-ins to store state information across multiple plug-in method calls.

In EPL, chunk reference values can be held in variables of the type chunk and passed as parameters to plug-ins when they are called. The chunk type lets you reference data that has no equivalent EPL type.

It is not possible to perform operations on data of type chunk from EPL directly; the chunk type exists purely to allow data output by one external library function to pass through to another function. Apama does not modify the internal structure of chunk values in any way. As long as a receiving function expects the same type as that output by the original function, any complex data structure can be passed around using this mechanism.

To use chunks with plug-ins, you must first declare a variable of type chunk. You can then assign the chunk to the return value of an external function or use the chunk as the value of the out parameter in the function call.

Although the chunk type was designed to support unknown data types, it is also a useful mechanism to improve performance. Where data returned by external plug-in functions does not need to be accessed from EPL, using a chunk can cut down on unnecessary type conversion. For example, suppose the output of a localtime() method is a 9-element array of type float. While you could declare this output to be of type sequence<float>, there is no need to do so because the EPL never accesses the value. Consequently, you can declare the output to be of type chunk and avoid an unnecessary conversion from native array to EPL sequence and back again.

An event can contain a field of type chunk, however you cannot send, emit, route, or enqueue an event that has a chunk type field.

A default chunk is uninitialized and it is an error to pass an uninitialized chunk to a plug-in. It is also an error to pass the chunk from a different plug-in to another plug-in.
Action summary
 chunkclone()

Clone a chunk.
 booleanempty()

Check if this chunk is initialized.
 stringgetOwner()

Get the name of the plug-in that created this chunk.
 
Action detail

clone

chunk clone()
Clone a chunk.

This method requests the originating plug-in to create a copy of this chunk. Whether that is a shallow or a deep copy depends on the plug-in.
Returns:
A copy of this chunk.

empty

boolean empty()
Check if this chunk is initialized.
Returns:
True if this chunk does not contain plug-in data, false otherwise.

getOwner

string getOwner()
Get the name of the plug-in that created this chunk.
Returns:
The name of the originating plug-in or an empty string.