com.apama.cumulocity
Event SerialConnection


A connection to Cumulocity IoT which is configured to handle all requests using a single client.

For example:
// Starting a connection
SerialConnection connection := SerialConnection.create();

// Or alternatively for multi-tenant deployments, use a tenant-specific connection object
// Uses a TenantDetails object as input parameter. TenantDetails can be retrieved using TenantSubscriptionNotifier or ApplicationSubscribedForTenant
// SerialConnection connection := SerialConnection.createForTenant(tenantDetails);

// Subscribing to a response channel
monitor.subscribe(connection.getChannel(FindManagedObjectResponse.SUBSCRIBE_CHANNEL));

// Requesting via a send channel
FindManagedObject findManagedObject := new FindManagedObject;
findManagedObject.reqId := Util.generateReqId();
send findManagedObject to connection.getChannel(FindManagedObject.SEND_CHANNEL);
See Also:
com.apama.cumulocity.TenantSubscriptionNotifier - to retrieve the TenantDetails object for a given tenant.
com.apama.cumulocity.FullyConcurrentConnection - to create a connection configured to handle all requests concurrently.
com.apama.cumulocity.AutoConcurrentConnection - to create a connection configured to handle requests concurrently unless this could result in getting and setting occurring in the wrong order.
com.apama.cumulocity.SharedConnection - to reuse the global connection instance.

Action summary
 com.apama.cumulocity.SerialConnectionstatic create()

Returns a new SerialConnection.
 com.apama.cumulocity.SerialConnectionstatic createForTenant(com.apama.cumulocity.TenantDetails tenant)

Returns a new SerialConnection.
 voiddestroy()

Destroys this connection to Cumulocity IoT.
 stringgetChannel(string channel)

Returns the channel to which events should be sent for processing.
 
Action detail

create

com.apama.cumulocity.SerialConnection static create()
Returns a new SerialConnection.

This action must only be used when the application needs to work only with the per-tenant deployment. Use the createForTenant action when the application also needs to work with the multi-tenant deployment.
Returns:
The new SerialConnection.
See Also:
com.apama.cumulocity.SerialConnection.createForTenant() - to create a connection when the application also needs to work with multi-tenant deployment.

createForTenant

com.apama.cumulocity.SerialConnection static createForTenant(com.apama.cumulocity.TenantDetails tenant)
Returns a new SerialConnection.
Parameters:
tenant - Tenant details.
Returns:
The new SerialConnection.

destroy

void destroy()
Destroys this connection to Cumulocity IoT.

You should invoke this action on every connection after you have finished using it. Invoking this action on a connection that has already been destroyed does nothing. For example:
action ondie() {
connection.destroy();
}

getChannel

string getChannel(string channel)
Returns the channel to which events should be sent for processing.
Parameters:
channel - The corresponding standard Cumulocity IoT channel.
Returns:
The channel to which events should be sent of processing.