Sample EPL
The sample EPL below describes how to subscribe and receive device measurements, device events and device information.
package com.apama.cumulocity.sample;
monitor SampleApplication {
action onload() {
// Subscribe to receive all the devices from Cumulocity IoT
monitor.subscribe(com.apama.cumulocity.ManagedObject.CHANNEL);
// Consume all the devices from Cumulocity IoT
on all com.apama.cumulocity.ManagedObject() as d {
log d.toString() at INFO;
}
// Subscribe to receive all the measurements published from
// Cumulocity IoT
monitor.subscribe(com.apama.cumulocity.Measurement.CHANNEL);
// Consume all the measurements from Cumulocity IoT
on all com.apama.cumulocity.Measurement() as m {
log m.toString() at INFO;
}
// Consume all the events from Cumulocity IoT
on all com.apama.cumulocity.Event() as e {
log e.toString() at INFO;
}
// Consume all the alarms from Cumulocity IoT
on all com.apama.cumulocity.Alarm() as alarm {
log alarm.toString() at INFO;
}
}
}