public class ServiceClient extends Object
Modifier and Type | Field and Description |
---|---|
protected IotHubConnectionString |
iotHubConnectionString |
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
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close AMQP sender
|
CompletableFuture<Void> |
closeAsync()
Provide asynchronous access to close()
|
static ServiceClient |
createFromConnectionString(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Create ServiceClient from the specified connection string
|
static ServiceClient |
createFromConnectionString(String connectionString,
IotHubServiceClientProtocol iotHubServiceClientProtocol,
ServiceClientOptions options)
Create ServiceClient from the specified connection string
|
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()
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.
|
CompletableFuture<Void> |
sendAsync(String deviceId,
Message message)
Provide asynchronous access to send()
|
protected IotHubConnectionString iotHubConnectionString
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 proxypublic static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol) throws IOException
iotHubServiceClientProtocol
- protocol to useconnectionString
- The connection string for the IotHubIOException
- This exception is thrown if the object creation failedpublic static ServiceClient createFromConnectionString(String connectionString, IotHubServiceClientProtocol iotHubServiceClientProtocol, ServiceClientOptions options) throws IOException
iotHubServiceClientProtocol
- protocol to useconnectionString
- The connection string for the IotHuboptions
- The connection options to use when connecting to the service. May be null if no custom options will be used.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 reasonpublic CompletableFuture<Void> openAsync()
public CompletableFuture<Void> closeAsync()
public CompletableFuture<Void> sendAsync(String deviceId, Message message)
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 © 2020. All rights reserved.