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,
EsfPayload 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,
EsfPayload 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,
EsfPayload payload,
int qos,
boolean retain)
Publishes a message to the remote server using the default priority 5.
|
int |
publish(String appTopic,
EsfPayload 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, EsfPayload payload, int qos, boolean retain) throws EsfException
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 EsfPayload
payload into binary format.
appTopic
- A String specifying the application portion of the topic the message is published on.payload
- An EsfPayload 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 messageEsfException
int publish(String appTopic, EsfPayload payload, int qos, boolean retain, int priority) throws EsfException
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 EsfPayload
payload into binary format.
appTopic
- A String specifying the application portion of the topic the message is published on.payload
- An EsfPayload 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.EsfException
int publish(String appTopic, byte[] payload, int qos, boolean retain, int priority) throws EsfException
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.EsfException
int controlPublish(String appTopic, EsfPayload payload, int qos, boolean retain, int priority) throws EsfException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, com.eurotech.framework.message.EsfPayload, 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 EsfPayload
payload into binary format.
appTopic
- A String specifying the application topic the message is published on.payload
- An EsfPayload 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.EsfException
int controlPublish(String deviceId, String appTopic, EsfPayload payload, int qos, boolean retain, int priority) throws EsfException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, com.eurotech.framework.message.EsfPayload, 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 EsfPayload
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 EsfPayload 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.EsfException
int controlPublish(String deviceId, String appTopic, byte[] payload, int qos, boolean retain, int priority) throws EsfException
CloudService
and it appended
automatically by this controlPublish method. Just as publish(java.lang.String, com.eurotech.framework.message.EsfPayload, 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.EsfException
void subscribe(String appTopic, int qos) throws EsfException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.EsfException
void controlSubscribe(String appTopic, int qos) throws EsfException
appTopic
- A String object containing the application topic.qos
- An int containing the Quality of Service.EsfException
void unsubscribe(String appTopic) throws EsfException
appTopic
- A String object containing the application topic.EsfException
void controlUnsubscribe(String appTopic) throws EsfException
appTopic
- A String object containing the application topic.EsfException
void addCloudClientListener(CloudClientListener cloudClientListener)
cloudCallbackHandler
- An implementation of the CloudCallbackHandler interface.void removeCloudClientListener(CloudClientListener cloudClientListener)
List<Integer> getUnpublishedMessageIds() throws EsfException
EsfException
List<Integer> getInFlightMessageIds() throws EsfException
EsfException
List<Integer> getDroppedInFlightMessageIds() throws EsfException
EsfException
Copyright © 2013. All Rights Reserved.