public interface IotHubTransport extends Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(Message message,
IotHubEventCallback callback,
Object callbackContext)
Adds a message to the transport queue.
|
void |
close()
Closes all resources used to communicate with an IoT Hub.
|
void |
handleMessage()
Invokes the message callback if a message is found and
responds to the IoT Hub on how the processed message should be
handled by the IoT Hub.
|
void |
invokeCallbacks()
Invokes the callbacks for all completed requests.
|
boolean |
isEmpty()
Returns
true if the transport has no more messages to handle,
and false otherwise. |
void |
open()
Establishes a communication channel with an IoT Hub.
|
void |
sendMessages()
Sends all messages on the transport queue.
|
void open() throws IOException
IOException - if a communication channel cannot be
established.void close()
throws IOException
close() is
called, the transport is no longer usable. If the transport is already
closed, the function shall do nothing.close in interface AutoCloseableclose in interface CloseableIOException - if an error occurs in closing the transport.void addMessage(Message message, IotHubEventCallback callback, Object callbackContext)
message - the message to be sent.callback - the callback to be invoked when a response for the
message is received.callbackContext - the context to be passed in when the callback is
invoked.void sendMessages()
throws IOException
IOException - if the server could not be reached.void invokeCallbacks()
void handleMessage()
throws IOException
Invokes the message callback if a message is found and responds to the IoT Hub on how the processed message should be handled by the IoT Hub.
If no message callback is set, the function will do nothing.IOException - if the server could not be reached.boolean isEmpty()
true if the transport has no more messages to handle,
and false otherwise.true if the transport has no more messages to handle,
and false otherwise.Copyright © 2017. All rights reserved.