public class MockConnectionExt extends Object implements javax.jms.Connection
| Modifier and Type | Method and Description |
|---|---|
void |
callExceptionListener()
Calls the
ExceptionListener
if an exception is set setJMSException(javax.jms.JMSException). |
void |
callExceptionListener(javax.jms.JMSException exception)
Calls the
ExceptionListener
using the specified exception. |
void |
close() |
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Destination destination,
String s,
javax.jms.ServerSessionPool serverSessionPool,
int i) |
javax.jms.ConnectionConsumer |
createDurableConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i) |
javax.jms.Session |
createSession()
Creates a
Session object,
specifying no arguments. |
javax.jms.Session |
createSession(boolean b,
int i) |
javax.jms.Session |
createSession(int i)
Creates a
Session object, specifying sessionMode. |
javax.jms.ConnectionConsumer |
createSharedConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
Creates a connection consumer for this connection (optional operation)
on the specific topic using a shared non-durable subscription with
the specified name.
|
javax.jms.ConnectionConsumer |
createSharedDurableConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
Creates a connection consumer for this connection (optional operation)
on the specific topic using a shared durable subscription with
the specified name.
|
String |
getClientID() |
com.mockrunner.jms.ConfigurationManager |
getConfigurationManager()
Returns the
ConfigurationManager. |
com.mockrunner.jms.DestinationManager |
getDestinationManager()
Returns the
DestinationManager. |
javax.jms.ExceptionListener |
getExceptionListener() |
javax.jms.ConnectionMetaData |
getMetaData() |
String |
getPassword()
Returns the password.
|
com.mockrunner.mock.jms.MockSession |
getSession(int index)
Returns a
MockSession. |
List |
getSessionList()
Returns the list of
MockSession objects. |
String |
getUserName()
Returns the user name.
|
boolean |
isClosed() |
boolean |
isStarted() |
boolean |
isStopped() |
void |
setClientID(String s) |
void |
setExceptionListener(javax.jms.ExceptionListener exceptionListener) |
void |
setMetaData(javax.jms.ConnectionMetaData metaData)
You can use this to set the
ConnectionMetaData. |
void |
start() |
void |
stop() |
void |
throwJMSException()
Throws a
JMSException if one is set with
setJMSException(javax.jms.JMSException). |
public String getUserName()
public String getPassword()
public com.mockrunner.jms.DestinationManager getDestinationManager()
DestinationManager.DestinationManagerpublic com.mockrunner.jms.ConfigurationManager getConfigurationManager()
ConfigurationManager.ConfigurationManagerpublic List getSessionList()
MockSession objects.public com.mockrunner.mock.jms.MockSession getSession(int index)
MockSession. If there's no such
MockSession, null is returned.index - the index of the session objectpublic void throwJMSException()
throws javax.jms.JMSException
JMSException if one is set with
setJMSException(javax.jms.JMSException). Deletes the exception.javax.jms.JMSException - thrown of JMSException has been set.public void callExceptionListener()
ExceptionListener
if an exception is set setJMSException(javax.jms.JMSException).
Deletes the exception after calling the ExceptionListener.public void callExceptionListener(javax.jms.JMSException exception)
ExceptionListener
using the specified exception.exception - the exceptionpublic void setMetaData(javax.jms.ConnectionMetaData metaData)
ConnectionMetaData.
Usually this should not be necessary. Per default an instance
of MockConnectionMetaData is returned when calling
getMetaData().metaData - the meta datapublic javax.jms.Session createSession(boolean b,
int i)
throws javax.jms.JMSException
createSession in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
String s,
javax.jms.ServerSessionPool serverSessionPool,
int i)
throws javax.jms.JMSException
createConnectionConsumer in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
throws javax.jms.JMSException
createDurableConnectionConsumer in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ConnectionMetaData getMetaData()
throws javax.jms.JMSException
getMetaData in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic String getClientID() throws javax.jms.JMSException
getClientID in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void setClientID(String s) throws javax.jms.JMSException
setClientID in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic javax.jms.ExceptionListener getExceptionListener()
throws javax.jms.JMSException
getExceptionListener in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void setExceptionListener(javax.jms.ExceptionListener exceptionListener)
throws javax.jms.JMSException
setExceptionListener in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void start()
throws javax.jms.JMSException
start in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void stop()
throws javax.jms.JMSException
stop in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic void close()
throws javax.jms.JMSException
close in interface AutoCloseableclose in interface javax.jms.Connectionjavax.jms.JMSExceptionpublic boolean isStarted()
public boolean isStopped()
public boolean isClosed()
public javax.jms.Session createSession(int i)
throws javax.jms.JMSException
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:
acknowledgeMode must be set to either of
Session.AUTO_ACKNOWLEDGE or
Session.DUPS_OK_ACKNOWLEDGE.
The session will be non-transacted and messages received by this session will be acknowledged
automatically according to the value of acknowledgeMode.
For a definition of the meaning of these acknowledgement modes see the links below.
The values Session.SESSION_TRANSACTED and Session.CLIENT_ACKNOWLEDGE may not be used.
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 will be thrown.
createSession in interface javax.jms.Connectioni - indicates which of four possible session modes will be used.
Session.SESSION_TRANSACTED,
Session.CLIENT_ACKNOWLEDGE,
Session.AUTO_ACKNOWLEDGE and
Session.DUPS_OK_ACKNOWLEDGE.
Session.AUTO_ACKNOWLEDGE and
Session.DUPS_OK_ACKNOWLEDGE.
In this case the values Session.TRANSACTED and Session.CLIENT_ACKNOWLEDGE are not permitted.
javax.jms.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 javax.jms.Session createSession()
throws javax.jms.JMSException
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 will be thrown.
createSession in interface javax.jms.Connectionjavax.jms.JMSException - if the Connection object fails
to create a session due to
Session.AUTO_ACKNOWLEDGE,
Connection.createSession(boolean, int),
Connection.createSession(int)public javax.jms.ConnectionConsumer createSharedConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
throws javax.jms.JMSException
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 javax.jms.Connectiontopic - the topic to accesss - the name used to identify the shared non-durable subscriptions1 - 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.serverSessionPool - the server session pool to associate with this connection
consumeri - the maximum number of messages that can be assigned to a
server session at one timejavax.jms.JMSException - if the Connection object fails to create a
connection consumer for one of the following reasons:
sessionPool and
messageSelector or
ConnectionConsumerpublic javax.jms.ConnectionConsumer createSharedDurableConnectionConsumer(javax.jms.Topic topic,
String s,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
throws javax.jms.JMSException
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 javax.jms.Connectiontopic - topic to accesss - the name used to identify the shared durable subscriptions1 - 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.serverSessionPool - the server session pool to associate with this durable
connection consumeri - the maximum number of messages that can be assigned to a
server session at one timejavax.jms.JMSException - if the Connection object fails to create a
connection consumer for one of the following reasons:
sessionPool and messageSelector or
ConnectionConsumerCopyright © 2017–2018. All rights reserved.