public class MQSession extends MQRoot implements javax.jms.Session, JmsSession
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the session.
|
void |
commit()
Commits all messages done in this transaction and releases any locks currently held.
|
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue)
Creates a QueueBrowser object to peek at the messages on the specified queue.
|
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue,
java.lang.String messageSelector)
Creates a QueueBrowser object to peek at the messages on the specified queue using a message
selector.
|
javax.jms.BytesMessage |
createBytesMessage()
Creates a BytesMessage object.
|
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination)
Creates a message consumer for the specified destination.
|
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector)
Creates a message consumer for the specified destination, using a message selector.
|
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector,
boolean noLocal)
Creates a message consumer for the specified destination, using a message selector.
|
javax.jms.MessageConsumer |
createDurableConsumer(javax.jms.Topic topic,
java.lang.String name) |
javax.jms.MessageConsumer |
createDurableConsumer(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal) |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name)
Creates a durable subscriber to the specified topic.
|
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal)
Creates a durable subscriber to the specified topic.
|
javax.jms.MapMessage |
createMapMessage()
Creates a MapMessage.
|
javax.jms.Message |
createMessage()
Creates a Message.
|
javax.jms.ObjectMessage |
createObjectMessage()
Creates an ObjectMessage.
|
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable object)
Creates an initialized ObjectMessage.
|
javax.jms.MessageProducer |
createProducer(javax.jms.Destination destinationP)
Creates a message producer to send messages to the specified destination.
|
javax.jms.Queue |
createQueue(java.lang.String queueName)
Creates a queue object given a queue name.
|
javax.jms.MessageConsumer |
createSharedConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName) |
javax.jms.MessageConsumer |
createSharedConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName,
java.lang.String messageSelector) |
javax.jms.MessageConsumer |
createSharedDurableConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName) |
javax.jms.MessageConsumer |
createSharedDurableConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName,
java.lang.String messageSelector) |
javax.jms.StreamMessage |
createStreamMessage()
Creates a StreamMessage object.
|
javax.jms.TemporaryQueue |
createTemporaryQueue()
Creates a JMS temporary queue.
|
javax.jms.TemporaryTopic |
createTemporaryTopic()
Creates a temporary topic.
|
javax.jms.TextMessage |
createTextMessage()
Creates a TextMessage.
|
javax.jms.TextMessage |
createTextMessage(java.lang.String string)
Creates an initialized TextMessage.
|
javax.jms.Topic |
createTopic(java.lang.String topicName)
Creates a Topic given a Topic name.
|
void |
deliver(java.util.List messageReferences) |
int |
getAcknowledgeMode()
Gets the acknowledgement mode of the session.
|
javax.jms.MessageListener |
getMessageListener()
Gets the session's distinguished message listener.
|
boolean |
getTransacted()
Indicates whether the session is in transacted mode.
|
void |
recover()
Stops message delivery in this session and restarts message delivery with the oldest
unacknowledged message.
|
void |
rollback()
Rolls back any messages processed in this transaction and releases any locks currently held.
|
void |
setMessageListener(javax.jms.MessageListener listener)
Sets the session's distinguished message listener.
|
void |
unsubscribe(java.lang.String name)
Unsubscribes a durable subscription that has been created by a client.
|
clear, containsKey, containsValue, entrySet, equals, get, getBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, hashCode, isEmpty, keySet, propertyExists, put, putAll, remove, setBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, size, valuesgetClass, notify, notifyAll, toString, wait, wait, waitsetBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setShortProperty, setStringPropertygetBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExistspublic void close()
throws javax.jms.JMSException
close in interface java.lang.AutoCloseableclose in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void commit()
throws javax.jms.JMSException
commit in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
throws javax.jms.JMSException
createBrowser in interface javax.jms.Sessionqueue - the queue to access.javax.jms.JMSException - if the operation failspublic javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
java.lang.String messageSelector)
throws javax.jms.JMSException
createBrowser in interface javax.jms.Sessionqueue - 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.javax.jms.JMSException - if the operation failspublic javax.jms.BytesMessage createBytesMessage()
throws javax.jms.JMSException
createBytesMessage in interface javax.jms.Sessionjavax.jms.JMSException - if JMS fails due to some internal JMS error.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
throws javax.jms.JMSException
createConsumer in interface javax.jms.Sessiondestination - the destination to access.javax.jms.JMSException - if the command fails due to some internal JMS error.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector)
throws javax.jms.JMSException
createConsumer in interface javax.jms.Sessiondestination - the destination to access.messageSelector - the message selectorjavax.jms.JMSException - if the command fails due to some internal JMS error.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
java.lang.String messageSelector,
boolean noLocal)
throws javax.jms.JMSException
createConsumer in interface javax.jms.Sessiondestination - the destination to access.messageSelector - the message selectornoLocal - when the destination is a topic, true inhibits the delivery of messages
published by its own connection. The behavior for NoLocal is ignored if the
destination is a queue.javax.jms.JMSException - if the operation failspublic javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name)
throws javax.jms.JMSException
createDurableSubscriber in interface javax.jms.Sessiontopic - the topic to subscribe toname - the name used to identify this subscription.java.lang.IllegalStateException - if the session has been closed.javax.jms.InvalidDestinationException - if the topic specified is not valid.javax.jms.JMSException - if the session fails to create a subscriber due to an internal error.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal)
throws javax.jms.JMSException
createDurableSubscriber in interface javax.jms.Sessiontopic - the topic to subscribe toname - the name used to identify this subscription.selector - only messages with properties matching the message selector expression are
delivered. This value may be null.noLocal - true inhibits the delivery of messages published by its own connection.java.lang.IllegalStateException - if the session has been closed.javax.jms.InvalidDestinationException - if the topic specified is not valid.javax.jms.JMSException - if the session fails to create a subscriber due to an internal error.public javax.jms.MapMessage createMapMessage()
throws javax.jms.JMSException
createMapMessage in interface javax.jms.Sessionjavax.jms.JMSException - if the operation failspublic javax.jms.Message createMessage()
throws javax.jms.JMSException
createMessage in interface javax.jms.Sessionjavax.jms.JMSException - if the operation failspublic javax.jms.ObjectMessage createObjectMessage()
throws javax.jms.JMSException
createObjectMessage in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object)
throws javax.jms.JMSException
createObjectMessage in interface javax.jms.Sessionobject - the object to use to initialize this message.javax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic javax.jms.MessageProducer createProducer(javax.jms.Destination destinationP)
throws javax.jms.JMSException
createProducer in interface javax.jms.SessiondestinationP - the destination to send to, or null if this is a producer which does not
have a specified destinationjavax.jms.JMSException - if the session fails to create a producer because of an internal errorpublic javax.jms.Queue createQueue(java.lang.String queueName)
throws javax.jms.JMSException
createQueue in interface javax.jms.SessionqueueName - the name of the queue to be created.javax.jms.JMSException - if the operation failspublic javax.jms.StreamMessage createStreamMessage()
throws javax.jms.JMSException
createStreamMessage in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closed.public javax.jms.TemporaryQueue createTemporaryQueue()
throws javax.jms.JMSException
This session will have been created from a connection that was created from a Connection Factory.
If that Connection Factory has a Model Queue defined on it that is a permanent dynamic queue (or the default
queue has been modified to have that behaviour), the temporary queue created from this method
is only deleted when an explicit MQTemporaryQueue.delete() call is made.
The difference is within the WebSphere Application Server, MQTemporaryQueue.delete() will be called
by the application server when a connection is being closed. Therefore even if a permanent dynamic
model queue is used, the created temporary queue will be destroyed.
createTemporaryQueue in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closed.public javax.jms.TemporaryTopic createTemporaryTopic()
throws javax.jms.JMSException
createTemporaryTopic in interface javax.jms.Sessionjavax.jms.JMSException - if the session fails to create a temporary topic due to an internal error.java.lang.IllegalStateException - if the Session object has been closed.public javax.jms.TextMessage createTextMessage()
throws javax.jms.JMSException
createTextMessage in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic javax.jms.TextMessage createTextMessage(java.lang.String string)
throws javax.jms.JMSException
createTextMessage in interface javax.jms.Sessionstring - the string used to initialize this message.javax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic javax.jms.Topic createTopic(java.lang.String topicName)
throws javax.jms.JMSException
createTopic in interface javax.jms.SessiontopicName - the name of this topicjavax.jms.JMSException - if a session fails to create a Topic due to an internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic int getAcknowledgeMode()
throws javax.jms.JMSException
getAcknowledgeMode in interface javax.jms.Sessionjavax.jms.JMSException - if the operation failspublic javax.jms.MessageListener getMessageListener()
throws javax.jms.JMSException
getMessageListener in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic boolean getTransacted()
throws javax.jms.JMSException
getTransacted in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic void recover()
throws javax.jms.JMSException
recover in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic void rollback()
throws javax.jms.JMSException
rollback in interface javax.jms.Sessionjavax.jms.JMSException - if the operation fails due to some internal errorjava.lang.IllegalStateException - if the Session object has been closedpublic void setMessageListener(javax.jms.MessageListener listener)
throws javax.jms.JMSException
setMessageListener in interface javax.jms.Sessionlistener - the listener to setjavax.jms.JMSException - if the operation failspublic void unsubscribe(java.lang.String name)
throws javax.jms.JMSException
For a real-time connection to WebSphere MQ Event Broker, WebSphere Business Integration Event Broker, or WebSphere Business Integration Message Broker, this method throws a JMSException.
unsubscribe in interface javax.jms.Sessionname - the name used to identify this subscriptionjavax.jms.JMSException - if the session fails to unsubscribe to the durable subscription due to an
internal error.public void deliver(java.util.List messageReferences)
throws javax.jms.JMSException
messageReferences - javax.jms.JMSExceptionpublic javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
java.lang.String name)
throws javax.jms.InvalidDestinationException,
javax.jms.IllegalStateException,
javax.jms.JMSException
createDurableConsumer in interface javax.jms.Sessionjavax.jms.InvalidDestinationExceptionjavax.jms.IllegalStateExceptionjavax.jms.JMSExceptionpublic javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal)
throws javax.jms.InvalidDestinationException,
javax.jms.InvalidSelectorException,
javax.jms.IllegalStateException,
javax.jms.JMSException
createDurableConsumer in interface javax.jms.Sessionjavax.jms.InvalidDestinationExceptionjavax.jms.InvalidSelectorExceptionjavax.jms.IllegalStateExceptionjavax.jms.JMSExceptionpublic javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName)
throws javax.jms.JMSException,
javax.jms.InvalidDestinationException,
javax.jms.InvalidSelectorException
createSharedConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionjavax.jms.InvalidDestinationExceptionjavax.jms.InvalidSelectorExceptionpublic javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName,
java.lang.String messageSelector)
throws javax.jms.JMSException,
javax.jms.InvalidDestinationException,
javax.jms.InvalidSelectorException
createSharedConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionjavax.jms.InvalidDestinationExceptionjavax.jms.InvalidSelectorExceptionpublic javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName)
throws javax.jms.JMSException,
javax.jms.InvalidDestinationException
createSharedDurableConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionjavax.jms.InvalidDestinationExceptionpublic javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
java.lang.String sharedSubscriptionName,
java.lang.String messageSelector)
throws javax.jms.InvalidDestinationException,
javax.jms.IllegalStateException,
javax.jms.JMSException
createSharedDurableConsumer in interface javax.jms.Sessionjavax.jms.InvalidDestinationExceptionjavax.jms.IllegalStateExceptionjavax.jms.JMSException