Apama API Reference for .NET
10.1.0.5
|
An Event object representing an event instance in flat event string format and/or structured format (as defined by its associated Apama.Event.Parser.EventType). More...
Public Member Functions | |
Event (string eventString) | |
Constructor to create an Event instance based on a raw event string. More... | |
Event (string eventString, string channel) | |
Constructor to create an Event instance based on a raw event string, and the channel More... | |
Event (string eventString, string channel, double time) | |
Constructor to create an Event instance based on a raw event string, and the channel and time when the event arrived. More... | |
Event (EventType eventType) | |
Constructor to create an Event based on an EventType. The name of the event will be derived from the eventType. More... | |
Object | GetField (string name) |
Get the value of a field in this event instance (without generic type safety). More... | |
T | GetField< T > (Field< T > fieldDefinition) |
Get the value of a field in this event instance (recommended overload, with generic type safety). More... | |
T | GetField< T > (string fieldName, FieldType< T > fieldType) |
Get the value of a field in this event instance (with generic type safety). More... | |
virtual void | SetEventParser (EventParser eventParser) |
Method to set the user-provided EventParser. If an EventParser is not provided, the EventParser.GetDefaultParser(false) will be used for parsing the event. More... | |
void | SetField (string name, object value) |
Set the value of a field in this event instance (without generic type safety). More... | |
Event | SetField< T > (Field< T > fieldDefinition, T value) |
Set the value of a field in this event instance (recommended overload, with generic type safety). More... | |
Event | SetField< T > (string fieldName, FieldType< T > fieldType, T value) |
Set the value of a field in this event instance (with generic type safety). More... | |
override string | ToString () |
Retrieve the event's type and its contents as a String. This call is equivalent to the Text property. More... | |
Properties | |
string | Channel [get, set] |
The channel name the event was received on. More... | |
virtual EventType | EventType [get] |
Get the EventType for this Event. More... | |
virtual System.Collections.Generic.IDictionary < string, Object > | FieldsMap [get] |
Provides access to the fieldName/value dictionary of the event fields. More... | |
string | Name [get] |
The Name of the event type. More... | |
string | Text [get] |
The Apama string representation of the event. More... | |
double | Time [get, set] |
The time when the event was received. More... | |
An Event object representing an event instance in flat event string format and/or structured format (as defined by its associated Apama.Event.Parser.EventType).
To get a parsed Event object from an event string, call Apama.Event.Parser.EventParser.Parse (or Apama.Event.Parser.EventType.Parse(string); to build up an Event from a set of field values, start by using the Event(EventType) constructor.
See the Apama.Event.Parser.EventType documentation for an example of how event strings may be generated and parsed using this class.
The event field values can be updated or retrieved by calling the SetField() and GetField() methods respectively.
In order to make the Event "known" to the Correlator, the event definition must be injected to the correlator by using the engine_inject command (or equivalent) before it is sent into the Correlator.
Apama.Event.Event.Event | ( | string | eventString | ) |
Constructor to create an Event instance based on a raw event string.
E.g. "SampleEvent(\"field1Value",[1,2,3,4],2.0)" where an Event instance named SampleEvent will be created. In the above example, the event has three fields with values:
1st field = "field1Value", a String type 2nd field = [1,2,3,4], a sequence of integers 3rd field = 2.0, a float type
eventString | The event text (raw event). Can be null or "", in which case null or "" will be returned if user asked for the text with the Text property |
Apama.Event.Event.Event | ( | string | eventString, |
string | channel | ||
) |
Constructor to create an Event instance based on a raw event string, and the channel
E.g. "SampleEvent(\"field1Value",[1,2,3,4],2.0)" where an Event instance named SampleEvent will be created. In the above example, the event has three fields with values:
1st field = "field1Value", a String type 2nd field = [1,2,3,4], a sequence of integers 3rd field = 2.0, a float type
eventString | The event text (raw event). Can be null or "", in which case null or "" will be returned if user asked for the text with the Text property |
channel | The channel the event arrived on |
Apama.Event.Event.Event | ( | string | eventString, |
string | channel, | ||
double | time | ||
) |
Constructor to create an Event instance based on a raw event string, and the channel and time when the event arrived.
E.g. "SampleEvent(\"field1Value",[1,2,3,4],2.0)" where an Event instance named SampleEvent will be created. In the above example, the event has three fields with values:
1st field = "field1Value", a String type 2nd field = [1,2,3,4], a sequence of integers 3rd field = 2.0, a float type
eventString | The event text (raw event). Can be null or "", in which case null or "" will be returned if user asked for the text with the Text property |
channel | The channel the event arrived on |
time | The time the event arrived |
Apama.Event.Event.Event | ( | EventType | eventType | ) |
Object Apama.Event.Event.GetField | ( | string | name | ) |
Get the value of a field in this event instance (without generic type safety).
Consider using the generic type-safe alternatives GetField<T>(Field<T>) or GetField<T>(string, FieldType<T>) instead of this method.
The type of the value that is returned depends on which Apama Apama.Event.Parser.FieldType is associated with the field in the Apama.Event.Parser.EventType definition. For example, if the field's type is a SequenceFieldType(FloatFieldType.Type)
then the returned value will be an object that implements the System.Collections.IList interface, and contains double objects for each float in the sequence. More information about the classes used to represent field values is available in the documentation for each com.apama.event.parser.*FieldType
class.
If a value is not explicitly set then default value for the FieldType associated with this field in the EventType definition is returned. See defaultValue()
method of the corresponding com.apama.event.parser.*FieldType
class for more information about default value for this field.
name | The name of the field to retrieve |
Apama.Event.Parser.ParserRuntimeException | If there was a problem during parsing of the event string, or if the specified field name is not a valid field in this event type. |
T Apama.Event.Event.GetField< T > | ( | Field< T > | fieldDefinition | ) |
Get the value of a field in this event instance (recommended overload, with generic type safety).
fieldDefinition | The field of interest. This is typically (but not necessarily) the Field object that was used to construct the EventType registered with the parser. |
Apama.Event.Parser.ParserRuntimeException | ParserRuntimeException if there was a problem during parsing of a event string or if the specified field is not a valid field in this event type. An exception should never be thrown if the field exists and the event was parsed from an event string. |
T Apama.Event.Event.GetField< T > | ( | string | fieldName, |
FieldType< T > | fieldType | ||
) |
Get the value of a field in this event instance (with generic type safety).
fieldName | The name of the field whose value should be retrieved. |
fieldType | The type of the field. |
Apama.Event.Parser.ParserRuntimeException | ParserRuntimeException if there was a problem during parsing of a event string or if the specified field is not a valid field in this event type. An exception should never be thrown if the field exists and the event was parsed from an event string. |
|
virtual |
Method to set the user-provided EventParser. If an EventParser is not provided, the EventParser.GetDefaultParser(false) will be used for parsing the event.
eventParser | The EventParser for parsing the event. |
void Apama.Event.Event.SetField | ( | string | name, |
object | value | ||
) |
Set the value of a field in this event instance (without generic type safety).
Consider using the generic type-safe alternatives SetField<T>(Field<T>, T) or SetField<T>(string, FieldType<T>, T) instead of this method.
The type of the value that must be provided depends on which Apama Apama.Event.Parser.FieldType is associated with the field in the Apama.Event.Parser.EventType definition. For example, if the field's type is a SequenceFieldType(FloatFieldType.Type)
then the value must be an object that implements the System.Collections.IList interface, and contains double objects for each float in the sequence. More information about the classes used to represent field values is available in the documentation for each com.apama.event.parser.*FieldType
class.
name | The name of the field. |
value | The value of the field. The specified value must be assignable to the .NET type associated with the Apama FieldType for this field in the event definition. The null value is converted to default value for the FieldType associated with this field in the EventType definition. See defaultValue() method of the corresponding com.apama.event.parser.*FieldType class for more information about default value for this field. |
Apama.Event.Parser.ParserRuntimeException | If there was a problem during initial parsing of the original event string, or if the specified name is not a valid field for this event type. |
Event Apama.Event.Event.SetField< T > | ( | Field< T > | fieldDefinition, |
T | value | ||
) |
Set the value of a field in this event instance (recommended overload, with generic type safety).
Note that on some early .NET compilers it may be necessary to explicitly specify the generic type parameter for container types when using a passing a value whose type is a concrete class rather than an interface, e.g. e.SetField<IList<double>>(f, new List<double>())
.
fieldDefinition | A field object representing the field's name and type. |
value | The value of the field. The null value is converted to default value for the FieldType associated with this field in the EventType definition. See defaultValue() method of the corresponding com.apama.event.parser.*FieldType class for more information about default value for this field. |
Apama.Event.Parser.ParserRuntimeException | If there was a problem during initial parsing of original event string, or if the specified field name is not a valid field in this event type. |
Event Apama.Event.Event.SetField< T > | ( | string | fieldName, |
FieldType< T > | fieldType, | ||
T | value | ||
) |
Set the value of a field in this event instance (with generic type safety).
fieldName | The name of the field. |
fieldType | The type of the field. |
value | The value of the field. The null value is converted to default value for the FieldType associated with this field in the EventType definition. See defaultValue() method of the corresponding com.apama.event.parser.*FieldType class for more information about default value for this field. |
Apama.Event.Parser.ParserRuntimeException | If there was a problem during initial parsing of the original event string, or if the specified field name is not a valid field in this event type. |
override string Apama.Event.Event.ToString | ( | ) |
Retrieve the event's type and its contents as a String. This call is equivalent to the Text property.
|
getset |
The channel name the event was received on.
This currently only has meaning for events which have been sourced from the correlator, in which case it is set to the name of the channel the event was emitted from, or "" (the empty string) for the wildcard channel.
The event's channel name.
|
get |
Get the EventType for this Event.
|
get |
Provides access to the fieldName/value dictionary of the event fields.
The dictionary containing the event fields. Keys are the field names and values are the corresponding field values.
Note that the dictionary is NOT ordered, so callers should not expect a consistent or deterministic order (wrap the result in a SortedDictionary if that is required).
The resulting map should not be changed by the caller.
Apama.Event.Parser.ParserRuntimeException | If there was a problem during initial parsing of a textual event. |
|
get |
The Name of the event type.
The name of the event type, or null if the event string is null, invalid or empty
|
get |
The Apama string representation of the event.
|
getset |
The time when the event was received.
This currently only has meaning for events which have been sourced from the correlator, in which case it is set to the correlator time at which it was created, or the value it was set to explicitly by code running within the correlator.
The event's timestamp