DeviceClient.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 millisecods 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>
    

public void setOption(String optionName, Object value)

参数

optionName
String

the option name to modify

value
Object

an object of the appropriate type for the option's value

例外

IllegalArgumentException

if the provided optionName is null

适用于