Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The Cumulocity IoT Transport Connectivity Plug-in | Using operations | Querying for operations
Querying for operations
To search for an operation or a collection of operations, send the com.apama.cumulocity.FindOperation event to Cumulocity IoT, with a unique reqId to the com.apama.cumulocity.FindOperation.CHANNEL channel.
The transport will then respond with zero or more com.apama.cumulocity.FindOperationResponse events and then one com.apama.cumulocity.FindOperationResponseAck event on the com.apama.cumulocity.FindOperationResponse.CHANNEL channel.
integer reqId := integer.getUnique();
com.apama.cumulocity.FindOperation request :=
new com.apama.cumulocity.FindOperation;
request.reqId := reqId;
// Filter based on operation status
request.params.add("status", "PENDING");
// Send request to find available operations
send request to com.apama.cumulocity.FindOperation.CHANNEL;
// Subscribe to com.apama.cumulocity.FindOperationResponse.CHANNEL to listen
// for responses
// Listen for responses based on reqId
on all com.apama.cumulocity.FindOperationResponse(reqId=reqId) as response
// Avoid listener leaks by terminating the listener on completion of the request
and not com.apama.cumulocity.FindOperationResponseAck(reqId=reqId)
log "Received Operation " + response.toString() at INFO;
// Listen for com.apama.cumulocity.FindOperationResponseAck,
// this indicates that all responses have been received
on com.apama.cumulocity.FindOperationResponseAck(reqId=reqId)
as requestCompleted
log "Received all Operation(s) for request "
+ requestCompleted.reqId.toString() at INFO;
// Request is completed and we can unsubscribe from this channel
Supported query parameters
You can provide the following query parameters with the request:
Search for an operation based on operationId. When searching for an operation based on Id, all the query parameters listed below are ignored.
Search for operations based on the device identifier or asset identifier of the source.
Search for operations based on the status. The status can be any of SUCCESSFUL, FAILED, EXECUTING or PENDING.
Search for operations based on the agent identifier.
Search for measurements based on the fragment type.
Along with the above parameters, you can also provide other query parameters (such as pageSize) to be forwarded with the request to Cumulocity IoT.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.