com.apama.cumulocity
Event Alarm


Alarm data.

Sent by the transport when a device or other application creates an Alarm, or updates an Alarm. Requires SubscribeMeasurements or configuration property subscribeToAllMeasurements. Sent to the cumulocity.measurements channel.

Examples:
 Alarm("22","c8y_UnavailabilityAlarm","12669915",1464365565.661,"No communication with device since 2016-05-27T18:11:23.886+02:00","ACKNOWLEDGED","MAJOR",1,{}) 
Alarm("11","com_cumulocity_events_BatteryWarning","1122",1464365565.661,"Low battery level","ACTIVE","MINOR",1,{"history":{}})


Additionally, we can also create a new Alarm or update an existing Alarm for a device. To create/update an Alarm, send an Alarm event object to Alarm.SEND_CHANNEL.

Examples:
 Create an Alarm, send Alarm("","c8y_UnavailabilityAlarm","12669915",1464365565.661,"No communication with device since 2016-05-27T18:11:23.886+02:00","ACKNOWLEDGED","MAJOR",1,{}) to Alarm.SEND_CHANNEL; 
You can update the text, status and severity fields. send Alarm("11","c8y_UnavailabilityAlarm","12669915",1464365565.661,"Low battery level","ACTIVE","MINOR",1,{}) to Alarm.SEND_CHANNEL;

Constant summary
 stringCHANNEL := "CumulocityIoTGenericChain"

The channel for sending updates/ new Alarms to.
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL for sending and SUBSCRIBE_CHANNEL for receiving events.]
 stringSEND_CHANNEL := "CumulocityIoTGenericChain"

The channel for sending Alarms.
 stringSUBSCRIBE_CHANNEL := "cumulocity.measurements"

The channel for receiving Alarms.
 
Member summary
 stringid

Unique identifier for this Alarm.
 stringtype

The type of the Cumulocity event.
 stringsource

Identifier of the source of the event.
 floattime

Timestamp of the event.
 stringtext

Text or message of the Alarm.
 stringstatus

The status of the alarm: ACTIVE, ACKNOWLEDGED or CLEARED.
 stringseverity

The severity of the alarm: CRITICAL, MAJOR, MINOR or WARNING. Must be upper-case.
 integercount

The number of times this alarm has been sent.
 dictionary<stringany>params

Any other propertiess available on the Alarm .
 
Action summary
 com.apama.cumulocity.ResponseWrapperwithResponse(integer reqId, dictionary<stringstring> headers)

Create or update a Alarm in Cumulocity and receive a response event confirming the change.
 
Constant detail

CHANNEL

string CHANNEL := "CumulocityIoTGenericChain"
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL for sending and SUBSCRIBE_CHANNEL for receiving events.]
The channel for sending updates/ new Alarms to.

SEND_CHANNEL

string SEND_CHANNEL := "CumulocityIoTGenericChain"
The channel for sending Alarms.
Since:
10.5.2.0

SUBSCRIBE_CHANNEL

string SUBSCRIBE_CHANNEL := "cumulocity.measurements"
The channel for receiving Alarms.
Since:
10.5.2.0

Member detail

count

integer count
The number of times this alarm has been sent.

id

string id
Unique identifier for this Alarm.

Supply as empty if creating a new Alarm.

params

dictionary<stringanyparams
Any other propertiess available on the Alarm .

severity

string severity
The severity of the alarm: CRITICAL, MAJOR, MINOR or WARNING. Must be upper-case.

source

string source
Identifier of the source of the event.

status

string status
The status of the alarm: ACTIVE, ACKNOWLEDGED or CLEARED.

text

string text
Text or message of the Alarm.

time

float time
Timestamp of the event.

type

string type
The type of the Cumulocity event.
Action detail

withResponse

com.apama.cumulocity.ResponseWrapper withResponse(integer reqId, dictionary<stringstring> headers)
Create or update a Alarm in Cumulocity and receive a response event confirming the change.

Just sending a Alarm is fire and forget. If your application requires an acknowledgement or the ID of the Alarm created or updated, then use the withResponse API. This API will create an event that can be sent as normal and get a response from Cumulocity for the newly created or updated Alarm. The responses are either an ObjectCommitted event or an ObjectCommitFailed event. The withResponse API also allows you to provide headers to the create or update request. For example:
Alarm a := new Alarm;
// set fields in a
integer reqId := com.apama.cumulocity.Util.generateReqId();
send a.withResponse(reqId, { "X-Cumulocity-Processing-Mode": "TRANSIENT" }) to Alarm.SEND_CHANNEL;
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
}
Parameters:
reqId - A request identifier generated from Util.generateReqId(). The response from Cumulocity will have the matching request identifier.
headers - Set headers of the create/update request. This can be used to explicitly control the processing mode of the create/update request.
See Also:
com.apama.cumulocity.ObjectCommitted - Successfully created or updated a Alarm.
com.apama.cumulocity.ObjectCommitFailed - Failed to create or update a Alarm.