public class FileUploadNotificationProcessorClient extends Object
This client relies on a persistent amqp/amqp_ws connection to IoT Hub that may break due to network instability.
While optional to monitor, users are highly encouraged to utilize the errorProcessorHandler defined in the
FileUploadNotificationProcessorClientOptions
when constructing this client in order to monitor the connection state and to re-open
the connection when needed. See the message feedback processor client sample in this repo for best practices for
monitoring and handling disconnection events.
Constructor and Description |
---|
FileUploadNotificationProcessorClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
Construct a FileUploadNotificationProcessorClient using a
AzureSasCredential instance for authentication. |
FileUploadNotificationProcessorClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor,
FileUploadNotificationProcessorClientOptions options)
Construct a FileUploadNotificationProcessorClient using a
AzureSasCredential instance for authentication. |
FileUploadNotificationProcessorClient(String connectionString,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
Construct a FileUploadNotificationProcessorClient from the provided connection string.
|
FileUploadNotificationProcessorClient(String connectionString,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor,
FileUploadNotificationProcessorClientOptions options)
Construct a FileUploadNotificationProcessorClient from the provided connection string.
|
FileUploadNotificationProcessorClient(String hostName,
com.azure.core.credential.TokenCredential credential,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
Construct a FileUploadNotificationProcessorClient using a
TokenCredential instance for authentication. |
FileUploadNotificationProcessorClient(String hostName,
com.azure.core.credential.TokenCredential credential,
IotHubServiceClientProtocol protocol,
Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor,
FileUploadNotificationProcessorClientOptions options)
Construct a FileUploadNotificationProcessorClient using a
TokenCredential instance for authentication. |
Modifier and Type | Method and Description |
---|---|
boolean |
isRunning()
Returns true if this client's underlying amqp connection is currently open and false otherwise.
|
void |
start()
Open this client so that it can begin processing file upload notifications.
|
void |
start(int timeoutMilliseconds)
Open this client so that it can begin processing file upload notifications.
|
void |
stop()
Stops this client from processing any more file upload notifications and releases all network resources tied to
it.
|
void |
stop(int timeoutMilliseconds)
Stops this client from processing any more file upload notifications and releases all network resources tied to
it.
|
public FileUploadNotificationProcessorClient(String hostName, com.azure.core.credential.TokenCredential credential, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
TokenCredential
instance for authentication.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.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.public FileUploadNotificationProcessorClient(String hostName, com.azure.core.credential.TokenCredential credential, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor, FileUploadNotificationProcessorClientOptions options)
TokenCredential
instance for authentication.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.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.options
- The connection options to use when connecting to the service. May not be null.public FileUploadNotificationProcessorClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
AzureSasCredential
instance for authentication.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.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.public FileUploadNotificationProcessorClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor, FileUploadNotificationProcessorClientOptions options)
AzureSasCredential
instance for authentication.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.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.options
- The connection options to use when connecting to the service. May not be null.public FileUploadNotificationProcessorClient(String connectionString, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor)
connectionString
- The connection string for the Iot Hub.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.public FileUploadNotificationProcessorClient(String connectionString, IotHubServiceClientProtocol protocol, Function<FileUploadNotification,AcknowledgementType> fileUploadNotificationProcessor, FileUploadNotificationProcessorClientOptions options)
connectionString
- The connection string for the Iot Hub.protocol
- The protocol that the client will communicate to IoT Hub over.fileUploadNotificationProcessor
- The callback to be executed each time a file upload notification is received
from the service. May not be null.options
- The connection options to use when connecting to the service. May not be null.public void start() throws IotHubException, IOException, InterruptedException, TimeoutException
stop()
to free up network resources. If this
client is already started, then this function will do nothing.IotHubException
- If any IoT Hub level exceptions occur such as an IotHubUnauthorizedException
.IOException
- If any network level exceptions occur such as the connection timing out.InterruptedException
- If this thread is interrupted while waiting for the connection to the service to open.TimeoutException
- If the connection is not established before the default timeout.public void start(int timeoutMilliseconds) throws IotHubException, IOException, InterruptedException, TimeoutException
stop()
to free up network resources. If this
client is already started, then this function will do nothing.timeoutMilliseconds
- the maximum number of milliseconds to wait for the underlying amqp connection to open.
If this value is 0, it will have an infinite timeout.IotHubException
- If any IoT Hub level exceptions occur such as an IotHubUnauthorizedException
.IOException
- If any network level exceptions occur such as the connection timing out.InterruptedException
- If this thread is interrupted while waiting for the connection to the service to open.TimeoutException
- If the connection is not established before the provided timeout.public void stop() throws InterruptedException
start()
. If this client has already been stopped,
this function will do nothing.InterruptedException
- if this function is interrupted while waiting for the connection to close down all
network resources.public void stop(int timeoutMilliseconds) throws InterruptedException
start()
. If this client has already been stopped,
this function will do nothing.timeoutMilliseconds
- the maximum number of milliseconds to wait for the underlying amqp connection to close.
If this value is 0, it will have an infinite timeout. If the provided timeout has passed and the connection has
not closed gracefully, then the connection will be forcefully closed and no exception will be thrown.InterruptedException
- if this function is interrupted while waiting for the connection to close down all
network resources.public boolean isRunning()
FileUploadNotificationProcessorClientOptions
will provide the context on when connection loss events occur, and why they occurred.Copyright © 2023. All rights reserved.