appendEvent
Syntax
appendEvent(engine, events)
Details
The appendEvent function allows direct event appending to event
input queue, avoiding serialization and deserialization compared to writing data
through heterogeneous tables.
Parameters
engine is the engine object returned by createCEPEngine or
streamEventSerializer.
events is a class object of the event instance or a dictionary. If it is a dictionary, the event instances will be automatically constructed with the key-value pairs provided. The keys of the dictionary must include the event type (specified with eventSchema) and all of its event fields.
Examples
Define an event Orders contianing the following fields: sym, val0, val1, and val2.
class Orders{
eventTime :: TIMESTAMP
sym :: STRING
val0 :: INT
val1 :: FLOAT
val2 :: DOUBLE
def Orders(s,v0,v1,v2){
sym = s
val0 = v0
val1 = v1
val2 = v2
eventTime = now()
}
}
class mainMonitor:CEPMonitor {
ordersTable :: ANY
def mainMonitor(){
ordersTable = array(ANY, 0)
}
def updateOrders(event) {
ordersTable.append!([event.sym, event.val0, event.val1, event.val2])
}
def onload(){
addEventListener(updateOrders, 'Orders',,'all')
}
}dummy = table(array(TIMESTAMP, 0) as eventTime,array(STRING, 0) as eventType, array(BLOB, 0) as blobs)
engine=createCEPEngine(name="test_CEP",monitors=<mainMonitor()>,dummyTable=dummy,eventSchema=Orders,timeColumn='eventTime')- events is specified as an instance of an
event:
appendEvent(`test_CEP,Orders("a000", 3, 3.0, 30.0)) - events is specified as a
dictionary:
d=dict(['eventType',"sym", "val0","val1", "val2", "eventTime"],["Orders",'a000',5,float(3.6),double(29.3),2025.09.24T11:35:22.789]) appendEvent(`test_CEP,d)
Related function: addEventListener, createCEPEngine, emitEvent, routeEvent, sendEvent
