Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The Cumulocity IoT Transport Connectivity Plug-in | Using managed objects | Querying for managed objects
Querying for managed objects
To search for a managed object or a collection of managed objects, send the com.apama.cumulocity.FindManagedObject event to Cumulocity IoT, with a unique reqId to the com.apama.cumulocity.FindManagedObject.CHANNEL channel.
The transport will then respond with zero or more com.apama.cumulocity.FindManagedObjectResponse events and then one com.apama.cumulocity.FindManagedObjectResponseAck event on the com.apama.cumulocity.FindManagedObjectResponse.CHANNEL channel.
integer reqId := integer.getUnique();
com.apama.cumulocity.FindManagedObject request :=
new com.apama.cumulocity.FindManagedObject;
request.reqId := reqId;
// Optionally provide the 'id' of the managed object
//request.deviceId := "<DEVICE_ID>";
// Filter based on fragmentType
request.params.add("fragmentType", "c8y_IsDevice");
// Send request to find available managed objects
send request to com.apama.cumulocity.FindManagedObject.CHANNEL;
// Subscribe to com.apama.cumulocity.FindManagedObjectResponse.CHANNEL to listen
// for responses
// Listen for responses based on reqId
on all com.apama.cumulocity.FindManagedObjectResponse(reqId=reqId) as response
// Avoid listener leaks by terminating the listener on completion of the request
and not com.apama.cumulocity.FindManagedObjectResponseAck(reqId=reqId)
log "Received ManagedObject " + response.toString() at INFO;
// Listen for com.apama.cumulocity.FindManagedObjectResponseAck,
// this indicates that all responses have been received
on com.apama.cumulocity.FindManagedObjectResponseAck(reqId=reqId)
as requestCompleted
log "Received all ManagedObject(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 a managed object based on deviceId. When deviceId is populated in a FindManagedObject request, all the query parameters listed below are ignored.
Search for managed objects based on the fragment type.
Search for managed objects based on the type.
Search for managed objects based on the owner.
Search for managed objects based on the text.
Search for managed objects based on the asset identifier of the child.
Search for managed objects based on the device identifier of the child.
Search for managed objects based a comma-separated list of device identifiers.
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.