public class AmqpsConnection extends ErrorLoggingBaseHandlerWithCleanup
protonJExceptionParser
Constructor and Description |
---|
AmqpsConnection(String hostName,
AmqpDeviceOperations amqpDeviceOperations,
SSLContext sslContext,
SaslHandler saslHandler,
boolean useWebSockets)
Constructor for the Amqp library
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection
|
String |
getConnectionId() |
String |
getHostName() |
boolean |
isConnected()
Returns the status of the connection
|
void |
onConnectionBound(org.apache.qpid.proton.engine.Event 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 |
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 |
onTransportHeadClosed(org.apache.qpid.proton.engine.Event event) |
void |
open()
Opens the connection.
|
void |
openAmqpAsync()
Spawns another thread that attempts to open the AMQP connection.
|
boolean |
sendAmqpMessage(AmqpMessage message)
Send message to the Amqp Endpoint
|
void |
setListener(AmqpListener listener)
Sets the listener for this connection.
|
onConnectionLocalClose, onConnectionLocalOpen, onConnectionRemoteClose, onConnectionRemoteOpen, onLinkLocalClose, onLinkLocalOpen, onLinkRemoteClose, onSessionLocalClose, onSessionLocalOpen, onSessionRemoteClose, onSessionRemoteOpen
add, children, getHandler, getHandler, handle, onConnectionFinal, onLinkFinal, onLinkLocalDetach, onLinkRemoteDetach, onReactorQuiesced, onSelectableError, onSelectableExpired, onSelectableFinal, onSelectableInit, onSelectableReadable, onSelectableUpdated, onSelectableWritable, onSessionFinal, onSessionInit, onTimerTask, onTransport, onTransportClosed, onTransportTailClosed, onUnhandled, setHandler, setHandler
public AmqpsConnection(String hostName, AmqpDeviceOperations amqpDeviceOperations, SSLContext sslContext, SaslHandler saslHandler, boolean useWebSockets) throws IOException
hostName
- Name of the AMQP EndpointamqpDeviceOperations
- Object holding details of the links used in this connectionsslContext
- SSL Context to be set over TLS.saslHandler
- The sasl frame handler. This may be null if no sasl frames will be exchanged (When using x509
authentication for example)useWebSockets
- WebSockets to be used or disabled.IOException
- This exception is thrown if for any reason constructor cannot succeed.public String getConnectionId()
public String getHostName()
public void setListener(AmqpListener listener)
listener
- Listener to be used for this connection.public boolean isConnected() throws Exception
Exception
public void open() throws IOException
IOException
- If connection could not be opened.public void openAmqpAsync()
isConnected()
to check when
this operation has succeeded. Do not attempt to send messages before this connection has been openedpublic void close() throws IOException
IOException
- If connection could not be closed.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
event
- Proton Event objectpublic 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
event
- The Proton Event object.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 onConnectionUnbound(org.apache.qpid.proton.engine.Event event)
onConnectionUnbound
in interface org.apache.qpid.proton.engine.CoreHandler
onConnectionUnbound
in class org.apache.qpid.proton.engine.BaseHandler
public void onLinkInit(org.apache.qpid.proton.engine.Event event)
onLinkInit
in interface org.apache.qpid.proton.engine.CoreHandler
onLinkInit
in class org.apache.qpid.proton.engine.BaseHandler
event
- 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.CoreHandler
onLinkRemoteOpen
in class ErrorLoggingBaseHandlerWithCleanup
event
- The Proton Event object.public boolean sendAmqpMessage(AmqpMessage message) throws Exception
message
- Message to be sentIOException
- If message could not be sent.Exception
public void onDelivery(org.apache.qpid.proton.engine.Event event)
onDelivery
in interface org.apache.qpid.proton.engine.CoreHandler
onDelivery
in class org.apache.qpid.proton.engine.BaseHandler
event
- The Proton Event object.public void onLinkFlow(org.apache.qpid.proton.engine.Event event)
onLinkFlow
in interface org.apache.qpid.proton.engine.CoreHandler
onLinkFlow
in class org.apache.qpid.proton.engine.BaseHandler
event
- The Proton Event object.public void onTransportError(org.apache.qpid.proton.engine.Event event)
onTransportError
in interface org.apache.qpid.proton.engine.CoreHandler
onTransportError
in class ErrorLoggingBaseHandlerWithCleanup
event
- The Proton Event object.public void onTransportHeadClosed(org.apache.qpid.proton.engine.Event event)
onTransportHeadClosed
in interface org.apache.qpid.proton.engine.CoreHandler
onTransportHeadClosed
in class org.apache.qpid.proton.engine.BaseHandler
Copyright © 2022. All rights reserved.