Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


oracle.jms
Class AQjmsConnection

java.lang.Object
  extended byoracle.jms.AQjmsObject
      extended byoracle.jms.AQjmsConnection

All Implemented Interfaces:
Connection, QueueConnection, TopicConnection
Direct Known Subclasses:
AQjmsXAConnection

public class AQjmsConnection
extends oracle.jms.AQjmsObject
implements QueueConnection, TopicConnection

This is an Oracle class which implements javax.jms.QueueConnection and javax.jms.TopicConnection.


Method Summary
void close()
Closes the connection.
ConnectionConsumer createConnectionConsumer(Destination destination, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
Creates a connection consumer for this connection (optional operation).
ConnectionConsumer createConnectionConsumer(Queue queue, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
This method is not supported in the current release.
ConnectionConsumer createConnectionConsumer(Topic topic, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
Creates a connection consumer for this connection.
ConnectionConsumer createDurableConnectionConsumer(Topic topic, java.lang.String subscriptionName, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
Creates a durable connection consumer for this connection.
QueueSession createQueueSession(boolean transacted, int acknowledgeMode)
Creates a queue session.
Session createSession(boolean transacted, int acknowledgeMode)
Creates a Session object.
TopicSession createTopicSession(boolean transacted, int acknowledgeMode)
Creates a TopicSession.
java.lang.String getClientID()
Gets this connection's client identifier.
Session getCurrentJmsSession()
Returns the current open JMS session for this connection.
ExceptionListener getExceptionListener()
Gets this connection's ExceptionListener.
ConnectionMetaData getMetaData()
Gets this connection's meta data.
oracle.jdbc.pool.OracleOCIConnectionPool getOCIConnectionPool()
Gets the underlying connection pool for this connection.
void setClientID(java.lang.String clientID)
Sets this connection's client identifier.
void setExceptionListener(ExceptionListener listener)
Sets this connection's ExceptionListener.
void start()
Starts (or restarts) a connection's delivery of incoming messages.
void stop()
Temporarily stops a connection's delivery of incoming messages.

Methods inherited from class oracle.jms.AQjmsObject
checkClosed, children, finalize, getID, getParent, isOpen, localClose, preClose

Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getClientID

public java.lang.String getClientID()
                             throws JMSException
Gets this connection's client identifier.
Specified by:
getClientID in interface Connection
Returns:
the unique client identifier
Throws:
JMSException - if the client ID for this connection is not returned due to some error.

setClientID

public void setClientID(java.lang.String clientID)
                 throws JMSException
Sets this connection's client identifier.
Specified by:
setClientID in interface Connection
Parameters:
clientID - the unique client identifier
Throws:
JMSException - if the client ID for this connection is not set due to some error.
IllegalStateException - if the JMS client attempts to set a connection's client ID at the wrong time or when it has been administratively configured.

getMetaData

public ConnectionMetaData getMetaData()
                               throws JMSException
Gets this connection's meta data.
Specified by:
getMetaData in interface Connection
Returns:
the connection meta data
Throws:
JMSException - if the connection meta-data is not retrieved due to some error.
See Also:
ConnectionMetaData

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
                          throws JMSException
Sets this connection's ExceptionListener.
Specified by:
setExceptionListener in interface Connection
Parameters:
listener - the exception listener
Throws:
JMSException - if the exception listener is not set due to some error.

getExceptionListener

public ExceptionListener getExceptionListener()
                                       throws JMSException
Gets this connection's ExceptionListener.
Specified by:
getExceptionListener in interface Connection
Returns:
the ExceptionListener for this connection, or null. if no ExceptionListener is associated with this connection.
Throws:
JMSException - if the exception listener is not retrieved due to some error.
See Also:
Connection.setExceptionListener(javax.jms.ExceptionListener)

start

public void start()
           throws JMSException
Starts (or restarts) a connection's delivery of incoming messages. Restarting begins with the oldest unacknowledged message. Starting a started connection is ignored.
Specified by:
start in interface Connection
Throws:
JMSException - if message delivery is not started due to some error.
See Also:
Connection.start()

stop

public void stop()
          throws JMSException
Temporarily stops a connection's delivery of incoming messages. The connection can be restarted using the start() method. When stopped, delivery to all of the connection's message consumers is inhibited: synchronous receives block and messages are not delivered to message listeners. After stop is called there may still be some messages delivered. Stopping a connection has no affect on its ability to send messages. Stopping a stopped connection is ignored.
Specified by:
stop in interface Connection
Throws:
JMSException - if message delivery is not stopped due to some error.
See Also:
Connection.stop()

close

public void close()
           throws JMSException
Description copied from interface: Connection
Closes the connection.

Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

There is no need to close the sessions, producers, and consumers of a closed connection.

Closing a connection causes all temporary destinations to be deleted.

When this method is invoked, it should not return until message processing has been shut down in an orderly fashion. This means that all message listeners that may have been running have returned, and that all pending receives have returned. A close terminates all pending message receives on the connection's sessions' consumers. The receives may return with a message or with null, depending on whether there was a message available at the time of the close. If one or more of the connection's sessions' message listeners is processing a message at the time when connection close is invoked, all the facilities of the connection and its sessions must remain available to those listeners until they return control to the JMS provider.

Closing a connection causes any of its sessions' transactions in progress to be rolled back. In the case where a session's work is coordinated by an external transaction manager, a session's commit and rollback methods are not used and the result of a closed session's work is determined later by the transaction manager. Closing a connection does NOT force an acknowledgment of client-acknowledged sessions.

Invoking the acknowledge method of a received message from a closed connection's session must throw an IllegalStateException. Closing a closed connection must NOT throw an exception.

Specified by:
close in interface Connection
Throws:
JMSException

createQueueSession

public QueueSession createQueueSession(boolean transacted,
                                       int acknowledgeMode)
                                throws JMSException
Creates a queue session.
Specified by:
createQueueSession in interface QueueConnection
Parameters:
transacted - is session transacted?
acknowledgeMode - acknowledgement mode
Returns:
a newly created queue session
Throws:
JMSException - if queue session creation fails.
See Also:
Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, Session.DUPS_OK_ACKNOWLEDGE

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Queue queue,
                                                   java.lang.String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
This method is not supported in the current release.
Specified by:
createConnectionConsumer in interface QueueConnection
Parameters:
queue - the queue to access
messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
sessionPool - the server session pool to associate with this connection consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the connection consumer
Throws:
JMSException - NOT_SUPPORTED
See Also:
ConnectionConsumer

createTopicSession

public TopicSession createTopicSession(boolean transacted,
                                       int acknowledgeMode)
                                throws JMSException
Creates a TopicSession.
Specified by:
createTopicSession in interface TopicConnection
Parameters:
transacted - if true, the session is transacted.
acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives. This parameter is ignored if the session is transacted.
Returns:
a newly created topic session
Throws:
JMSException - if session creation fails due to some error or lack of support for the specific transaction and acknowledgement mode.
See Also:
Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, Session.DUPS_OK_ACKNOWLEDGE

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Topic topic,
                                                   java.lang.String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Creates a connection consumer for this connection. This is an expert facility not used by regular JMS clients. This method is not supported in the current release.
Specified by:
createConnectionConsumer in interface TopicConnection
Parameters:
topic - the topic to access
messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
sessionPool - the server session pool to associate with this connection consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the connection consumer
Throws:
JMSException - NOT_SUPPORTED
See Also:
ConnectionConsumer

createDurableConnectionConsumer

public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
                                                          java.lang.String subscriptionName,
                                                          java.lang.String messageSelector,
                                                          ServerSessionPool sessionPool,
                                                          int maxMessages)
                                                   throws JMSException
Creates a durable connection consumer for this connection. This is an expert facility not used by regular JMS clients. This method is not supported in the current release.
Specified by:
createDurableConnectionConsumer in interface Connection
Parameters:
topic - topic to access
subscriptionName - durable subscription name
messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
sessionPool - the server session pool to associate with this durable connection consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the durable connection consumer
Throws:
JMSException - NOT_SUPPORTED
See Also:
ConnectionConsumer

getCurrentJmsSession

public Session getCurrentJmsSession()
Returns the current open JMS session for this connection.

Important: This method will be deprecated in a future release

Returns:
the current open JMS session, or null if no JMS session is currently available

getOCIConnectionPool

public oracle.jdbc.pool.OracleOCIConnectionPool getOCIConnectionPool()
Gets the underlying connection pool for this connection.
Returns:
the oracle.jdbc.pool.OracleOCIConnectionPool pool used to create this connection or null

createSession

public Session createSession(boolean transacted,
                             int acknowledgeMode)
                      throws JMSException
Creates a Session object.
Specified by:
createSession in interface Connection
Parameters:
transacted - indicates whether the session is transacted
acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, and Session.DUPS_OK_ACKNOWLEDGE.
Returns:
a newly created session
Throws:
JMSException - if session creation fails due to some error or lack of support for the specific transaction and acknowledgement mode.
Since:
1.1
See Also:
Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, Session.DUPS_OK_ACKNOWLEDGE

createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Destination destination,
                                                   java.lang.String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Creates a connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients. This method is not supported in the current release.
Specified by:
createConnectionConsumer in interface Connection
Parameters:
destination - the destination to access
messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
sessionPool - the server session pool to associate with this connection consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the connection consumer
Throws:
JMSException - NOT_SUPPORTED
See Also:
ConnectionConsumer

Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


Copyright © 2003, 2005, Oracle. All rights reserved.