public final class AmqpsIotHubConnection extends org.apache.qpid.proton.engine.BaseHandler implements IotHubTransportConnection
Constructor and Description |
---|
AmqpsIotHubConnection(ClientConfiguration config,
java.lang.String transportUniqueIdentifier) |
AmqpsIotHubConnection(java.lang.String hostName,
java.lang.String transportUniqueIdentifier,
boolean isWebsocketConnection,
javax.net.ssl.SSLContext sslContext,
ProxySettings proxySettings,
int keepAliveInterval) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the transport connection.
|
java.lang.String |
getConnectionId()
Gives the UUID associated with this connection instance.
|
void |
onAuthenticationFailed(java.lang.String deviceId,
TransportException transportException)
Executed when SAS based authentication fails for a device in this connection
|
void |
onAuthenticationSessionOpened()
Executed when the authentication session has successfully been opened.
|
void |
onCBSSessionClosedUnexpectedly(org.apache.qpid.proton.amqp.transport.ErrorCondition errorCondition)
Executed if the CBS session closes unexpectedly.
|
void |
onConnectionBound(org.apache.qpid.proton.engine.Event event) |
void |
onConnectionInit(org.apache.qpid.proton.engine.Event event) |
void |
onConnectionLocalClose(org.apache.qpid.proton.engine.Event event) |
void |
onConnectionLocalOpen(org.apache.qpid.proton.engine.Event event) |
void |
onConnectionRemoteClose(org.apache.qpid.proton.engine.Event event) |
void |
onConnectionRemoteOpen(org.apache.qpid.proton.engine.Event event) |
void |
onDeviceSessionOpened(java.lang.String deviceId)
Executed when a device's amqp session has successfully been opened.
|
void |
onMessageAcknowledged(Message message,
org.apache.qpid.proton.amqp.transport.DeliveryState deliveryState,
java.lang.String deviceId)
Executed when a message sent in this connection was acknowledged by the service.
|
void |
onMessageReceived(IotHubTransportMessage message)
Executed when a message was received by a session that this connection owns.
|
void |
onReactorClosedUnexpectedly()
Executed when the proton-j reactor closed unexpectedly.
|
void |
onReactorFinal(org.apache.qpid.proton.engine.Event event) |
void |
onReactorInit(org.apache.qpid.proton.engine.Event event) |
void |
onSessionClosedAsExpected(java.lang.String deviceId)
Executed if a session closes, but it was expected.
|
void |
onSessionClosedUnexpectedly(org.apache.qpid.proton.amqp.transport.ErrorCondition errorCondition,
java.lang.String deviceId)
Executed if a session closes unexpectedly.
|
void |
onTimerTask(org.apache.qpid.proton.engine.Event event) |
void |
onTransportError(org.apache.qpid.proton.engine.Event event) |
void |
open()
Opens the transport connection object
|
void |
registerMultiplexedDevice(ClientConfiguration config) |
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.
|
void |
unregisterMultiplexedDevice(ClientConfiguration config,
boolean willReconnect)
Asynchronously unregister a multiplexed device from an active multiplexed connection or synchronously unregister
a multiplexed device from a closed multiplexed connection.
|
add, children, getHandler, getHandler, handle, onConnectionFinal, onConnectionUnbound, onDelivery, onLinkFinal, onLinkFlow, onLinkInit, onLinkLocalClose, onLinkLocalDetach, onLinkLocalOpen, onLinkRemoteClose, onLinkRemoteDetach, onLinkRemoteOpen, onReactorQuiesced, onSelectableError, onSelectableExpired, onSelectableFinal, onSelectableInit, onSelectableReadable, onSelectableUpdated, onSelectableWritable, onSessionFinal, onSessionInit, onSessionLocalClose, onSessionLocalOpen, onSessionRemoteClose, onSessionRemoteOpen, onTransport, onTransportClosed, onTransportHeadClosed, onTransportTailClosed, onUnhandled, setHandler, setHandler
public AmqpsIotHubConnection(ClientConfiguration config, java.lang.String transportUniqueIdentifier)
public AmqpsIotHubConnection(java.lang.String hostName, java.lang.String transportUniqueIdentifier, boolean isWebsocketConnection, javax.net.ssl.SSLContext sslContext, ProxySettings proxySettings, int keepAliveInterval)
public void registerMultiplexedDevice(ClientConfiguration config)
public void unregisterMultiplexedDevice(ClientConfiguration config, boolean willReconnect)
config
- the config of the device that should be unregistered.willReconnect
- true if the device will be re-registered soon because it is reconnecting.public void open() throws TransportException
IotHubTransportConnection
open
in interface IotHubTransportConnection
TransportException
- If any exceptions are encountered while opening the connectionpublic void close()
IotHubTransportConnection
close
in interface IotHubTransportConnection
public void onReactorInit(org.apache.qpid.proton.engine.Event event)
onReactorInit
in interface org.apache.qpid.proton.engine.CoreHandler
onReactorInit
in class org.apache.qpid.proton.engine.BaseHandler
public void onReactorFinal(org.apache.qpid.proton.engine.Event event)
onReactorFinal
in interface org.apache.qpid.proton.engine.CoreHandler
onReactorFinal
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionInit(org.apache.qpid.proton.engine.Event event)
onConnectionInit
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionInit
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionBound(org.apache.qpid.proton.engine.Event event)
onConnectionBound
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionBound
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionLocalOpen(org.apache.qpid.proton.engine.Event event)
onConnectionLocalOpen
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionLocalOpen
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionRemoteOpen(org.apache.qpid.proton.engine.Event event)
onConnectionRemoteOpen
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionRemoteOpen
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionLocalClose(org.apache.qpid.proton.engine.Event event)
onConnectionLocalClose
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionLocalClose
in class org.apache.qpid.proton.engine.BaseHandler
public void onConnectionRemoteClose(org.apache.qpid.proton.engine.Event event)
onConnectionRemoteClose
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionRemoteClose
in class org.apache.qpid.proton.engine.BaseHandler
public void onTransportError(org.apache.qpid.proton.engine.Event event)
onTransportError
in interface org.apache.qpid.proton.engine.CoreHandler
onTransportError
in class org.apache.qpid.proton.engine.BaseHandler
public void onTimerTask(org.apache.qpid.proton.engine.Event event)
onTimerTask
in interface org.apache.qpid.proton.engine.CoreHandler
onTimerTask
in class org.apache.qpid.proton.engine.BaseHandler
public void setListener(IotHubListener listener)
IotHubTransportConnection
setListener
in interface IotHubTransportConnection
listener
- the listener for connection status updates, message arrivals, and message acknowledgementspublic IotHubStatusCode sendMessage(Message message)
IotHubTransportConnection
sendMessage
in interface IotHubTransportConnection
message
- the message to sendpublic boolean sendMessageResult(IotHubTransportMessage message, IotHubMessageResult result)
IotHubTransportConnection
sendMessageResult
in interface IotHubTransportConnection
message
- the message to acknowledgeresult
- the acknowledgement value to notify the service ofpublic java.lang.String getConnectionId()
IotHubTransportConnection
getConnectionId
in interface IotHubTransportConnection
public void onDeviceSessionOpened(java.lang.String deviceId)
deviceId
- the id of the device that had its session opened successfullypublic void onAuthenticationSessionOpened()
public void onMessageAcknowledged(Message message, org.apache.qpid.proton.amqp.transport.DeliveryState deliveryState, java.lang.String deviceId)
message
- the message that was acknowledged.deliveryState
- state information that describes if the message was accepted by the receiver or not.deviceId
- the Id of the device whose message was acknowledged.public void onMessageReceived(IotHubTransportMessage message)
message
- the message that was received.public void onAuthenticationFailed(java.lang.String deviceId, TransportException transportException)
deviceId
- the Id of the device for which the authentication failed.transportException
- the cause of that failure.public void onSessionClosedUnexpectedly(org.apache.qpid.proton.amqp.transport.ErrorCondition errorCondition, java.lang.String deviceId)
errorCondition
- the condition of the session that caused the close if the session closed remotely, or the condition
of the link that closed unexpectedly.deviceId
- the device that the session belonged to.public void onCBSSessionClosedUnexpectedly(org.apache.qpid.proton.amqp.transport.ErrorCondition errorCondition)
errorCondition
- the condition of the session that caused the close if the session closed remotely, or the condition
of the link that closed unexpectedly.public void onSessionClosedAsExpected(java.lang.String deviceId)
deviceId
- the device whose connection closed.public void onReactorClosedUnexpectedly()
Copyright © 2023. All rights reserved.