Package com.sun.messaging.jms
Interface Connection
- All Superinterfaces:
- AutoCloseable,- jakarta.jms.Connection
public interface Connection
extends jakarta.jms.Connection
This interafce provides the following API for the MQ applications:
 
1. Provide API to create a MQ NO_ACKNOWLEDGE session.
2. Provide API to set the connection event listener.
3. Provide API to query broker adress and HA state.
- 
Method SummaryModifier and TypeMethodDescriptionjakarta.jms.SessioncreateSession(int acknowledgeMode) Creates aSessionobject.Get the broker's address that the connection is connected (related) to.booleanGet the current connection state.voidRemove a MQ consumer event listener from the current connection.voidsetConsumerEventListener(Destination dest, EventListener listener) Set consumer event listener on a destination to the current connection.voidsetEventListener(EventListener listener) Set MQ connection event listener to the current connection.Methods inherited from interface jakarta.jms.Connectionclose, createConnectionConsumer, createDurableConnectionConsumer, createSession, createSession, createSharedConnectionConsumer, createSharedDurableConnectionConsumer, getClientID, getExceptionListener, getMetaData, setClientID, setExceptionListener, start, stop
- 
Method Details- 
createSessionjakarta.jms.Session createSession(int acknowledgeMode) throws jakarta.jms.JMSException Creates aSessionobject.- Specified by:
- createSessionin interface- jakarta.jms.Connection
- Parameters:
- acknowledgeMode- indicates whether the consumer or the client will acknowledge any messages it receives; Legal values are- Session.AUTO_ACKNOWLEDGE,- Session.CLIENT_ACKNOWLEDGE,- Session.DUPS_OK_ACKNOWLEDGE, and- com.sun.messaging.jms.Session.NO_ACKNOWLEDGE
- Returns:
- a newly created session
- Throws:
- jakarta.jms.JMSException- if the- Connectionobject fails to create a session due to some internal error or lack of support for the specific transaction and acknowledgement mode.
- See Also:
 
- 
setEventListenerSet MQ connection event listener to the current connection.- Parameters:
- listener- EventListener
- Throws:
- jakarta.jms.JMSException
 
- 
setConsumerEventListenervoid setConsumerEventListener(Destination dest, EventListener listener) throws jakarta.jms.JMSException Set consumer event listener on a destination to the current connection.- Parameters:
- dest- the destination on which consumer event is interested
- listener- EventListener
- Throws:
- jakarta.jms.JMSException
- Since:
- 4.5
 
- 
removeConsumerEventListenerRemove a MQ consumer event listener from the current connection.- Parameters:
- dest- the destination on which addConsumerEventListener() was called previously
- Throws:
- jakarta.jms.JMSException
- Since:
- 4.5
 
- 
getBrokerAddressString getBrokerAddress()Get the broker's address that the connection is connected (related) to.- Returns:
- the broker's address that the connection is connected (related) to.
 
- 
isConnectedToHABrokerboolean isConnectedToHABroker()Get the current connection state.- Returns:
- true if the connection is connected to a HA broker. false if not connected to a HA broker.
 
 
-