AmqpsConnection Class

public class AmqpsConnection extends ErrorLoggingBaseHandlerWithCleanup

Constructor Summary

Constructor Description
AmqpsConnection(String hostName, AmqpDeviceOperations amqpDeviceOperations, SSLContext sslContext, SaslHandler saslHandler, boolean useWebSockets)

Constructor for the Amqp library

Method Summary

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(Event event)
void onConnectionInit(Event event)

Event handler for the connection init event

void onConnectionUnbound(Event event)
void onDelivery(Event event)

Event handler for the delivery event. This method handles both sending and receiving a message.

void onLinkFlow(Event event)

Event handler for the link flow event. Handles sending a single message.

void onLinkInit(Event event)

Event handler for the link init event. Sets the proper target address on the link.

void onLinkRemoteOpen(Event event)

Event handler for the link remote open event. This signifies that the org.apache.qpid.proton.reactor.Reactor is ready, so we set the connection to OPEN.

void onReactorFinal(Event event)
void onReactorInit(Event event)

Event handler for reactor init event.

void onTransportError(Event event)

Event handler for the transport error event. This triggers reconnection attempts until successful.

void onTransportHeadClosed(Event event)
void open()

Opens the connection.

void openAmqpAsync()

Spawns another thread that attempts to open the AMQP connection. Use isConnected() to check when this operation has succeeded. Do not attempt to send messages before this connection has been opened

boolean sendAmqpMessage(AmqpMessage message)

Send message to the Amqp Endpoint

void setListener(AmqpListener listener)

Sets the listener for this connection.

Inherited Members

Constructor Details

AmqpsConnection

public AmqpsConnection(String hostName, AmqpDeviceOperations amqpDeviceOperations, SSLContext sslContext, SaslHandler saslHandler, boolean useWebSockets)

Constructor for the Amqp library

Parameters:

hostName - Name of the AMQP Endpoint
amqpDeviceOperations - Object holding details of the links used in this connection
sslContext - 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.

Throws:

IOException - This exception is thrown if for any reason constructor cannot succeed.

Method Details

close

public void close()

Closes the connection

Throws:

IOException - If connection could not be closed.

getConnectionId

public String getConnectionId()

getHostName

public String getHostName()

isConnected

public boolean isConnected()

Returns the status of the connection

Returns:

status of the connection

onConnectionBound

public void onConnectionBound(Event event)

Parameters:

event

onConnectionInit

public void onConnectionInit(Event event)

Event handler for the connection init event

Parameters:

event - The Proton Event object.

onConnectionUnbound

public void onConnectionUnbound(Event event)

Parameters:

event

onDelivery

public void onDelivery(Event event)

Event handler for the delivery event. This method handles both sending and receiving a message.

Parameters:

event - The Proton Event object.

onLinkFlow

public void onLinkFlow(Event event)

Event handler for the link flow event. Handles sending a single message.

Parameters:

event - The Proton Event object.

onLinkInit

public void onLinkInit(Event event)

Event handler for the link init event. Sets the proper target address on the link.

Parameters:

event - The Proton Event object.

onLinkRemoteOpen

public void onLinkRemoteOpen(Event event)

Event handler for the link remote open event. This signifies that the org.apache.qpid.proton.reactor.Reactor is ready, so we set the connection to OPEN.

Parameters:

event - The Proton Event object.

onReactorFinal

public void onReactorFinal(Event event)

Parameters:

event

onReactorInit

public void onReactorInit(Event event)

Event handler for reactor init event.

Parameters:

event - Proton Event object

onTransportError

public void onTransportError(Event event)

Event handler for the transport error event. This triggers reconnection attempts until successful.

Parameters:

event - The Proton Event object.

onTransportHeadClosed

public void onTransportHeadClosed(Event event)

Parameters:

event

open

public void open()

Opens the connection.

Throws:

IOException - If connection could not be opened.

openAmqpAsync

public void openAmqpAsync()

Spawns another thread that attempts to open the AMQP connection. Use isConnected() to check when this operation has succeeded. Do not attempt to send messages before this connection has been opened

sendAmqpMessage

public boolean sendAmqpMessage(AmqpMessage message)

Send message to the Amqp Endpoint

Parameters:

message - Message to be sent

Returns:

true if message was sent successfully, false other wise.

Throws:

IOException - If message could not be sent.

setListener

public void setListener(AmqpListener listener)

Sets the listener for this connection.

Parameters:

listener - Listener to be used for this connection.

Applies to