Partager via


FeedbackReceiver Class

public class FeedbackReceiver
extends Receiver

FeedbackReceiver is a specialized receiver whose ReceiveAsync method returns a FeedbackBatch instead of a Message.

Constructor Summary

Constructor Description
FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol)

Constructor to verify initialization parameters Create instance of AmqpReceive

FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, ProxyOptions proxyOptions)

Constructor to verify initialization parameters Create instance of AmqpReceive

FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, ProxyOptions proxyOptions, SSLContext sslContext)

Constructor to verify initialization parameters Create instance of AmqpReceive

FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, String deviceId)

Deprecated

Constructor to verify initialization parameters Create instance of AmqpReceive

Method Summary

Modifier and Type Method and Description
void close()

Close AmqpReceive object

java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()

Async wrapper for close() operation

void open()

Open AmqpReceive object

java.util.concurrent.CompletableFuture<java.lang.Void> openAsync()

Async wrapper for open() operation

FeedbackBatch receive()

Receive FeedbackBatch with default timeout This function is synchronized internally so that only one receive operation is allowed at a time.

FeedbackBatch receive(long timeoutMs)

Receive FeedbackBatch with specific timeout This function is synchronized internally so that only one receive operation is allowed at a time.

java.util.concurrent.CompletableFuture<FeedbackBatch> receiveAsync()

Async wrapper for receive() operation with default timeout

java.util.concurrent.CompletableFuture<FeedbackBatch> receiveAsync(long timeoutMs)

Async wrapper for receive() operation with specific timeout

Methods inherited from Receiver

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

FeedbackReceiver

public FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol)

Constructor to verify initialization parameters Create instance of AmqpReceive

Parameters:

hostName - The iot hub host name
userName - The iot hub user name
sasToken - The iot hub SAS token for the given device
iotHubServiceClientProtocol - protocol to be used

FeedbackReceiver

public FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, ProxyOptions proxyOptions)

Constructor to verify initialization parameters Create instance of AmqpReceive

Parameters:

hostName - The iot hub host name
userName - The iot hub user name
sasToken - The iot hub SAS token for the given device
iotHubServiceClientProtocol - protocol to be used
proxyOptions - the proxy options to tunnel through, if a proxy should be used.

FeedbackReceiver

public FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, ProxyOptions proxyOptions, SSLContext sslContext)

Constructor to verify initialization parameters Create instance of AmqpReceive

Parameters:

hostName - The iot hub host name
userName - The iot hub user name
sasToken - The iot hub SAS token for the given device
iotHubServiceClientProtocol - protocol to be used
proxyOptions - the proxy options to tunnel through, if a proxy should be used.
sslContext - the SSL context to use during the TLS handshake when opening the connection. If null, a default SSL context will be generated. This default SSLContext trusts the IoT Hub public certificates.

FeedbackReceiver


public FeedbackReceiver(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol, String deviceId)

Deprecated

Constructor to verify initialization parameters Create instance of AmqpReceive

Parameters:

hostName - The iot hub host name
userName - The iot hub user name
sasToken - The iot hub SAS token for the given device
iotHubServiceClientProtocol - The iot hub protocol name
deviceId - The device id (not used)

Method Details

close

public void close()

Close AmqpReceive object

Throws:

java.io.IOException - This exception is thrown if the input AmqpReceive object is null

closeAsync

public CompletableFuture closeAsync()

Async wrapper for close() operation

Overrides:

FeedbackReceiver.closeAsync()

Returns:

The future object for the requested operation

open

public void open()

Open AmqpReceive object

Throws:

java.io.IOException - This exception is thrown if the input AmqpReceive object is null

openAsync

public CompletableFuture openAsync()

Async wrapper for open() operation

Overrides:

FeedbackReceiver.openAsync()

Returns:

The future object for the requested operation

receive

public FeedbackBatch receive()

Receive FeedbackBatch with default timeout This function is synchronized internally so that only one receive operation is allowed at a time. In order to do more receive operations at a time, you will need to instantiate another FeedbackReceiver instance.

Returns:

The received FeedbackBatch object

Throws:

java.io.IOException - This exception is thrown if the input AmqpReceive object is null
java.lang.InterruptedException - This exception is thrown if the input AmqpReceive object is null

receive

public FeedbackBatch receive(long timeoutMs)

Receive FeedbackBatch with specific timeout This function is synchronized internally so that only one receive operation is allowed at a time. In order to do more receive operations at a time, you will need to instantiate another FeedbackReceiver instance.

Parameters:

timeoutMs - The timeout in milliseconds

Returns:

The received FeedbackBatch object

Throws:

java.io.IOException - This exception is thrown if the input AmqpReceive object is null
java.lang.InterruptedException - This exception is thrown if the input AmqpReceive object is null

receiveAsync

public CompletableFuture receiveAsync()

Async wrapper for receive() operation with default timeout

Overrides:

FeedbackReceiver.receiveAsync()

Returns:

The future object for the requested operation

receiveAsync

public CompletableFuture receiveAsync(long timeoutMs)

Async wrapper for receive() operation with specific timeout

Overrides:

FeedbackReceiver.receiveAsync(long timeoutMs)

Parameters:

timeoutMs

Returns:

The future object for the requested operation

Applies to