Class AbstractAwsIotClient
- java.lang.Object
-
- com.amazonaws.services.iot.client.core.AbstractAwsIotClient
-
- All Implemented Interfaces:
AwsIotConnectionCallback
- Direct Known Subclasses:
AWSIotMqttClient
public abstract class AbstractAwsIotClient extends Object implements AwsIotConnectionCallback
The actual implementation ofAWSIotMqttClient.
-
-
Field Summary
Fields Modifier and Type Field Description protected intbaseRetryDelayprotected booleancleanSessionprotected booleanclientEnableMetricsprotected StringclientEndpointprotected StringclientIdprotected intconnectionTimeoutprotected AwsIotConnectionTypeconnectionTypeprotected intkeepAliveIntervalprotected intmaxConnectionRetriesprotected intmaxOfflineQueueSizeprotected intmaxRetryDelayprotected intnumOfClientThreadsprotected intportprotected intserverAckTimeoutprotected AWSIotMessagewillMessage
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAwsIotClient(String clientEndpoint, String clientId, CredentialsProvider provider, String region)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, CredentialsProvider provider, String region, boolean enableSdkMetrics)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, boolean enableSdkMetrics)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region, boolean enableSdkMetrics)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, KeyStore keyStore, String keyPassword)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, KeyStore keyStore, String keyPassword, boolean enableSdkMetrics)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, boolean enableSdkMetrics)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, int port)protectedAbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, int port, boolean enableSdkMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattach(AWSIotDevice device)voidconnect()voidconnect(long timeout)voidconnect(long timeout, boolean blocking)voiddetach(AWSIotDevice device)voiddisconnect()voiddisconnect(long timeout)voiddisconnect(long timeout, boolean blocking)voiddispatch(AWSIotMessage message)intgetBaseRetryDelay()StringgetClientEndpoint()StringgetClientId()AwsIotConnectiongetConnection()AWSIotConnectionStatusgetConnectionStatus()intgetConnectionTimeout()AwsIotConnectionTypegetConnectionType()ConcurrentMap<String,AbstractAwsIotDevice>getDevices()ScheduledExecutorServicegetExecutionService()intgetKeepAliveInterval()intgetMaxConnectionRetries()intgetMaxOfflineQueueSize()intgetMaxRetryDelay()intgetNumOfClientThreads()intgetPort()intgetServerAckTimeout()ConcurrentMap<String,AWSIotTopic>getSubscriptions()AWSIotMessagegetWillMessage()booleanisCleanSession()booleanisClientEnableMetrics()voidonConnectionClosed()On connection closed.voidonConnectionFailure()On connection failure.voidonConnectionSuccess()On connection success.voidpublish(AWSIotMessage message)voidpublish(AWSIotMessage message, long timeout)voidpublish(String topic, byte[] payload)voidpublish(String topic, byte[] payload, long timeout)voidpublish(String topic, AWSIotQos qos, byte[] payload)voidpublish(String topic, AWSIotQos qos, byte[] payload, long timeout)voidpublish(String topic, AWSIotQos qos, String payload)voidpublish(String topic, AWSIotQos qos, String payload, long timeout)voidpublish(String topic, String payload)voidpublish(String topic, String payload, long timeout)Future<?>scheduleRoutineTask(Runnable runnable, long initialDelay, long period)Future<?>scheduleTask(Runnable runnable)Future<?>scheduleTimeoutTask(Runnable runnable, long timeout)voidsetBaseRetryDelay(int baseRetryDelay)voidsetCleanSession(boolean cleanSession)voidsetConnectionTimeout(int connectionTimeout)voidsetExecutionService(ScheduledExecutorService executionService)voidsetKeepAliveInterval(int keepAliveInterval)voidsetMaxConnectionRetries(int maxConnectionRetries)voidsetMaxOfflineQueueSize(int maxOfflineQueueSize)voidsetMaxRetryDelay(int maxRetryDelay)voidsetNumOfClientThreads(int numOfClientThreads)voidsetPort(int port)voidsetServerAckTimeout(int serverAckTimeout)voidsetWillMessage(AWSIotMessage willMessage)voidsubscribe(AWSIotTopic topic)voidsubscribe(AWSIotTopic topic, boolean blocking)voidsubscribe(AWSIotTopic topic, long timeout)voidsubscribe(AWSIotTopic topic, long timeout, boolean blocking)booleantopicFilterMatch(String topicFilter, String topic)voidunsubscribe(AWSIotTopic topic)voidunsubscribe(AWSIotTopic topic, long timeout)voidunsubscribe(String topic)voidunsubscribe(String topic, long timeout)voidupdateCredentials(String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)
-
-
-
Field Detail
-
clientId
protected final String clientId
-
clientEndpoint
protected final String clientEndpoint
-
clientEnableMetrics
protected final boolean clientEnableMetrics
-
connectionType
protected final AwsIotConnectionType connectionType
-
port
protected int port
-
numOfClientThreads
protected int numOfClientThreads
-
connectionTimeout
protected int connectionTimeout
-
serverAckTimeout
protected int serverAckTimeout
-
keepAliveInterval
protected int keepAliveInterval
-
maxConnectionRetries
protected int maxConnectionRetries
-
baseRetryDelay
protected int baseRetryDelay
-
maxRetryDelay
protected int maxRetryDelay
-
maxOfflineQueueSize
protected int maxOfflineQueueSize
-
cleanSession
protected boolean cleanSession
-
willMessage
protected AWSIotMessage willMessage
-
-
Constructor Detail
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, KeyStore keyStore, String keyPassword, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, KeyStore keyStore, String keyPassword)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, CredentialsProvider provider, String region)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, CredentialsProvider provider, String region, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, int port, boolean enableSdkMetrics)
-
AbstractAwsIotClient
protected AbstractAwsIotClient(String clientEndpoint, String clientId, SSLSocketFactory socketFactory, int port)
-
-
Method Detail
-
updateCredentials
public void updateCredentials(String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)
-
connect
public void connect() throws AWSIotException- Throws:
AWSIotException
-
connect
public void connect(long timeout) throws AWSIotException, AWSIotTimeoutException
-
connect
public void connect(long timeout, boolean blocking) throws AWSIotException, AWSIotTimeoutException
-
disconnect
public void disconnect() throws AWSIotException- Throws:
AWSIotException
-
disconnect
public void disconnect(long timeout) throws AWSIotException, AWSIotTimeoutException
-
disconnect
public void disconnect(long timeout, boolean blocking) throws AWSIotException, AWSIotTimeoutException
-
publish
public void publish(String topic, String payload) throws AWSIotException
- Throws:
AWSIotException
-
publish
public void publish(String topic, String payload, long timeout) throws AWSIotException, AWSIotTimeoutException
-
publish
public void publish(String topic, AWSIotQos qos, String payload) throws AWSIotException
- Throws:
AWSIotException
-
publish
public void publish(String topic, AWSIotQos qos, String payload, long timeout) throws AWSIotException, AWSIotTimeoutException
-
publish
public void publish(String topic, byte[] payload) throws AWSIotException
- Throws:
AWSIotException
-
publish
public void publish(String topic, byte[] payload, long timeout) throws AWSIotException, AWSIotTimeoutException
-
publish
public void publish(String topic, AWSIotQos qos, byte[] payload) throws AWSIotException
- Throws:
AWSIotException
-
publish
public void publish(String topic, AWSIotQos qos, byte[] payload, long timeout) throws AWSIotException, AWSIotTimeoutException
-
publish
public void publish(AWSIotMessage message) throws AWSIotException
- Throws:
AWSIotException
-
publish
public void publish(AWSIotMessage message, long timeout) throws AWSIotException
- Throws:
AWSIotException
-
subscribe
public void subscribe(AWSIotTopic topic, boolean blocking) throws AWSIotException
- Throws:
AWSIotException
-
subscribe
public void subscribe(AWSIotTopic topic, long timeout, boolean blocking) throws AWSIotException, AWSIotTimeoutException
-
subscribe
public void subscribe(AWSIotTopic topic) throws AWSIotException
- Throws:
AWSIotException
-
subscribe
public void subscribe(AWSIotTopic topic, long timeout) throws AWSIotException
- Throws:
AWSIotException
-
unsubscribe
public void unsubscribe(String topic) throws AWSIotException
- Throws:
AWSIotException
-
unsubscribe
public void unsubscribe(String topic, long timeout) throws AWSIotException, AWSIotTimeoutException
-
unsubscribe
public void unsubscribe(AWSIotTopic topic) throws AWSIotException
- Throws:
AWSIotException
-
unsubscribe
public void unsubscribe(AWSIotTopic topic, long timeout) throws AWSIotException
- Throws:
AWSIotException
-
dispatch
public void dispatch(AWSIotMessage message)
-
attach
public void attach(AWSIotDevice device) throws AWSIotException
- Throws:
AWSIotException
-
detach
public void detach(AWSIotDevice device) throws AWSIotException
- Throws:
AWSIotException
-
getConnectionStatus
public AWSIotConnectionStatus getConnectionStatus()
-
onConnectionSuccess
public void onConnectionSuccess()
Description copied from interface:AwsIotConnectionCallbackOn connection success.- Specified by:
onConnectionSuccessin interfaceAwsIotConnectionCallback
-
onConnectionFailure
public void onConnectionFailure()
Description copied from interface:AwsIotConnectionCallbackOn connection failure.- Specified by:
onConnectionFailurein interfaceAwsIotConnectionCallback
-
onConnectionClosed
public void onConnectionClosed()
Description copied from interface:AwsIotConnectionCallbackOn connection closed.- Specified by:
onConnectionClosedin interfaceAwsIotConnectionCallback
-
scheduleRoutineTask
public Future<?> scheduleRoutineTask(Runnable runnable, long initialDelay, long period)
-
getClientId
public String getClientId()
-
getClientEndpoint
public String getClientEndpoint()
-
isClientEnableMetrics
public boolean isClientEnableMetrics()
-
getConnectionType
public AwsIotConnectionType getConnectionType()
-
getPort
public int getPort()
-
getNumOfClientThreads
public int getNumOfClientThreads()
-
getConnectionTimeout
public int getConnectionTimeout()
-
getServerAckTimeout
public int getServerAckTimeout()
-
getKeepAliveInterval
public int getKeepAliveInterval()
-
getMaxConnectionRetries
public int getMaxConnectionRetries()
-
getBaseRetryDelay
public int getBaseRetryDelay()
-
getMaxRetryDelay
public int getMaxRetryDelay()
-
getMaxOfflineQueueSize
public int getMaxOfflineQueueSize()
-
isCleanSession
public boolean isCleanSession()
-
getWillMessage
public AWSIotMessage getWillMessage()
-
getSubscriptions
public ConcurrentMap<String,AWSIotTopic> getSubscriptions()
-
getDevices
public ConcurrentMap<String,AbstractAwsIotDevice> getDevices()
-
getConnection
public AwsIotConnection getConnection()
-
getExecutionService
public ScheduledExecutorService getExecutionService()
-
setPort
public void setPort(int port)
-
setNumOfClientThreads
public void setNumOfClientThreads(int numOfClientThreads)
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
-
setServerAckTimeout
public void setServerAckTimeout(int serverAckTimeout)
-
setKeepAliveInterval
public void setKeepAliveInterval(int keepAliveInterval)
-
setMaxConnectionRetries
public void setMaxConnectionRetries(int maxConnectionRetries)
-
setBaseRetryDelay
public void setBaseRetryDelay(int baseRetryDelay)
-
setMaxRetryDelay
public void setMaxRetryDelay(int maxRetryDelay)
-
setMaxOfflineQueueSize
public void setMaxOfflineQueueSize(int maxOfflineQueueSize)
-
setCleanSession
public void setCleanSession(boolean cleanSession)
-
setWillMessage
public void setWillMessage(AWSIotMessage willMessage)
-
setExecutionService
public void setExecutionService(ScheduledExecutorService executionService)
-
-