MQSession

public class MQSession
extends Object
implements SessionJMSAcknowledgePointJMSDestinationFactory
java.lang.Object
   |
   +----com.ibm.mq.jms.MQSession
          

A JMS session is a single-threaded context for producing and consuming messages.

Methods

close

public void close() throws JMSException;

Closes the session.

Exceptions

commit

public void commit() throws JMSException;

Commits all messages done in this transaction and releases any locks currently held. This always throws a JMSException when you have a direct connection to a broker.

Exceptions

createBrowser

public QueueBrowser createBrowser(Queue queue) throws JMSException;

Creates a QueueBrowser object to peek at the messages on the specified queue.

Parameters
Returns
Exceptions

createBrowser

public QueueBrowser createBrowser(Queue queue, String messageSelector) 
              throws JMSException;

Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.

Parameters
Returns
Exceptions

createBytesMessage

public BytesMessage createBytesMessage() throws JMSException;

Creates a BytesMessage object.

Returns
Exceptions

createConsumer

public MessageConsumer createConsumer(Destination destination) 
              throws JMSException;

Creates a MessageConsumer for the specified Destination. Since Queue and Topic both inherit from Destination, they can be used in the destination parameter to create a MessageConsumer.

Parameters
Returns
Exceptions

createConsumer

public MessageConsumer createConsumer(Destination destination, 
                                      String messageSelector) 
              throws JMSException;

Creates a MessageConsumer for the specified destination, using a message selector.

Parameters
Returns
Exceptions

createConsumer

public MessageConsumer createConsumer(Destination destination, 
                                      String messageSelector, 
                                      boolean noLocal) 
              throws JMSException;

Creates MessageConsumer for the specified Destination, using a message selector.

Parameters
Returns
Exceptions

createDurableSubscriber

public TopicSubscriber createDurableSubscriber(Topic topic, String name) 
              throws JMSException;

Creates a durable Subscriber to the specified topic.

Parameters
Returns
Exceptions

createDurableSubscriber

public TopicSubscriber createDurableSubscriber(Topic topic, String name, 
                                               String selector, 
                                               boolean noLocal) 
              throws JMSException;

Creates a durable Subscriber to the specified topic.

Parameters
Exceptions

createMapMessage

public MapMessage createMapMessage() throws JMSException;

Creates a MapMessage. A MapMessage is used to send a self-defining set of name-value pairs where names are Strings and values are Java primitive types.

Returns
Exceptions

createMessage

public Message createMessage() throws JMSException;

Creates a Message. The Message interface is the root interface of all JMS messages. It holds all the standard message header information. It can be sent when a message containing only header information is sufficient.

Returns
Exceptions

createObjectMessage

public ObjectMessage createObjectMessage() throws JMSException;

Creates an ObjectMessage. An ObjectMessage is used to send a message that contains a serializable Java object.

Returns
Exceptions

createObjectMessage

public ObjectMessage createObjectMessage(Serializable object) 
              throws JMSException;

Creates an initialized ObjectMessage. An ObjectMessage is used to send a message that containing a serializable Java object.

Parameters
Returns
Exceptions

createProducer

public MessageProducer createProducer(Destination destination) 
              throws JMSException;

Creates a MessageProducer to send messages to the specified destination.

Parameters
Exceptions

createQueue

public Queue createQueue(String queueName) throws JMSException;

Creates a Queue object given a queue name.

Parameters
Returns
Exceptions

createStreamMessage

public StreamMessage createStreamMessage() throws JMSException;

Creates a StreamMessage object. A StreamMessage is used to send a self-defining stream of Java primitives.

Returns
Exceptions

createTemporaryQueue

public TemporaryQueue createTemporaryQueue() throws JMSException;

Creates a JMS temporary queue. The temporary queue remains until the connection ends or the queue is explicitly deleted, whichever is the sooner.

Returns
Exceptions

createTemporaryTopic

public TemporaryTopic createTemporaryTopic() throws JMSException;

Creates a temporary topic. The temporary topic remains until the connection ends or the topic is explicitly deleted, whichever is the sooner.

Returns
Exceptions

createTextMessage

public TextMessage createTextMessage() throws JMSException;

Creates a TextMessage. A TextMessage is used to send a message containing a StringBuffer.

Returns
Exceptions

createTextMessage

public TextMessage createTextMessage(String string) throws JMSException;

Creates an initialized TextMessage.

Parameters
Returns
Exceptions

createTopic

public Topic createTopic(String topicName) throws JMSException;

Creates a Topic given a Topic name.

Parameters
Returns
Exceptions

getAcknowledgeMode

public int getAcknowledgeMode() throws JMSException;

Gets the acknowledgement mode of the session. The acknowledgement mode is set at the time that the session is created. If the session is transacted, the acknowledgement mode is ignored.

Returns

getMessageListener

public MessageListener getMessageListener() throws JMSException;

Gets the session's distinguished message listener.

Returns
Exceptions

getTransacted

public boolean getTransacted() throws JMSException;

Indicates whether the session is in transacted mode. Always returns false when you have a direct connection to a broker.

Returns
Exceptions

recover

public void recover() throws JMSException;

Stops message delivery in this session and restarts message delivery with the oldest unacknowledged message. This always throws a JMSException when you have a direct connection to a broker.

Exceptions

rollback

public void rollback() throws JMSException;

Rolls back any messages processed in this transaction and releases any locks currently held. This always throws a JMSException when you have a direct connection to a broker.

Exceptions

setMessageListener

public void setMessageListener(MessageListener listener) 
              throws JMSException;

Sets the session's distinguished message listener.

Parameters
Exceptions

unsubscribe

public void unsubscribe(String name) throws JMSException;

Unsubscribes a durable subscription that has been created by a client.

For a direct connection to WebSphere MQ Event Broker, WebSphere Business Integration Event Broker, or WebSphere Business Integration Message Broker, this method throws a JMSException.

Exceptions