com.apama.cumulocity
Event Operation


An operation to send to a device.

Examples:
 Create an operation, send Operation("","deviceId", "PENDING", {"c8y_Message":{"text":"Hello Cumulocity device"}}) to Operation.SEND_CHANNEL; 
You can update the status field. send Operation("12345","deviceId", "EXECUTING", {}}) to Operation.SEND_CHANNEL;

Constant summary
 stringCHANNEL := "CumulocityIoTGenericChain"

Channel to send the events to.
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL for sending and SUBSCRIBE_CHANNEL for receiving events.]
 stringNOTIFICATION_CREATED := "CREATED"

Value of PARAM_NOTIFICATION that indicates this a new object.
 stringNOTIFICATION_UPDATED := "UPDATED"

Value of PARAM_NOTIFICATION that indicates this an update to an existing object.
 stringPARAM_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.
 stringSEND_CHANNEL := "CumulocityIoTGenericChain"

Channel for sending Operations.
 stringSUBSCRIBE_CHANNEL := "cumulocity.measurements"

Channel for receiving Operations.
 
Member summary
 stringid

Unique identifier for this Operation.
 stringsource

Identifier of the ManagedObject to send the operation to.
 stringstatus

Status of the operation : one of SUCCESSFUL, FAILED, EXECUTING or PENDING.
 dictionary<stringany>params

Any extra parameters available on the Operation.
 
Action summary
 com.apama.cumulocity.ResponseWrapperwithChannelResponse(integer reqId, dictionary<stringstring> headers)

Create or update an Operation in Cumulocity and receive a response event confirming the change on Operation.SUBSCRIBE_CHANNEL channel.
 com.apama.cumulocity.ResponseWrapperwithResponse(integer reqId, dictionary<stringstring> headers)

Create or update an Operation in Cumulocity and receive a response event on default channel, confirming the change.
Deprecated:
[This API has been deprecated. Use withChannelResponse API to receive confirmation on Operation.SUBSCRIBE_CHANNEL channel.]
 
Constant detail

CHANNEL

string CHANNEL := "CumulocityIoTGenericChain"
Deprecated:
[This channel constant has been deprecated. Use SEND_CHANNEL for sending and SUBSCRIBE_CHANNEL for receiving events.]
Channel to send the events to.

NOTIFICATION_CREATED

string NOTIFICATION_CREATED := "CREATED"
Value of PARAM_NOTIFICATION that indicates this a new object.
Since:
10.5.4.0

NOTIFICATION_UPDATED

string NOTIFICATION_UPDATED := "UPDATED"
Value of PARAM_NOTIFICATION that indicates this an update to an existing object.
Since:
10.5.4.0

PARAM_NOTIFICATION

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.
Since:
10.5.4.0

SEND_CHANNEL

string SEND_CHANNEL := "CumulocityIoTGenericChain"
Channel for sending Operations.
Since:
10.5.2.0

SUBSCRIBE_CHANNEL

string SUBSCRIBE_CHANNEL := "cumulocity.measurements"
Channel for receiving Operations.
Since:
10.5.2.0

Member detail

id

string id
Unique identifier for this Operation.

Supply as empty if creating a new Operation

params

dictionary<stringanyparams
Any extra parameters available on the Operation.

source

string source
Identifier of the ManagedObject to send the operation to.

status

string status
Status of the operation : one of SUCCESSFUL, FAILED, EXECUTING or PENDING.
Action detail

withChannelResponse

com.apama.cumulocity.ResponseWrapper withChannelResponse(integer reqId, dictionary<stringstring> headers)
Create or update an Operation in Cumulocity and receive a response event confirming the change on Operation.SUBSCRIBE_CHANNEL channel.

Just sending an Operation is fire and forget. If your application requires an acknowledgement or the ID of the Operation created or updated on Operation.SUBSCRIBE_CHANNEL channel, then use the withChannelResponse API. You will need to subscribe to Operation.SUBSCRIBE_CHANNEL channel. This API will create an event that can be sent as normal and get a response from Cumulocity for the newly created or updated Operation. The responses are either an ObjectCommitted event or an ObjectCommitFailed event. The withChannelResponse API also allows you to provide headers to the create or update request. For example:
Operation o := new Operation;
monitor.subscribe(Operation.SUBSCRIBE_CHANNEL);
// set fields in o
integer reqId := com.apama.cumulocity.Util.generateReqId();
send o.withChannelResponse(reqId, {"X-Cumulocity-Processing-Mode": "PERSISTENT"}) to Operation.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 an Operation.
com.apama.cumulocity.ObjectCommitFailed - Failed to create or update an Operation.

withResponse

com.apama.cumulocity.ResponseWrapper withResponse(integer reqId, dictionary<stringstring> headers)
Deprecated:
[This API has been deprecated. Use withChannelResponse API to receive confirmation on Operation.SUBSCRIBE_CHANNEL channel.]
Create or update an Operation in Cumulocity and receive a response event on default channel, confirming the change.

Just sending an Operation is fire and forget. If your application requires an acknowledgement or the ID of the Operation 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 Operation. The responses are sent to default channel and hence can be listened for only in the main context. 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:
Operation o := new Operation;
// set fields in o
integer reqId := com.apama.cumulocity.Util.generateReqId();
send o.withResponse(reqId, {"X-Cumulocity-Processing-Mode": "PERSISTENT"}) to Operation.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 an Operation.
com.apama.cumulocity.ObjectCommitFailed - Failed to create or update an Operation.
com.apama.cumulocity.Operation#withChannelResponse() - to receive confirmation on Operation.SUBSCRIBE_CHANNEL channel.