public final class AmqpsIotHubConnection
extends org.apache.qpid.proton.engine.BaseHandler
| Modifier and Type | Field and Description |
|---|---|
protected DeviceClientConfig |
config |
protected State |
state |
| Constructor and Description |
|---|
AmqpsIotHubConnection(DeviceClientConfig config,
Boolean useWebSockets)
Constructor to set up connection parameters using the
DeviceClientConfig. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ServerListener listener)
Subscribe a listener to the list of listeners.
|
void |
close()
Closes the
AmqpsIotHubConnection. |
void |
onConnectionBound(org.apache.qpid.proton.engine.Event event)
Event handler for the connection bound event.
|
void |
onConnectionInit(org.apache.qpid.proton.engine.Event event)
Event handler for the connection init event
|
void |
onConnectionUnbound(org.apache.qpid.proton.engine.Event event) |
void |
onDelivery(org.apache.qpid.proton.engine.Event event)
Event handler for the delivery event.
|
void |
onLinkFlow(org.apache.qpid.proton.engine.Event event)
Event handler for the link flow event.
|
void |
onLinkInit(org.apache.qpid.proton.engine.Event event)
Event handler for the link init event.
|
void |
onLinkRemoteClose(org.apache.qpid.proton.engine.Event event)
Event handler for the link remote close event.
|
void |
onLinkRemoteOpen(org.apache.qpid.proton.engine.Event event)
Event handler for the link remote open event.
|
void |
onReactorFinal(org.apache.qpid.proton.engine.Event event) |
void |
onReactorInit(org.apache.qpid.proton.engine.Event event)
Event handler for reactor init event.
|
void |
onTransportError(org.apache.qpid.proton.engine.Event event)
Event handler for the transport error event.
|
void |
open()
Opens the
AmqpsIotHubConnection. |
Integer |
sendMessage(org.apache.qpid.proton.message.Message message)
Creates a binary message using the given content and messageId.
|
Boolean |
sendMessageResult(AmqpsMessage message,
IotHubMessageResult result)
Sends the message result for the previously received message.
|
add, children, getHandler, getHandler, handle, onConnectionFinal, onConnectionLocalClose, onConnectionLocalOpen, onConnectionRemoteClose, onConnectionRemoteOpen, onLinkFinal, onLinkLocalClose, onLinkLocalDetach, onLinkLocalOpen, onLinkRemoteDetach, onReactorQuiesced, onSelectableError, onSelectableExpired, onSelectableFinal, onSelectableInit, onSelectableReadable, onSelectableUpdated, onSelectableWritable, onSessionFinal, onSessionInit, onSessionLocalClose, onSessionLocalOpen, onSessionRemoteClose, onSessionRemoteOpen, onTimerTask, onTransport, onTransportClosed, onTransportHeadClosed, onTransportTailClosed, onUnhandled, setHandler, setHandlerprotected State state
protected DeviceClientConfig config
public AmqpsIotHubConnection(DeviceClientConfig config, Boolean useWebSockets) throws IOException
DeviceClientConfig.config - The DeviceClientConfig corresponding to the device associated with this DeviceClient.useWebSockets - Whether the connection should use web sockets or not.IOExceptionpublic void open()
throws IOException
AmqpsIotHubConnection.
If the current connection is not open, this method
will create a new IotHubSasToken. This method will
start the Reactor, set the connection to open and make it ready for sending.
IOException - If the reactor could not be initialized.public void close()
throws IOException
AmqpsIotHubConnection.
If the current connection is not closed, this function will set the current state to closed and invalidate all connection related variables.
IOExceptionpublic Integer sendMessage(org.apache.qpid.proton.message.Message message)
message - The message to be sent.Integer representing the hash of the message, or -1 if the connection is closed.public Boolean sendMessageResult(AmqpsMessage message, IotHubMessageResult result)
message - the message to be acknowledged.result - the message result (one of IotHubMessageResult.COMPLETE,
IotHubMessageResult.ABANDON, or IotHubMessageResult.REJECT).public void onConnectionInit(org.apache.qpid.proton.engine.Event event)
onConnectionInit in interface org.apache.qpid.proton.engine.CoreHandleronConnectionInit in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onConnectionBound(org.apache.qpid.proton.engine.Event event)
onConnectionBound in interface org.apache.qpid.proton.engine.CoreHandleronConnectionBound in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onConnectionUnbound(org.apache.qpid.proton.engine.Event event)
onConnectionUnbound in interface org.apache.qpid.proton.engine.CoreHandleronConnectionUnbound in class org.apache.qpid.proton.engine.BaseHandlerpublic void onReactorInit(org.apache.qpid.proton.engine.Event event)
onReactorInit in interface org.apache.qpid.proton.engine.CoreHandleronReactorInit in class org.apache.qpid.proton.engine.BaseHandlerevent - Proton Event objectpublic void onReactorFinal(org.apache.qpid.proton.engine.Event event)
onReactorFinal in interface org.apache.qpid.proton.engine.CoreHandleronReactorFinal in class org.apache.qpid.proton.engine.BaseHandlerpublic void onDelivery(org.apache.qpid.proton.engine.Event event)
onDelivery in interface org.apache.qpid.proton.engine.CoreHandleronDelivery in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onLinkFlow(org.apache.qpid.proton.engine.Event event)
onLinkFlow in interface org.apache.qpid.proton.engine.CoreHandleronLinkFlow in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onLinkRemoteOpen(org.apache.qpid.proton.engine.Event event)
Reactor is ready, so we set the connection to OPEN.onLinkRemoteOpen in interface org.apache.qpid.proton.engine.CoreHandleronLinkRemoteOpen in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onLinkRemoteClose(org.apache.qpid.proton.engine.Event event)
onLinkRemoteClose in interface org.apache.qpid.proton.engine.CoreHandleronLinkRemoteClose in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onLinkInit(org.apache.qpid.proton.engine.Event event)
onLinkInit in interface org.apache.qpid.proton.engine.CoreHandleronLinkInit in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void onTransportError(org.apache.qpid.proton.engine.Event event)
onTransportError in interface org.apache.qpid.proton.engine.CoreHandleronTransportError in class org.apache.qpid.proton.engine.BaseHandlerevent - The Proton Event object.public void addListener(ServerListener listener)
listener - the listener to be subscribed.Copyright © 2017. All rights reserved.