@ProviderType
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.onConnectionEstablished()
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(java.lang.String appTopic,
KuraPayload payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server.
|
int |
controlPublish(java.lang.String deviceId,
java.lang.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(java.lang.String deviceId,
java.lang.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(java.lang.String appTopic,
int qos)
Subscribes to a control topic with the remote server.
|
void |
controlSubscribe(java.lang.String deviceId,
java.lang.String appTopic,
int qos)
Subscribes to a control topic with the remote server.
|
void |
controlUnsubscribe(java.lang.String appTopic)
Unsubscribes to a control topic with the remote server.
|
void |
controlUnsubscribe(java.lang.String deviceId,
java.lang.String appTopic)
Unsubscribes to a control topic with the remote server.
|
java.lang.String |
getApplicationId()
Returns the applicationId of this CloudClient
|
java.util.List<java.lang.Integer> |
getDroppedInFlightMessageIds()
Finds the list of identifiers of in-flight messages that have been dropped.
|
java.util.List<java.lang.Integer> |
getInFlightMessageIds()
Finds the list of identifiers of messages that are still in-flight
(messages published but not confirmed yet).
|
java.util.List<java.lang.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(java.lang.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(java.lang.String appTopic,
KuraPayload payload,
int qos,
boolean retain)
Publishes a message to the remote server using the default priority 5.
|
int |
publish(java.lang.String appTopic,
KuraPayload payload,
int qos,
boolean retain,
int priority)
Publishes a message to the remote server.
|
int |
publish(java.lang.String deviceId,
java.lang.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(java.lang.String deviceId,
java.lang.String appTopic,
KuraPayload payload,
int qos,
boolean retain)
Publishes a message to the remote server using the default priority 5.
|
int |
publish(java.lang.String deviceId,
java.lang.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(java.lang.String appTopic,
int qos)
Subscribes to a topic with the remote server.
|
void |
subscribe(java.lang.String deviceId,
java.lang.String appTopic,
int qos)
Subscribes to a topic with the remote server.
|
void |
unsubscribe(java.lang.String appTopic)
Unubscribes to a topic with the remote server.
|
void |
unsubscribe(java.lang.String deviceId,
java.lang.String appTopic)
Unubscribes to a topic with the remote server.
|
java.lang.String getApplicationId()
void release()
boolean isConnected()
DataService.connect()
and DataService.disconnect(long)
methods.int publish(java.lang.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
- if one of the message composition or message publishing operation fails.int publish(java.lang.String deviceId, java.lang.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.
deviceId
- A String specifying the device ID.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
- if one of the message composition or message publishing operation fails.int publish(java.lang.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
- if one of the message composition or message publishing operation fails.int publish(java.lang.String deviceId, java.lang.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.
deviceId
- A String specifying the device ID.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
- if one of the message composition or message publishing operation fails.int publish(java.lang.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
- if one of the message composition or message publishing operation fails.int publish(java.lang.String deviceId, java.lang.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.
deviceId
- A String specifying the device ID.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
- if one of the message composition or message publishing operation fails.int controlPublish(java.lang.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
- if one of the message composition or message publishing operation fails.int controlPublish(java.lang.String deviceId, java.lang.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 device 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
- if one of the message composition or message publishing operation fails.int controlPublish(java.lang.String deviceId, java.lang.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 device ID.appTopic
- A String specifying the application topic the message is published on.payload
- Binary payload representing the message to be published.qos
- An integer specifying the quality of service the message was published on.retain
- Whether or not the broker should retain the message.priority
- Relative ordering of this message with other messages that may be currently queued for publishing.KuraException
- if one of the message composition or message publishing operation fails.void subscribe(java.lang.String appTopic, int qos) throws KuraException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
- if the subscription fails.void subscribe(java.lang.String deviceId, java.lang.String appTopic, int qos) throws KuraException
deviceId
- A String specifying the device ID.appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
- if the subscription fails.void controlSubscribe(java.lang.String appTopic, int qos) throws KuraException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
- if the subscription fails.void controlSubscribe(java.lang.String deviceId, java.lang.String appTopic, int qos) throws KuraException
deviceId
- A String specifying the device ID.appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.KuraException
- if the subscription fails.void unsubscribe(java.lang.String appTopic) throws KuraException
appTopic
- A String object containing the application topic.KuraException
- if the unsubscription fails.void unsubscribe(java.lang.String deviceId, java.lang.String appTopic) throws KuraException
deviceId
- A String specifying the device ID.appTopic
- A String object containing the application topic.KuraException
- if the unsubscription fails.void controlUnsubscribe(java.lang.String appTopic) throws KuraException
appTopic
- A String object containing the application topic.KuraException
- if the unsubscription fails.void controlUnsubscribe(java.lang.String deviceId, java.lang.String appTopic) throws KuraException
deviceId
- A String specifying the device ID.appTopic
- A String object containing the application topic.KuraException
- if the unsubscription fails.void addCloudClientListener(CloudClientListener cloudClientListener)
cloudClientListener
- An implementation of the CloudCallbackHandler interface.void removeCloudClientListener(CloudClientListener cloudClientListener)
java.util.List<java.lang.Integer> getUnpublishedMessageIds() throws KuraException
KuraException
- if the operation fails.java.util.List<java.lang.Integer> getInFlightMessageIds() throws KuraException
KuraException
- if the operation fails.java.util.List<java.lang.Integer> getDroppedInFlightMessageIds() throws KuraException
KuraException
- if the operation fails.