public class ServiceClient extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceClient(IotHubConnectionString iotHubConnectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Initialize AMQP sender using given connection string
|
protected |
ServiceClient(IotHubConnectionString iotHubConnectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Initialize AMQP sender using given connection string
|
|
ServiceClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create a
ServiceClient instance with an instance of AzureSasCredential. |
|
ServiceClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Create a
ServiceClient instance with an instance of AzureSasCredential. |
|
ServiceClient(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create ServiceClient from the specified connection string
|
|
ServiceClient(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Create ServiceClient from the specified connection string
|
|
ServiceClient(String hostName,
com.azure.core.credential.TokenCredential credential,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create a
ServiceClient instance with a custom TokenCredential to allow for finer grain control
of authentication tokens used in the underlying connection. |
|
ServiceClient(String hostName,
com.azure.core.credential.TokenCredential credential,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Create a
ServiceClient instance with a custom TokenCredential to allow for finer grain control
of authentication tokens used in the underlying connection. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close AMQP sender
|
CompletableFuture<Void> |
closeAsync()
Deprecated.
Use the synchronous version of this API
close(). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads. |
static ServiceClient |
createFromConnectionString(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Deprecated.
because this method declares a thrown IOException even though it never throws an IOException. Users
are recommended to use
ServiceClient(String, IotHubServiceClientProtocol) instead
since it does not declare this exception even though it constructs the same ServiceClient. |
static ServiceClient |
createFromConnectionString(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Deprecated.
because this method declares a thrown IOException even though it never throws an IOException. Users
are recommended to use
ServiceClient(String, IotHubServiceClientProtocol, ServiceClientOptions) instead
since it does not declare this exception even though it constructs the same ServiceClient. |
FeedbackReceiver |
getFeedbackReceiver()
Instantiate a new FeedbackReceiver object.
|
FeedbackReceiver |
getFeedbackReceiver(String deviceId)
Deprecated.
As of release 1.1.15, replaced by
getFeedbackReceiver() |
FileUploadNotificationReceiver |
getFileUploadNotificationReceiver()
Instantiate a new FileUploadNotificationReceiver object.
|
void |
open()
Open AMQP sender
|
CompletableFuture<Void> |
openAsync()
Deprecated.
Use the synchronous version of this API
open(). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads. |
void |
send(String deviceId,
Message message)
Send a one-way message to the specified device.
|
void |
send(String deviceId,
String moduleId,
Message message)
Send a one-way message to the specified module.
|
CompletableFuture<Void> |
sendAsync(String deviceId,
Message message)
Deprecated.
Use the synchronous version of this API
send(String, Message). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads. |
public ServiceClient(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol)
iotHubServiceClientProtocol - protocol to useconnectionString - The connection string for the IotHubpublic ServiceClient(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
iotHubServiceClientProtocol - protocol to useconnectionString - The connection string for the IotHuboptions - The connection options to use when connecting to the service.public ServiceClient(String hostName, com.azure.core.credential.TokenCredential credential, IotHubServiceClientProtocol iotHubServiceClientProtocol)
ServiceClient instance with a custom TokenCredential to allow for finer grain control
of authentication tokens used in the underlying connection.hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")credential - The custom TokenCredential that will provide authentication tokens to
this library when they are needed. The provided tokens must be Json Web Tokens.iotHubServiceClientProtocol - The protocol to open the connection with.public ServiceClient(String hostName, com.azure.core.credential.TokenCredential credential, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
ServiceClient instance with a custom TokenCredential to allow for finer grain control
of authentication tokens used in the underlying connection.hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")credential - The custom TokenCredential that will provide authentication tokens to
this library when they are needed. The provided tokens must be Json Web Tokens.iotHubServiceClientProtocol - The protocol to open the connection with.options - The connection options to use when connecting to the service.public ServiceClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, IotHubServiceClientProtocol iotHubServiceClientProtocol)
ServiceClient instance with an instance of AzureSasCredential.hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")azureSasCredential - The SAS token provider that will be used for authentication.iotHubServiceClientProtocol - The protocol to open the connection with.public ServiceClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
ServiceClient instance with an instance of AzureSasCredential.hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")azureSasCredential - The SAS token provider that will be used for authentication.iotHubServiceClientProtocol - The protocol to open the connection with.options - The connection options to use when connecting to the service.protected ServiceClient(IotHubConnectionString iotHubConnectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol)
iotHubConnectionString - The ConnectionString object for the IotHubiotHubServiceClientProtocol - protocol to useprotected ServiceClient(IotHubConnectionString iotHubConnectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
iotHubConnectionString - The ConnectionString object for the IotHubiotHubServiceClientProtocol - protocol to useoptions - options for proxy@Deprecated public static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol) throws IOException
ServiceClient(String, IotHubServiceClientProtocol) instead
since it does not declare this exception even though it constructs the same ServiceClient.iotHubServiceClientProtocol - protocol to useconnectionString - The connection string for the IotHubIOException - This exception is thrown if the object creation failed@Deprecated public static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options) throws IOException
ServiceClient(String, IotHubServiceClientProtocol, ServiceClientOptions) instead
since it does not declare this exception even though it constructs the same ServiceClient.iotHubServiceClientProtocol - protocol to useconnectionString - The connection string for the IotHuboptions - The connection options to use when connecting to the service.IOException - This exception is thrown if the object creation failedpublic void open()
throws IOException
IOException - This exception is thrown if the AmqpSender object is not initializedpublic void close()
throws IOException
IOException - This exception is thrown if the AmqpSender object is not initializedpublic void send(String deviceId, Message message) throws IOException, IotHubException
deviceId - The device identifier for the target devicemessage - The message for the deviceIOException - This exception is thrown if the AmqpSender object is not initializedIotHubException - This exception is thrown if IotHub rejects the message for any reasonpublic void send(String deviceId, String moduleId, Message message) throws IOException, IotHubException
deviceId - The device identifier for the target devicemoduleId - The module identifier for the target devicemessage - The message for the deviceIOException - This exception is thrown if the AmqpSender object is not initializedIotHubException - This exception is thrown if IotHub rejects the message for any reason@Deprecated public CompletableFuture<Void> openAsync()
open(). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads.@Deprecated public CompletableFuture<Void> closeAsync()
close(). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads.@Deprecated public CompletableFuture<Void> sendAsync(String deviceId, Message message)
send(String, Message). This asynchronous
API only spawned a thread to run the synchronous API, so users are advised to do this themselves
in order to have control over the spawned threads.deviceId - The device identifier for the target devicemessage - The message for the device@Deprecated public FeedbackReceiver getFeedbackReceiver(String deviceId)
getFeedbackReceiver()deviceId - The device identifier for the target devicepublic FeedbackReceiver getFeedbackReceiver()
public FileUploadNotificationReceiver getFileUploadNotificationReceiver()
Copyright © 2022. All rights reserved.