FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | FIELD | ACTION | DETAIL: IMPORT | CONSTANT | FIELD | ACTION |
Alarm("22","c8y_UnavailabilityAlarm","12669915",1464365565.661,"No communication with device since 2016-05-27T18:11:23.886+02:00",STATUS_ACKNOWLEDGED,SEVERITY_MAJOR,1,{})
Alarm("11","com_cumulocity_events_BatteryWarning","1122",1464365565.661,"Low battery level",STATUS_ACTIVE,SEVERITY_MINOR,1,{"history":{}})
// Create an Alarm:
send Alarm("","c8y_UnavailabilityAlarm","12669915",1464365565.661,"No communication with device since 2016-05-27T18:11:23.886+02:00",STATUS_ACKNOWLEDGED,SEVERITY_MAJOR,1,new dictionary<string,any>) to Alarm.SEND_CHANNEL;
// Update the text, status and severity fields:
send Alarm("11","c8y_UnavailabilityAlarm","12669915",1464365565.661,"Low battery level",STATUS_ACTIVE,SEVERITY_MINOR,1,new dictionary<string,any>) to Alarm.SEND_CHANNEL;
Constant summary | |
---|---|
string | CHANNEL := "CumulocityIoTGenericChain" The channel for sending updates/ new Alarms to.
|
string | NOTIFICATION_CREATED := "CREATED" Value of PARAM_NOTIFICATION that indicates this is a new object. |
string | NOTIFICATION_UPDATED := "UPDATED" Value of PARAM_NOTIFICATION that indicates this is an update to an existing object. |
string | PARAM_NOTIFICATION := ".apama_notificationType" Entry in params that identifies if this is a new object or an update to an existing object. Entry will have a value matching either NOTIFICATION_CREATED or NOTIFICATION_UPDATED. |
string | SEND_CHANNEL := "CumulocityIoTGenericChain" The channel for sending Alarms. |
string | SEVERITY_CRITICAL := "CRITICAL" Value when alarm severity is CRITICAL. |
string | SEVERITY_MAJOR := "MAJOR" Value when alarm severity is MAJOR. |
string | SEVERITY_MINOR := "MINOR" Value when alarm severity is MINOR. |
string | SEVERITY_WARNING := "WARNING" Value when alarm severity is WARNING. |
string | STATUS_ACKNOWLEDGED := "ACKNOWLEDGED" Status value when an alarm is ACKNOWLEDGED. |
string | STATUS_ACTIVE := "ACTIVE" Status value when an alarm is ACTIVE. |
string | STATUS_CLEARED := "CLEARED" Status value when an alarm is CLEARED. |
string | SUBSCRIBE_CHANNEL := "cumulocity.measurements" The channel for receiving Alarm notifications. |
Field summary | |
---|---|
string | id Unique identifier for this Alarm. |
string | type The type of the Cumulocity event. |
string | source Identifier of the managed object associated with the event. |
float | time Timestamp of the event. |
string | text Text or message of the Alarm. |
string | status The status of the alarm as defined by the STATUS_* constants: ACTIVE, ACKNOWLEDGED or CLEARED. |
string | severity The severity of the alarm as defined by the SEVERITY_* constants: CRITICAL, MAJOR, MINOR or WARNING. |
integer | count The number of times this alarm has been sent. |
dictionary<string, any> | params Any other properties available on the Alarm. Note: This dictionary cannot be manipulated to delete fragments in the Alarm. |
Action summary | |
---|---|
boolean |
isCreate() Check if this Alarm instance was as a result of an alarm being created in Cumulocity. |
boolean |
isUpdate() Check if this Alarm instance was as a result of an alarm being updated in Cumulocity. |
com.apama.cumulocity.ResponseWrapper |
withChannelResponse(integer reqId, dictionary<string, string> headers) Create or update an Alarm in Cumulocity and receive a response event confirming the change on Alarm.SUBSCRIBE_CHANNEL channel. |
com.apama.cumulocity.ResponseWrapper |
withResponse(integer reqId, dictionary<string, string> headers) Create or update an Alarm in Cumulocity and receive a response event on default channel, confirming the change.
|
Constant detail |
---|
string CHANNEL := "CumulocityIoTGenericChain"
string NOTIFICATION_CREATED := "CREATED"Value of PARAM_NOTIFICATION that indicates this is a new object.
string NOTIFICATION_UPDATED := "UPDATED"Value of PARAM_NOTIFICATION that indicates this is an update to an existing object.
string PARAM_NOTIFICATION := ".apama_notificationType"Entry in params that identifies if this is a new object or an update to an existing object. Entry will have a value matching either NOTIFICATION_CREATED or NOTIFICATION_UPDATED.
string SEND_CHANNEL := "CumulocityIoTGenericChain"The channel for sending Alarms.
string SEVERITY_CRITICAL := "CRITICAL"Value when alarm severity is CRITICAL.
string SEVERITY_MAJOR := "MAJOR"Value when alarm severity is MAJOR.
string SEVERITY_MINOR := "MINOR"Value when alarm severity is MINOR.
string SEVERITY_WARNING := "WARNING"Value when alarm severity is WARNING.
string STATUS_ACKNOWLEDGED := "ACKNOWLEDGED"Status value when an alarm is ACKNOWLEDGED.
string STATUS_ACTIVE := "ACTIVE"Status value when an alarm is ACTIVE.
string STATUS_CLEARED := "CLEARED"Status value when an alarm is CLEARED.
string SUBSCRIBE_CHANNEL := "cumulocity.measurements"The channel for receiving Alarm notifications.
Field detail |
---|
integer countThe number of times this alarm has been sent.
string idUnique identifier for this Alarm.
dictionary<string, any> paramsAny other properties available on the Alarm. Note: This dictionary cannot be manipulated to delete fragments in the Alarm.
string severityThe severity of the alarm as defined by the SEVERITY_* constants: CRITICAL, MAJOR, MINOR or WARNING.
string sourceIdentifier of the managed object associated with the event.
string statusThe status of the alarm as defined by the STATUS_* constants: ACTIVE, ACKNOWLEDGED or CLEARED.
string textText or message of the Alarm.
float timeTimestamp of the event.
string typeThe type of the Cumulocity event.
Action detail |
---|
boolean isCreate()Check if this Alarm instance was as a result of an alarm being created in Cumulocity.
boolean isUpdate()Check if this Alarm instance was as a result of an alarm being updated in Cumulocity.
com.apama.cumulocity.ResponseWrapper withChannelResponse(integer reqId, dictionary<string, string> headers)Create or update an Alarm in Cumulocity and receive a response event confirming the change on Alarm.SUBSCRIBE_CHANNEL channel.
monitor.subscribe(Alarm.SUBSCRIBE_CHANNEL);
Alarm a := new Alarm;
// set fields in a
integer reqId := com.apama.cumulocity.Util.generateReqId();
on ObjectCommitted(reqId=reqId) as commit and not ObjectCommitFailed(reqId=reqId) {
// do something
}
on ObjectCommitFailed(reqId=reqId) as failure and not ObjectCommitted(reqId=reqId) {
// do something
}
send a.withChannelResponse(reqId, { "X-Cumulocity-Processing-Mode": "TRANSIENT" }) to Alarm.SEND_CHANNEL;
com.apama.cumulocity.ResponseWrapper withResponse(integer reqId, dictionary<string, string> headers)
Alarm a := new Alarm;
// set fields in a
integer reqId := com.apama.cumulocity.Util.generateReqId();
on ObjectCommitted(reqId=reqId) as commit and not ObjectCommitFailed(reqId=reqId) {
// do something
}
on ObjectCommitFailed(reqId=reqId) as failure and not ObjectCommitted(reqId=reqId) {
// do something
}
send a.withResponse(reqId, { "X-Cumulocity-Processing-Mode": "TRANSIENT" }) to Alarm.SEND_CHANNEL;
FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | FIELD | ACTION | DETAIL: IMPORT | CONSTANT | FIELD | ACTION |