|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.eurotech.framework.core.cloud.CloudClientImpl
public class CloudClientImpl
Implementation of the CloudClient interface.
| Constructor Summary | |
|---|---|
protected |
CloudClientImpl(String applicationId,
DataService dataService,
CloudServiceImpl cloudServiceImpl)
|
| Method Summary | |
|---|---|
void |
addCloudClientListener(CloudClientListener cloudClientListener)
Adds a CloudCallbackHandler with this CloudClient. |
int |
controlPublish(String topic,
EsfPayload payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server. |
int |
controlPublish(String deviceId,
String topic,
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 topic,
EsfPayload payload,
int qos,
boolean retain,
int priority)
Publishes a control message to the remote server addressing it to another device. |
void |
controlSubscribe(String topic,
int qos)
Subscribes to a control topic with the remote server. |
void |
controlUnsubscribe(String topic)
Unsubscribes to a control topic with the remote server. |
String |
getApplicationId()
Returns the applicationId of this CloudApplicationClient |
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. |
void |
onConnectionEstablished()
Called when the CloudClient has successfully connected with the broker. |
void |
onConnectionLost()
Called when the client has lost its connection with the broker. |
void |
onControlMessageArrived(String deviceId,
String appTopic,
EsfPayload payload,
int qos,
boolean retain)
Called by the CloudClient when it receives a published control message from the broker. |
void |
onMessageArrived(String deviceId,
String appTopic,
EsfPayload payload,
int qos,
boolean retain)
Called by the client when it receives a published data message from the broker. |
void |
onMessageConfirmed(int pubId,
String appTopic)
Called by the CloudClient when a published message has been fully acknowledged by the broker, as appropriate for the quality of service. |
void |
onMessagePublished(int pubId,
String appTopic)
Called by the CloudClient when a message has been transfered from the publishing queue to the underlying DataTransportService for publishing on the wire. |
int |
publish(String topic,
byte[] payload,
int qos,
boolean retain,
int priority)
Publishes a message to the remote server with a raw byte array payload. |
int |
publish(String topic,
EsfPayload payload,
int qos,
boolean retain)
Publishes a message to the remote server using the default priority 5. |
int |
publish(String topic,
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 topic,
int qos)
Subscribes to a topic with the remote server. |
void |
unsubscribe(String topic)
Unubscribes to a topic with the remote server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected CloudClientImpl(String applicationId,
DataService dataService,
CloudServiceImpl cloudServiceImpl)
| Method Detail |
|---|
public String getApplicationId()
getApplicationId in interface CloudClientpublic void release()
release in interface CloudClientpublic void addCloudClientListener(CloudClientListener cloudClientListener)
CloudClient
addCloudClientListener in interface CloudClientpublic void removeCloudClientListener(CloudClientListener cloudClientListener)
CloudClient
removeCloudClientListener in interface CloudClientpublic boolean isConnected()
CloudClientDataService.connect() and DataService.disconnect(long) methods.
isConnected in interface CloudClient
public int publish(String topic,
EsfPayload payload,
int qos,
boolean retain)
throws EsfException
CloudClientDataService,
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.
publish in interface CloudClienttopic - 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 message
EsfException
public int publish(String topic,
EsfPayload payload,
int qos,
boolean retain,
int priority)
throws EsfException
CloudClientDataService,
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.
publish in interface CloudClienttopic - 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
public int publish(String topic,
byte[] payload,
int qos,
boolean retain,
int priority)
throws EsfException
CloudClientDataService,
the CloudClient will manipulate the provided topic by appending the necessary parts
to achieve topic partitioning and device identification.
publish in interface CloudClienttopic - 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
public int controlPublish(String topic,
EsfPayload payload,
int qos,
boolean retain,
int priority)
throws EsfException
CloudClientCloudService and it appended
automatically by this controlPublish method. Just as CloudClient.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.
controlPublish in interface CloudClienttopic - 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
public int controlPublish(String deviceId,
String topic,
EsfPayload payload,
int qos,
boolean retain,
int priority)
throws EsfException
CloudClientCloudService and it appended
automatically by this controlPublish method. Just as CloudClient.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.
controlPublish in interface CloudClientdeviceId - A String specifying the asset ID.topic - 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
public int controlPublish(String deviceId,
String topic,
byte[] payload,
int qos,
boolean retain,
int priority)
throws EsfException
CloudClientCloudService and it appended
automatically by this controlPublish method. Just as CloudClient.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.
controlPublish in interface CloudClientdeviceId - A String specifying the asset ID.topic - 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
public void subscribe(String topic,
int qos)
throws EsfException
CloudClient
subscribe in interface CloudClienttopic - A String object containing the application topic.qos - An int containing the Quality of Service.
EsfException
public void controlSubscribe(String topic,
int qos)
throws EsfException
CloudClient
controlSubscribe in interface CloudClienttopic - A String object containing the application topic.qos - An int containing the Quality of Service.
EsfException
public void unsubscribe(String topic)
throws EsfException
CloudClient
unsubscribe in interface CloudClienttopic - A String object containing the application topic.
EsfException
public void controlUnsubscribe(String topic)
throws EsfException
CloudClient
controlUnsubscribe in interface CloudClienttopic - A String object containing the application topic.
EsfException
public List<Integer> getUnpublishedMessageIds()
throws EsfException
CloudClient
getUnpublishedMessageIds in interface CloudClientEsfException
public List<Integer> getInFlightMessageIds()
throws EsfException
CloudClient
getInFlightMessageIds in interface CloudClientEsfException
public List<Integer> getDroppedInFlightMessageIds()
throws EsfException
CloudClient
getDroppedInFlightMessageIds in interface CloudClientEsfException
public void onMessageArrived(String deviceId,
String appTopic,
EsfPayload payload,
int qos,
boolean retain)
CloudClientListener
onMessageArrived in interface CloudClientListenerdeviceId - The asset ID of the semanticTopic prefix the message arrived on.appTopic - The appTopic the message arrived on.payload - The EsfPayload that arrived.qos - The Quality of Service that the message was received on.retain - Whether the message was retained by the broker.
public void onControlMessageArrived(String deviceId,
String appTopic,
EsfPayload payload,
int qos,
boolean retain)
CloudClientListener
onControlMessageArrived in interface CloudClientListenerdeviceId - The deviceId this message was addressed to.appTopic - The appTopic the message arrived on.payload - The EsfPayload that arrived.qos - The Quality of Service that the message was received on.retain - Whether the message was retained by the broker.
public void onMessageConfirmed(int pubId,
String appTopic)
CloudClientListener
onMessageConfirmed in interface CloudClientListenerpubId - The message id of the published message
public void onMessagePublished(int pubId,
String appTopic)
CloudClientListenerDataTransportService for publishing on the wire.
onMessagePublished in interface CloudClientListenerpublic void onConnectionEstablished()
CloudClientListenerCloudClientListener.onConnectionEstablished()
callback method to restore the subscriptions it needs after a connection loss.
onConnectionEstablished in interface CloudClientListenerpublic void onConnectionLost()
CloudClientListenerDataService
configuration, the client will attempt to reconnect and call the CloudClientListener.onConnectionEstablished()
method upon a successful reconnect. This is only a notification, the callback handler should
not attempt to handle the reconnect.
CloudClientListener.onConnectionEstablished()
callback method to restore the subscriptions it needs after a connection loss.
onConnectionLost in interface CloudClientListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||