MQConnection
public class MQConnection
extends Object
implements Connection
java.lang.Object
|
+----com.ibm.mq.jms.MQConnection
A JMS MQConnection is a client's active connection to its
JMS provider.
Methods
close
public void close() throws JMSException;
Moves the connection into the closed state.
- Exceptions
-
createConnectionConsumer
public ConnectionConsumer createConnectionConsumer(Destination destination,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessages)
throws JMSException;
Creates a connection consumer for this connection. This facility is only
used by advanced JMS clients.
- 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
-
- Exceptions
-
- JMSException - if the Connection object fails to create a connection consumer
due to some internal error or invalid arguments for sessionPool and messageSelector.
- InvalidDestinationException - if an invalid destination is specified.
- InvalidSelectorException - if the message selector is invalid.
createDurableConnectionConsumer
public ConnectionConsumer
createDurableConnectionConsumer(Topic topic,
String name,
String messageSelector,
ServerSessionPool sessionPool,
int maxMessageCount) throws JMSException;
Creates a durable connection consumer for this connection. This is facility
is only used by advanced JMS clients.
- Parameters
-
- topic - the topic to be accessed.
- name - the name of the durable subscription.
- messageSelector - delivers only those messages with properties that match
the message selector expression. 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.
- maxMessageCount - the maximum number of messages that can be assigned
to a server session at one time.
- Returns
-
- Exceptions
-
- JMSException - if JMS Connection fails to create a durable connection
consumer due to some internal error or invalid arguments for sessionPool and
message selector.
- InvalidSelectorException - if the message selector is invalid.
createSession
public Session createSession(boolean transacted, int acknowledgeMode)
throws JMSException;
Creates a Session object.
- Parameters
-
- transacted - true indicates that the session is
transacted.
- acknowledgeMode - indicates whether the consumer or the client acknowledges
any messages it receives. Possible values are:
- Session.AUTO_ACKNOWLEDGE
- Session.CLIENT_ACKNOWLEDGE
- Session.DUPS_OK_ACKNOWLEDGE
See the JMS specification for details of these values.
acknowledgeMode is ignored if the session is transacted.
- Returns
-
- Exceptions
-
- JMSException - if the Connection object fails to create a session due
to some internal error or lack of support for the specific transaction and
acknowledgement mode.
getClientID
public String getClientID() throws JMSException;
Gets the client ID for this connection.
- Returns
-
- the unique client identifier.
- Exceptions
-
- JMSException - if JMS implementation fails to return the client ID for
this Connection due to an internal error.
getExceptionListener
public ExceptionListener getExceptionListener() throws JMSException;
Gets the exception listener for this connection. A connection's ExceptionListener
receives a JMSException if there is an unrecoverable problem with the connection
to WebSphere MQ.
- Returns
-
- Exceptions
-
getMetaData
public ConnectionMetaData getMetaData() throws JMSException;
Gets the meta-data for this connection.
- Returns
-
- the connection meta data.
- Exceptions
-
- JMSException - general exception if JMS implementation fails to get the
Connection meta-data for this Connection.
setClientID
public void setClientID(String clientID) throws JMSException;
Sets the client ID for this connection.
- Parameters
-
- clientID - the unique client identifier.
- Exceptions
-
- JMSException - general exception if JMS implementation fails to set the
client ID for this Connection due to an internal error.
- InvalidClientIDException - if JMS client specifies an invalid or duplicate
client ID.
setExceptionListener
public void setExceptionListener(ExceptionListener listener)
throws JMSException;
Sets an exception listener for this connection. A connection's ExceptionListener
receives a JMSException if there is an unrecoverable problem with the connection
to WebSphere MQ.
- Parameters
-
- listener - the exception listener.
- Exceptions
-
start
public void start() throws JMSException;
Start or restart delivering incoming messages.
- Exceptions
-
stop
public void stop() throws JMSException;
Temporarily stops a connection's delivery of incoming messages. It can
be restarted with the start() method. When it is stopped,
it inhibits delivery to all its message consumers. Synchronous receives are
blocked, and messages are not delivered to message listeners. Stopping a session
has no affect on its ability to send messages. Stopping a session that is
already stopped has no effect.
- Exceptions
-
- JMSException - if the JMS implementation fails to stop the message delivery
because of an internal error.