ServiceClient Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. ServiceClient
- com.
public class ServiceClient
Extend the ServiceClient class and provide AMPQ specific implementation.
Constructor Summary
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Close AMQP sender |
java.util.concurrent.CompletableFuture<java.lang.Void> |
closeAsync()
Provide asynchronous access to close() |
static
Service |
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 connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol) instead since it does not declare this exception even though it constructs the same Service
Create Service |
static
Service |
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 connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options) instead since it does not declare this exception even though it constructs the same Service
Create Service |
Feedback |
getFeedbackReceiver()
Instantiate a new Feedback |
Feedback |
getFeedbackReceiver(String deviceId)
Deprecated
As of release 1.1.15, replaced by getFeedbackReceiver()
Get Feedback |
File |
getFileUploadNotificationReceiver()
Instantiate a new File |
void |
open()
Open AMQP sender |
java.util.concurrent.CompletableFuture<java.lang.Void> |
openAsync()
Provide asynchronous access to open() |
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. |
java.util.concurrent.CompletableFuture<java.lang.Void> |
sendAsync(String deviceId, Message message)
Provide asynchronous access to send() |
Methods inherited from java.lang.Object
Constructor Details
ServiceClient
protected ServiceClient(IotHubConnectionString iotHubConnectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol)
Initialize AMQP sender using given connection string
Parameters:
ServiceClient
protected ServiceClient(IotHubConnectionString iotHubConnectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
Initialize AMQP sender using given connection string
Parameters:
ServiceClient
public ServiceClient(String hostName, AzureSasCredential azureSasCredential, IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create a ServiceClient instance with an instance of AzureSasCredential.
Parameters:
ServiceClient
public ServiceClient(String hostName, AzureSasCredential azureSasCredential, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
Create a ServiceClient instance with an instance of AzureSasCredential.
Parameters:
ServiceClient
public ServiceClient(String hostName, 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.
Parameters:
ServiceClient
public ServiceClient(String hostName, 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.
Parameters:
ServiceClient
public ServiceClient(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create ServiceClient from the specified connection string
Parameters:
ServiceClient
public ServiceClient(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
Create ServiceClient from the specified connection string
Parameters:
Method Details
close
public void close()
Close AMQP sender
Throws:
closeAsync
public CompletableFuture
Provide asynchronous access to close()
Returns:
createFromConnectionString
public static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol)
Deprecated
Create ServiceClient from the specified connection string
Parameters:
Returns:
Throws:
createFromConnectionString
public static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options)
Deprecated
Create ServiceClient from the specified connection string
Parameters:
Returns:
Throws:
getFeedbackReceiver
public FeedbackReceiver getFeedbackReceiver()
Instantiate a new FeedbackReceiver object.
Returns:
getFeedbackReceiver
public FeedbackReceiver getFeedbackReceiver(String deviceId)
Deprecated
Get FeedbackReceiver object.This API has been deprecated. Use new API without deviceId as an input parameter.
Parameters:
Returns:
getFileUploadNotificationReceiver
public FileUploadNotificationReceiver getFileUploadNotificationReceiver()
Instantiate a new FileUploadNotificationReceiver object.
Returns:
open
public void open()
Open AMQP sender
Throws:
openAsync
public CompletableFuture
Provide asynchronous access to open()
Returns:
send
public void send(String deviceId, Message message)
Send a one-way message to the specified device. This function is synchronized internally so that only one send operation is allowed at a time. In order to do more send operations at a time, you will need to instantiate another service client instance.
Parameters:
Throws:
send
public void send(String deviceId, String moduleId, Message message)
Send a one-way message to the specified module. This function is synchronized internally so that only one send operation is allowed at a time. In order to do more send operations at a time, you will need to instantiate another service client instance.
Parameters:
Throws:
sendAsync
public CompletableFuture
Provide asynchronous access to send()
Parameters:
Returns: