HttpsIotHubConnection Class
- java.
lang. Object - IotHubTransportConnection
- com.
microsoft. azure. sdk. iot. device. transport. https. HttpsIotHubConnection
- com.
public class HttpsIotHubConnection implements IotHubTransportConnection
An HTTPS connection between a device and an IoT Hub. Contains functionality for synchronously connecting to the different IoT Hub resource URIs.
Constructor Summary
Constructor | Description |
---|---|
HttpsIotHubConnection(ClientConfiguration config) |
Constructs an instance from the given ClientConfiguration object. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the transport connection. |
String |
getConnectionId()
Gives the UUID associated with this connection instance. This string is used in conjunction with the callbacks with connection status updates to ensure that all connection status updates are relevant to this connection object |
void |
open()
Opens the transport connection object |
Iot |
receiveMessage()
Receives an IotHubTransportMessage, if one exists. |
Https |
sendHttpsMessage(HttpsMessage httpsMessage, HttpsMethod httpsMethod, String httpsPath, Map<String, String> additionalHeaders)
Sends an generic https message. |
Iot |
sendMessage(Message message)
Sends an event message. |
boolean |
sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)
Sends the message result for the previously received message. |
void |
setListener(IotHubListener listener)
Sets a listener into the Transport Connection object. This listener updates the Transport layer of connection status updates, message arrivals, and message acknowledgements |
Constructor Details
HttpsIotHubConnection
public HttpsIotHubConnection(ClientConfiguration config)
Constructs an instance from the given ClientConfiguration object.
Parameters:
Method Details
close
public void close()
Closes the transport connection.
Overrides:
HttpsIotHubConnection.close()getConnectionId
public String getConnectionId()
Gives the UUID associated with this connection instance. This string is used in conjunction with the callbacks with connection status updates to ensure that all connection status updates are relevant to this connection object
Overrides:
HttpsIotHubConnection.getConnectionId()Returns:
open
public void open()
Opens the transport connection object
Overrides:
HttpsIotHubConnection.open()Throws:
receiveMessage
public IotHubTransportMessage receiveMessage()
Receives an IotHubTransportMessage, if one exists.
Returns:
Throws:
sendHttpsMessage
public HttpsResponse sendHttpsMessage(HttpsMessage httpsMessage, HttpsMethod httpsMethod, String httpsPath, Map
Sends an generic https message.
Parameters:
Returns:
Throws:
sendMessage
public IotHubStatusCode sendMessage(Message message)
Sends an event message.
Overrides:
HttpsIotHubConnection.sendMessage(Message message)Parameters:
Returns:
Throws:
sendMessageResult
public boolean sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)
Sends the message result for the previously received message.
Overrides:
HttpsIotHubConnection.sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)Parameters:
Throws:
ifsendMessageResult
</code> is called before <xref uid="com.microsoft.azure.sdk.iot.device.transport.https.HttpsIotHubConnection.receiveMessage()" data-throw-if-not-resolved="false" data-raw-source="receiveMessage()"></xref> is called. </p>
TransportException
- if the IoT Hub could not be reached.
setListener
public void setListener(IotHubListener listener)
Sets a listener into the Transport Connection object. This listener updates the Transport layer of connection status updates, message arrivals, and message acknowledgements
Overrides:
HttpsIotHubConnection.setListener(IotHubListener listener)
Parameters:
listener
- the listener for connection status updates, message arrivals, and message acknowledgements
Applies to
Azure SDK for Java