public class TomEEManagedConnectionProxy extends ManagedConnectionProxy implements Connection, QueueConnection, TopicConnection, ExceptionListener, XAConnection
Constructor and Description |
---|
TomEEManagedConnectionProxy(ActiveMQManagedConnection managedConnection,
ConnectionRequestInfo info) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
Session |
createSession()
Creates a
Session object, specifying no arguments. |
Session |
createSession(boolean transacted,
int acknowledgeMode)
Creates a
Session object, specifying transacted and acknowledgeMode . |
Session |
createSession(int acknowledgeMode)
Creates a
Session object, specifying sessionMode . |
ConnectionConsumer |
createSharedConnectionConsumer(Topic topic,
java.lang.String subscriptionName,
java.lang.String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation) on the specific topic using a shared
non-durable subscription with the specified name.
|
ConnectionConsumer |
createSharedDurableConnectionConsumer(Topic topic,
java.lang.String subscriptionName,
java.lang.String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
Creates a connection consumer for this connection (optional operation) on the specific topic using a shared durable
subscription with the specified name.
|
XASession |
createXASession()
Creates an
XASession object. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createConnectionConsumer, createQueueSession
createConnectionConsumer, createDurableConnectionConsumer, createTopicSession
onException
close, createConnectionConsumer, getClientID, getExceptionListener, getMetaData, setClientID, setExceptionListener, start, stop
public TomEEManagedConnectionProxy(ActiveMQManagedConnection managedConnection, ConnectionRequestInfo info)
public void cleanup()
public Session createSession(int acknowledgeMode) throws JMSException
Connection
Session
object, specifying sessionMode
.
The effect of setting the sessionMode
argument depends on whether this method is called in a Java SE
environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is
called in the Java EE web or EJB container then the effect of setting the sessionMode
argument also depends
on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Java EE application client container:
sessionMode
is set to Session.SESSION_TRANSACTED
then the session will use a local transaction
which may subsequently be committed or rolled back by calling the session's commit
or rollback
methods.
sessionMode
is set to any of Session.CLIENT_ACKNOWLEDGE
, Session.AUTO_ACKNOWLEDGE
or
Session.DUPS_OK_ACKNOWLEDGE
. then the session will be non-transacted and messages received by this session
will be acknowledged according to the value of sessionMode
. For a definition of the meaning of these
acknowledgement modes see the links below.
In a Java EE web or EJB container, when there is an active JTA transaction in progress:
sessionMode
is ignored. The session will participate in the JTA transaction and will be
committed or rolled back when that transaction is committed or rolled back, not by calling the session's
commit
or rollback
methods. Since the argument is ignored, developers are recommended to use
createSession()
, which has no arguments, instead of this method.
In the Java EE web or EJB container, when there is no active JTA transaction in progress:
sessionMode
is set to Session.AUTO_ACKNOWLEDGE
or Session.DUPS_OK_ACKNOWLEDGE
then the
session will be non-transacted and messages will be acknowledged according to the value of sessionMode
.
sessionMode
is set to Session.CLIENT_ACKNOWLEDGE
then the JMS provider is recommended to
ignore the specified parameter and instead provide a non-transacted, auto-acknowledged session. However the JMS
provider may alternatively provide a non-transacted session with client acknowledgement.
sessionMode
is set to Session.SESSION_TRANSACTED
, then the JMS provider is recommended to
ignore the specified parameter and instead provide a non-transacted, auto-acknowledged session. However the JMS
provider may alternatively provide a local transacted session.
Session.AUTO_ACKNOWLEDGE
and
Session.DUPS_OK_ACKNOWLEDGE
since applications which use Session.CLIENT_ACKNOWLEDGE
or
Session.SESSION_TRANSACTED
may not be portable.
Applications running in the Java EE web and EJB containers must not attempt to create more than one active (not
closed) Session
object per connection. If this method is called in a Java EE web or EJB container when an
active Session
object already exists for this connection then a JMSException
may be thrown.
createSession
in interface Connection
acknowledgeMode
- specifies the session mode that will be used, except in the cases described above when this value
is ignored. Legal values are JMSContext.SESSION_TRANSACTED
, JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
and JMSContext.DUPS_OK_ACKNOWLEDGE
.JMSException
- if the Connection
object fails to create a session due to
Session.SESSION_TRANSACTED
,
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
,
Connection.createSession(boolean, int)
,
Connection.createSession()
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
Connection
Session
object, specifying transacted
and acknowledgeMode
.
This method has been superseded by the method createSession(int sessionMode)
which specifies the same
information using a single argument, and by the method createSession()
which is for use in a Java EE JTA
transaction. Applications should consider using those methods instead of this one.
The effect of setting the transacted
and acknowledgeMode
arguments depends on whether this method is
called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container.
If this method is called in the Java EE web or EJB container then the effect of setting the transacted} and
acknowledgeMode
arguments also depends on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Java EE application client container:
transacted
is set to true
then the session will use a local transaction which may subsequently
be committed or rolled back by calling the session's commit
or rollback
methods. The argument
acknowledgeMode
is ignored.
transacted
is set to false
then the session will be non-transacted. In this case the argument
acknowledgeMode
is used to specify how messages received by this session will be acknowledged. The permitted
values are Session.CLIENT_ACKNOWLEDGE
, Session.AUTO_ACKNOWLEDGE
and
Session.DUPS_OK_ACKNOWLEDGE
. For a definition of the meaning of these acknowledgement modes see the links
below.
In a Java EE web or EJB container, when there is an active JTA transaction in progress:
transacted
and acknowledgeMode
are ignored. The session will participate in the
JTA transaction and will be committed or rolled back when that transaction is committed or rolled back, not by
calling the session's commit
or rollback
methods. Since both arguments are ignored, developers are
recommended to use createSession()
, which has no arguments, instead of this method.
In the Java EE web or EJB container, when there is no active JTA transaction in progress:
transacted
is set to false and acknowledgeMode
is set to JMSContext.AUTO_ACKNOWLEDGE
or Session.DUPS_OK_ACKNOWLEDGE
then the session will be non-transacted and messages will be acknowledged
according to the value of acknowledgeMode
.
transacted
is set to false and acknowledgeMode
is set to JMSContext.CLIENT_ACKNOWLEDGE
then the JMS provider is recommended to ignore the specified parameters and instead provide a non-transacted,
auto-acknowledged session. However the JMS provider may alternatively provide a non-transacted session with client
acknowledgement.
transacted
is set to true, then the JMS provider is recommended to ignore the specified parameters and
instead provide a non-transacted, auto-acknowledged session. However the JMS provider may alternatively provide a
local transacted session.
transacted
to false and acknowledgeMode
to
JMSContext.AUTO_ACKNOWLEDGE
or Session.DUPS_OK_ACKNOWLEDGE
since since applications which set
transacted
to false and set acknowledgeMode
to JMSContext.CLIENT_ACKNOWLEDGE
, or which set
transacted
to true, may not be portable.
Applications running in the Java EE web and EJB containers must not attempt to create more than one active (not
closed) Session
object per connection. If this method is called in a Java EE web or EJB container when an
active Session
object already exists for this connection then a JMSException
may be thrown.
createSession
in interface Connection
createSession
in interface XAConnection
transacted
- indicates whether the session will use a local transaction, except in the cases described above
when this value is ignored..acknowledgeMode
- when transacted is false, indicates how messages received by the session will be acknowledged,
except in the cases described above when this value is ignored.JMSException
- if the Connection
object fails to create a session due to
Session.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
,
Connection.createSession(int)
,
Connection.createSession()
public Session createSession() throws JMSException
Connection
Session
object, specifying no arguments.
The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Java EE application client container:
Session.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement mode
see the link below.
In a Java EE web or EJB container, when there is an active JTA transaction in progress:
commit
or rollback
methods.
In the Java EE web or EJB container, when there is no active JTA transaction in progress:
Session.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement mode
see the link below.
Applications running in the Java EE web and EJB containers must not attempt to create more than one active (not
closed) Session
object per connection. If this method is called in a Java EE web or EJB container when an
active Session
object already exists for this connection then a JMSException
may be thrown.
createSession
in interface Connection
JMSException
- if the Connection
object fails to create a session due to
Session.AUTO_ACKNOWLEDGE
,
Connection.createSession(boolean, int)
,
Connection.createSession(int)
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic, java.lang.String subscriptionName, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
Connection
This is an expert facility not used by ordinary JMS clients.
This method must not be used in a Java EE web or EJB application. Doing so may cause a JMSException
to be
thrown though this is not guaranteed.
createSharedDurableConnectionConsumer
in interface Connection
topic
- topic to accesssubscriptionName
- the name used to identify the shared durable subscriptionmessageSelector
- 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 consumermaxMessages
- the maximum number of messages that can be assigned to a server session at one timeIllegalStateException
- if called on a QueueConnection
InvalidDestinationException
- if an invalid destination is specified.InvalidSelectorException
- if the message selector is invalid.JMSException
- if the Connection
object fails to create a connection consumer for one of the
following reasons:
sessionPool
and messageSelector
or
ConnectionConsumer
public ConnectionConsumer createSharedConnectionConsumer(Topic topic, java.lang.String subscriptionName, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
Connection
This is an expert facility not used by ordinary JMS clients.
This method must not be used in a Java EE web or EJB application. Doing so may cause a JMSException
to be
thrown though this is not guaranteed.
createSharedConnectionConsumer
in interface Connection
topic
- the topic to accesssubscriptionName
- the name used to identify the shared non-durable subscriptionmessageSelector
- 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 consumermaxMessages
- the maximum number of messages that can be assigned to a server session at one timeIllegalStateException
- if called on a QueueConnection
InvalidDestinationException
- if an invalid destination is specified.InvalidSelectorException
- if the message selector is invalid.JMSException
- if the Connection
object fails to create a connection consumer for one of the
following reasons:
sessionPool
and messageSelector
or
ConnectionConsumer
public XASession createXASession() throws JMSException
XAConnection
XASession
object.createXASession
in interface XAConnection
XASession
JMSException
- if the XAConnection
object fails to create an XASession
due to some internal
error.