CorrelatingMessageCallback Interface

public interface CorrelatingMessageCallback

This interface has a number of call backs to notify when a message is in a specific part of the IotHubTransport lifecycle.

There is no default implementation of this interface and will be up to the developer to implement.

An example of this implementation and usage can be found in the DeviceTwinSample.

Method Summary

Modifier and Type Method and Description
abstract void onRequestAcknowledged(IotHubTransportPacket packet, Object callbackContext, Throwable e)

Called when the message request has been sent and IoT hub has acknowledged the request.

abstract void onRequestQueued(Message message, IotHubTransportPacket packet, Object callbackContext)

Called when the message has been queued to the transport.

abstract void onRequestSent(Message message, IotHubTransportPacket packet, Object callbackContext)

Called when the message request has been sent by the transport.

abstract void onResponseAcknowledged(Message message, Object callbackContext, Throwable e)

Called when a response to the message has been sent by IoT hub and has been acknowledged by the transport.

abstract void onResponseReceived(Message message, Object callbackContext, Throwable e)

Called when a response to the sent message has been sent by IoT hub and has been receieved by the transport.

abstract void onUnknownMessageAcknowledged(Message message, Object callbackContext, Throwable e)

Called when the response message has been sent by IoT hub and has been acknowledged by the transport; however the message is unknown to the transport.

Method Details

onRequestAcknowledged

public abstract void onRequestAcknowledged(IotHubTransportPacket packet, Object callbackContext, Throwable e)

Called when the message request has been sent and IoT hub has acknowledged the request.

Parameters:

packet - The request message acknowledged by the transport.
callbackContext - The context sent with the message.
e - The error or exception given by the transport. If there are no errors this will be null if there are errors this will more often be a TransportException.

onRequestQueued

public abstract void onRequestQueued(Message message, IotHubTransportPacket packet, Object callbackContext)

Called when the message has been queued to the transport.

Parameters:

message - The request message queued by the transport.
packet - The resulting transport packet which gives access to transport specific properties.
callbackContext - The context sent with the message.

onRequestSent

public abstract void onRequestSent(Message message, IotHubTransportPacket packet, Object callbackContext)

Called when the message request has been sent by the transport.

Parameters:

message - The request message sent by the transport.
packet - The resulting transport packet which gives access to transport specific properties.
callbackContext - The context sent with the message.

onResponseAcknowledged

public abstract void onResponseAcknowledged(Message message, Object callbackContext, Throwable e)

Called when a response to the message has been sent by IoT hub and has been acknowledged by the transport.

Parameters:

message - The response message queued to the transport.
callbackContext - The context sent with the message.
e - The error or exception given by the transport. If there are no errors this will be null if there are errors this will more often be a TransportException.

onResponseReceived

public abstract void onResponseReceived(Message message, Object callbackContext, Throwable e)

Called when a response to the sent message has been sent by IoT hub and has been receieved by the transport.

Parameters:

message - The response message received by the transport.
callbackContext - The context sent with the message.
e - The error or exception given by the transport. If there are no errors this will be null if there are errors this will more often be a TransportException.

onUnknownMessageAcknowledged

public abstract void onUnknownMessageAcknowledged(Message message, Object callbackContext, Throwable e)

Called when the response message has been sent by IoT hub and has been acknowledged by the transport; however the message is unknown to the transport.

Parameters:

message - The message queued to the transport.
callbackContext - The context sent with the message.
e - The error or exception given by the transport. If there are no errors this will be null if there are errors this will more often be a TransportException.

Applies to