InternalClient 类

定义

public class InternalClient
继承
java.lang.Object
InternalClient

方法

close()
closeNow()
getConfig()

Getter for the device client config.

getProductInfo()
isMultiplexed()

Returns if this client is or ever was registered to a MultiplexingClient instance. Device clients that were cannot be used in non-multiplexed connections. Device clients that aren't registered to any multiplexing client will still return true.

open()
registerConnectionStatusChangeCallback(IotHubConnectionStatusChangeCallback callback, Object callbackContext)

Registers a callback to be executed when the connection status of the device changes. The callback will be fired with a status and a reason why the device's status changed. When the callback is fired, the provided context will be provided alongside the status and reason.

Note that the thread used to deliver this callback should not be used to call open()/closeNow() on the client that this callback belongs to. All open()/closeNow() operations should be done on a separate thread

sendEventAsync(Message message, IotHubEventCallback callback, Object callbackContext)

Asynchronously sends an event message to the IoT Hub.

sendEventBatchAsync(List<Message> messages, IotHubEventCallback callback, Object callbackContext)

Asynchronously sends a batch of messages to the IoT Hub HTTPS messages will be sent in a single batch and MQTT and AMQP messages will be sent individually. In case of HTTPS, This API call is an all-or-nothing single HTTPS message and the callback will be triggered only once. Maximum payload size for HTTPS is 255KB

sendReportedProperties(ReportedPropertiesParameters reportedPropertiesParameters)

Sends reported properties

sendReportedProperties(Set<Property> reportedProperties)

Sends reported properties

sendReportedProperties(Set<Property> reportedProperties, int version)

Sends reported properties

sendReportedProperties(Set<Property> reportedProperties, Integer version, CorrelatingMessageCallback correlatingMessageCallback, Object correlatingMessageCallbackContext, IotHubEventCallback reportedPropertiesCallback, Object reportedPropertiesCallbackContext)

Sends reported properties

setAsMultiplexed()
setOperationTimeout(long timeout)

Set the length of time, in milliseconds, that any given operation will expire in. These operations include reconnecting upon a connection drop and sending a message.

setOption(String optionName, Object value)

Sets a runtime option identified by parameteroptionName 

</code> to<code>value 

</code> .</p>

The options that can be set via this API are:

  • SetMinimumPollingInterval - this option is applicable only when the transport configured with this client is HTTP. This option specifies the interval in milliseconds between calls to the service checking for availability of new messages. The value is expected to be of typelong 

    </code> .</p></li><li><p><b>SetSendInterval</b> - this option is applicable to all protocols. This value sets the period (in milliseconds) that this SDK spawns threads to send queued messages. Even if no message is queued, this thread will be spawned.</p></li><li><p><b>SetReceiveInterval</b> - this option is applicable to all protocols in case of HTTPS protocol, this option acts the same as<code>SetMinimumPollingInterval 
    
    </code> in case of MQTT and AMQP protocols, this option specifies the interval in milliseconds between spawning a thread that dequeues a message from the SDK's queue of received messages.</p></li><li><p><b>SetCertificatePath</b> - this option is applicable only when the transport configured with this client is AMQP. This option specifies the path to the certificate used to verify peer. The value is expected to be of type<code>String 
    
    </code> .</p></li><li><p><b>SetSASTokenExpiryTime</b> - this option is applicable for HTTP/ AMQP/MQTT. This option specifies the interval in seconds after which SASToken expires. If the transport is already open then setting this option will restart the transport with the updated expiry time, and will use that expiry time length for all subsequently generated sas tokens. The value is expected to be of type<code>long 
    
    </code> .</p></li><li><p><b>SetHttpsReadTimeout</b> - this option is applicable for HTTPS. This option specifies the read timeout in milliseconds per https request made by this client. By default, this value is 4 minutes. The value is expected to be of type<code>int 
    
    </code> .</p></li><li><p><b>SetHttpsConnectTimeout</b> - this option is applicable for HTTPS. This option specifies the connect timeout in milliseconds per https request made by this client. By default, this value is 0 (no connect timeout). The value is expected to be of type<code>int 
    
    </code> .</p></li><li><p><b>SetAmqpOpenAuthenticationSessionTimeout</b> - this option is applicable for AMQP with SAS token authentication. This option specifies the timeout in seconds to wait to open the authentication session. By default, this value is 20 seconds. The value is expected to be of type<code>int 
    
    </code> .</p></li><li><p><b>SetAmqpOpenDeviceSessionsTimeout</b> - this option is applicable for AMQP. This option specifies the timeout in seconds to open the device sessions. By default, this value is 60 seconds. The value is expected to be of type<code>int 
    
    </code> .</p></li></ul></p>
    

setProxySettings(ProxySettings proxySettings)

Set the proxy settings for this client to connect through. If null then any previous settings will be erased

setRetryPolicy(RetryPolicy retryPolicy)

Sets the given retry policy on the underlying transport See more details about the default retry policy and about using custom retry policies here

subscribeToDesiredProperties(Map<Property, Pair<PropertyCallBack<String, Object>, Object>> onDesiredPropertyChange)

Subscribes to desired properties.

This client will receive a callback each time a desired property is updated. That callback will either contain the full desired properties set, or only the updated desired property depending on how the desired property was changed. IoT Hub supports a PUT and a PATCH on the twin. The PUT will cause this device client to receive the full desired properties set, and the PATCH will cause this device client to only receive the updated desired properties. Similarly, the version of each desired property will be incremented from a PUT call, and only the actually updated desired property will have its version incremented from a PATCH call. The java service client library uses the PATCH call when updated desired properties, but it builds the patch such that all properties are included in the patch. As a result, the device side will receive full twin updates, not partial updates.

See PUT and PATCH

subscribeToTwinDesiredProperties(Map<Property, Pair<TwinPropertyCallBack, Object>> onDesiredPropertyChange)

Subscribes to desired properties

适用于