public interface IEsfMqttClient
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SERVICE_NAME
Reports the class name representing this interface.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getClientId()
Returns the last unique ID given to the MQtt agent.
|
java.lang.String |
getPassword()
Returns the client's password.
|
com.eurotech.cloud.message.EdcSubscription[] |
getSubscriptions()
Returns an array of EdcSubscriptions objects representing the current
subscriptions of the client.
|
java.lang.String |
getUsername()
Returns the client's username.
|
java.lang.String |
getWillMessage()
Reports Will Message
|
int |
getWillQos()
Reports Will QoS
|
java.lang.String |
getWillTopic()
Reports Will Topic
|
boolean |
isConnected()
Returns an indication of whether the MQtt connection to the broker is
established.
|
int |
publish(java.lang.String topic,
byte[] payload,
int qos,
boolean retain)
Publishes a message to the MQtt broker.
|
void |
registerCallback(IEsfMqttCallbackHandler esfMqttCallbackHandler)
Register an
IEsfMqttCallbackHandler with the IEsfMqttClient. |
void |
setBrokerUrl(java.lang.String brokerUrl)
The URL of the MQtt broker.
|
void |
setCleanStart(boolean cleanStart)
The clean start flag for the MQtt client.
|
void |
setClientId(java.lang.String clientId)
The MQtt user ID sent to the broker when a new connection is established.
|
void |
setKeepAlive(short seconds)
Set the service MQtt ping interval.
|
void |
setPassword(java.lang.String password)
Returns the client's password.
|
void |
setUsername(java.lang.String username)
Sets the client's username.
|
void |
startSession()
Connects to the MQtt broker.
|
int |
subscribe(com.eurotech.cloud.message.EdcSubscription subscription)
Subscribes to a topic with the MQtt broker.
|
int |
subscribe(com.eurotech.cloud.message.EdcSubscription[] subscriptions)
Subscribes to one or more topics with the MQtt broker.
|
int |
subscribe(java.lang.String topic,
int qos)
Subscribes to a topic with the MQtt broker.
|
void |
terminateSession()
Disconnects from the MQtt broker.
|
int |
unsubscribe(com.eurotech.cloud.message.EdcSubscription subscription)
Unsubscribes from a topic with the MQtt broker.
|
int |
unsubscribe(java.lang.String topic)
Unsubscribes from a topic with the MQtt broker.
|
static final java.lang.String SERVICE_NAME
void setKeepAlive(short seconds)
throws EsfMqttException
seconds - Ping interval, in units of seconds.EsfMqttExceptionint unsubscribe(com.eurotech.cloud.message.EdcSubscription subscription)
throws EsfMqttException
subscription - A EdcSubscription object containing the topic.EsfMqttExceptionint unsubscribe(java.lang.String topic)
throws EsfMqttException
topic - A String object containing the topic.EsfMqttExceptionint subscribe(com.eurotech.cloud.message.EdcSubscription[] subscriptions)
throws EsfMqttException
subscriptions - An array of EdcSubscription objects.EsfMqttExceptionint subscribe(com.eurotech.cloud.message.EdcSubscription subscription)
throws EsfMqttException
subscription - An EdcSubscription object.EsfMqttExceptionint subscribe(java.lang.String topic,
int qos)
throws EsfMqttException
topic - A String object containing the topic.qos - An int containing the Quality of Service.EsfMqttExceptioncom.eurotech.cloud.message.EdcSubscription[] getSubscriptions()
void setUsername(java.lang.String username)
throws EsfMqttException
username - A String object specifying the username.EsfMqttExceptionjava.lang.String getUsername()
throws EsfMqttException
EsfMqttExceptionvoid setPassword(java.lang.String password)
throws EsfMqttException
password - A String object specifying the password.EsfMqttExceptionjava.lang.String getPassword()
throws EsfMqttException
EsfMqttExceptionvoid setClientId(java.lang.String clientId)
throws EsfMqttException
clientId - A String representing the Client's ID.EsfMqttExceptionjava.lang.String getClientId()
throws EsfMqttException
EsfMqttExceptionboolean isConnected()
void registerCallback(IEsfMqttCallbackHandler esfMqttCallbackHandler)
IEsfMqttCallbackHandler with the IEsfMqttClient. This handler will
receive events when a client publication has arrived, and when a publish
(QoS > 0) has been fully acknowledged by the broker.esfMqttCallbackHandler - An implementation of the IEsfMqttCallbackHandler interface.void setBrokerUrl(java.lang.String brokerUrl)
throws EsfMqttException
brokerUrl - A String representing the broker URLEsfMqttExceptionvoid setCleanStart(boolean cleanStart)
throws EsfMqttException
cleanStart - The clean start flag.EsfMqttExceptionvoid startSession()
throws EsfMqttException
EsfMqttExceptionvoid terminateSession()
throws EsfMqttException
EsfMqttExceptionint publish(java.lang.String topic,
byte[] payload,
int qos,
boolean retain)
throws EsfMqttException
topic - A String specifying the topic the message was published on.payload - An array of bytes containing the payload of the message.qos - An integer specifying the quality of service the message was published on.retain - Whether or not the broker should retain the messageEsfMqttExceptionjava.lang.String getWillTopic()
throws EsfMqttException
StringEsfMqttExceptionint getWillQos()
throws EsfMqttException
intEsfMqttExceptionjava.lang.String getWillMessage()
throws EsfMqttException
StringEsfMqttExceptionCopyright © 2009 Eurotech Inc. All rights reserved.