IotHubTransportConnection Interface

public interface IotHubTransportConnection

Interface of what all a Transport Connection object must do. Serves to decouple the Message Queueing of the Transport layer from the protocol specific details of the Connection layer.

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

IotHubStatusCode sendMessage(Message message)

Send a single message to the IotHub over the Transport Connection

boolean sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)

Send an acknowledgement to the IotHub for a message that the Transport layer received

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

Method Details

close

public void close()

Closes the transport connection.

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

Returns:

the UUID associated with this connection instance

open

public void open()

Opens the transport connection object

Throws:

TransportException - If any exceptions are encountered while opening the connection

sendMessage

public IotHubStatusCode sendMessage(Message message)

Send a single message to the IotHub over the Transport Connection

Parameters:

message - the message to send

Returns:

the status code from the service

Throws:

TransportException - if any exception is encountered while sending the message

sendMessageResult

public boolean sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)

Send an acknowledgement to the IotHub for a message that the Transport layer received

Parameters:

message - the message to acknowledge
result - the acknowledgement value to notify the service of

Returns:

true if the acknowledgement was sent successfully, and false otherwise

Throws:

TransportException - if an exception occurred while sending the acknowledgement

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

Parameters:

listener - the listener for connection status updates, message arrivals, and message acknowledgements

Applies to