public interface CloudClient
DataService
for all interactions with the transport layer and the communication
with the remote server. CloudClient establishes a set of default
subscriptions that allow remote servers or other devices to direct messages
to the application instance.
CloudClientListener#connectionRestored
callback method in the
CloudCallbackHandler to restore the subscriptions it needs.
Modifier and Type | Method and Description |
---|---|
void |
addCloudClientListener(CloudClientListener cloudClientListener)
Adds a CloudCallbackHandler with this CloudClient.
|
int |
controlPublish(String appTopic,
KuraPayload payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server.
|
int |
controlPublish(String deviceId,
String appTopic,
byte[] payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server addressing it to another device
with a raw byte array payload.
|
int |
controlPublish(String deviceId,
String appTopic,
KuraPayload payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server addressing it to another device.
|
void |
controlSubscribe(String appTopic,
int qos)
Subscribes to a control topic with the remote server.
|
void |
controlUnsubscribe(String appTopic)
Unsubscribes to a control topic with the remote server.
|
String |
getApplicationId()
Returns the applicationId of this CloudClient
|
List<Integer> |
getDroppedInFlightMessageIds()
Finds the list of identifiers of in-flight messages that have been dropped.
|
List<Integer> |
getInFlightMessageIds()
Finds the list of identifiers of messages that are still in-flight
(messages published but not confirmed yet).
|
List<Integer> |
getUnpublishedMessageIds()
Gets the list of identifiers of messages that have not been published yet.
|
boolean |
isConnected()
Returns an indication of whether the connection to the remote server is established.
|
int |
publish(String appTopic,
byte[] payload,
int qos,
boolean retain,
int priority)
Publishes a message to the remote server with a raw byte array payload.
|
int |
publish(String appTopic,
KuraPayload payload,
int qos,
boolean retain)
Publishes a message to the remote server using the default priority 5.
|
int |
publish(String appTopic,
KuraPayload payload,
int qos,
boolean retain,
int priority)
Publishes a message to the remote server.
|
void |
release()
Releases this CloudClient handle.
|
void |
removeCloudClientListener(CloudClientListener cloudClientListener)
Removes a CloudCallbackHandler from this CloudClient.
|
void |
subscribe(String appTopic,
int qos)
Subscribes to a topic with the remote server.
|
void |
unsubscribe(String appTopic)
Unubscribes to a topic with the remote server.
|
String getApplicationId()
void release()
boolean isConnected()
DataService.connect()
and DataService.disconnect(long)
methods.int publish(String appTopic, KuraPayload payload, int qos, boolean retain) throws KuraException
DataService
,
the CloudClient will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning and device identification. It is also responsible to
encode the KuraPayload
payload into binary format.
appTopic
- A String specifying the application portion of the topic the message is published on.payload
- An KuraPayload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messageKuraException
int publish(String appTopic, KuraPayload payload, int qos, boolean retain, int priority) throws KuraException
DataService
,
the CloudClient will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning and device identification. It is also responsible to
encode the KuraPayload
payload into binary format.
appTopic
- A String specifying the application portion of the topic the message is published on.payload
- An KuraPayload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messagepriority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
int publish(String appTopic, byte[] payload, int qos, boolean retain, int priority) throws KuraException
DataService
,
the CloudClient will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning and device identification.
appTopic
- A String specifying the application portion of the topic the message is published on.payload
- Binary payload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messagepriority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
int controlPublish(String appTopic, KuraPayload payload, int qos, boolean retain, int priority) throws KuraException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, org.eclipse.kura.message.KuraPayload, int, boolean)
, the
controlPublish method will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning including device identification and encode
the KuraPayload
payload into binary format.
appTopic
- A String specifying the application topic the message is published on.payload
- An KuraPayload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messagepriority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
int controlPublish(String deviceId, String appTopic, KuraPayload payload, int qos, boolean retain, int priority) throws KuraException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, org.eclipse.kura.message.KuraPayload, int, boolean)
, the
controlPublish method will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning including device identification and encode
the KuraPayload
payload into binary format.
deviceId
- A String specifying the asset ID.appTopic
- A String specifying the application topic the message is published on.payload
- An KuraPayload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messagepriority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
int controlPublish(String deviceId, String appTopic, byte[] payload, int qos, boolean retain, int priority) throws KuraException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, org.eclipse.kura.message.KuraPayload, int, boolean)
, the
controlPublish method will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning including device identification.
deviceId
- A String specifying the asset ID.appTopic
- A String specifying the application topic the message is published on.payload
- Binary payload representing the message to be publishedqos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the messagepriority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
void subscribe(String appTopic, int qos) throws KuraException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
void controlSubscribe(String appTopic, int qos) throws KuraException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
void unsubscribe(String appTopic) throws KuraException
appTopic
- A String object containing the application topic.KuraException
void controlUnsubscribe(String appTopic) throws KuraException
appTopic
- A String object containing the application topic.KuraException
void addCloudClientListener(CloudClientListener cloudClientListener)
cloudCallbackHandler
- An implementation of the CloudCallbackHandler interface.void removeCloudClientListener(CloudClientListener cloudClientListener)
List<Integer> getUnpublishedMessageIds() throws KuraException
KuraException
List<Integer> getInFlightMessageIds() throws KuraException
KuraException
List<Integer> getDroppedInFlightMessageIds() throws KuraException
KuraException
Copyright © 2014. All Rights Reserved.