Apama 10.15.0 | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The Cumulocity IoT Transport Connectivity Plug-in | Using events
 
Using events
 
Creating a new event
Updating an existing event
Querying for events
The com.apama.cumulocity.Event is sent on an event from a device. This event is sent to the com.apama.cumulocity.Event.SUBSCRIBE_CHANNEL (same as cumulocity.events) channel. This event contains the identifier of the source, a timestamp (same form as currentTime), message text, and optional parameters.
Example of an event:
com.apama.cumulocity.Event("48073557","c8y_EntranceEvent",
"12346082",1519838833.6,
"Entrance event triggered.",
{"creationTime":any(float,1519838834.706)})
Example
The following is a simple example of how to receive, update, create and send events:
// Subscribe to receive all the events published from Cumulocity IoT
monitor.subscribe(Event.SUBSCRIBE_CHANNEL);

// Consume all the events from Cumulocity IoT
on all Event() as e {
log e.toString() at INFO;

// Example for updating an event

// Update text
e.text := "This is an updated text";
send e to Event.SEND_CHANNEL;
}

// Create a new event
Event evt := new Event;
evt.source := "<MANAGED_OBJECT_ID>";
evt.type := "TestEvent";
evt.time := currentTime;
evt.text := "This is a sample event";
send evt to Event.SEND_CHANNEL;