Class Connection

A Connection object is a client's active connection to its JMS provider.

A connection serves several purposes:

Because the creation of a connection involves setting up authentication and communication, a connection is a relatively heavyweight object. Most clients will do all their messaging with a single connection. Other more advanced applications may use several connections. The JMS API does not architect a reason for using multiple connections; however, there may be operational reasons for doing so.

A JMS client typically creates a connection, one or more sessions, and a number of message producers and consumers. When a connection is created, it is in stopped mode. That means that no messages are being delivered.

It is typical to leave the connection in stopped mode until setup is complete (that is, until all message consumers have been created). At that point, the client calls the connection's start method, and messages begin arriving at the connection's consumers. This setup convention minimizes any client confusion that may result from asynchronous message delivery while the client is still in the process of setting itself up.

A connection can be started immediately, and the setup can be done afterwards. Clients that do this must be prepared to handle asynchronous message delivery while they are still in the process of setting up.

A message producer can send messages while a connection is stopped.


Constructor Summary
Connection()
            Use JmsConnectionFactory.createConnection()
 
Method Summary
 VoidFuture close(callback)
           Closes the connection.
 Session createSession(transacted, acknowledgeMode)
           Creates a Session object.
 String getClientID()
           Gets the client identifier for this connection.
 ExceptionListener getExceptionListener()
           Gets the ExceptionListener object for this connection.
 ConnectionMetaData getMetaData()
           Fetches the metadata associated with the connection.
 void setClientID()
           Sets the client identifier for this connection.
 void setExceptionListener(listener)
           Sets an exception listener for this connection.
 VoidFuture start(callback)
           Starts (or restarts) a connection's delivery of incoming messages.
 VoidFuture stop(callback)
           Temporarily stops a connection's delivery of incoming messages.
 
Constructor Detail

Connection

Connection()

Method Detail

close

VoidFuture close(callback)

createSession

Session createSession(transacted, acknowledgeMode)

getClientID

String getClientID()

getExceptionListener

ExceptionListener getExceptionListener()

getMetaData

ConnectionMetaData getMetaData()

setClientID

void setClientID()

setExceptionListener

void setExceptionListener(listener)

start

VoidFuture start(callback)

stop

VoidFuture stop(callback)