blob: 41c3602dd8e24827a00fb50ac48a87d9698c0432 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>Session</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Session";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6,"i29":6,"i30":6,"i31":6,"i32":6,"i33":6,"i34":6,"i35":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../jakarta/jms/ServerSessionPool.html" title="interface in jakarta.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/jms/StreamMessage.html" title="interface in jakarta.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/jms/Session.html" target="_top">Frames</a></li>
<li><a href="Session.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.jms</div>
<h2 title="Interface Session" class="title">Interface Session</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd>java.lang.AutoCloseable, java.lang.Runnable</dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../jakarta/jms/QueueSession.html" title="interface in jakarta.jms">QueueSession</a>, <a href="../../jakarta/jms/TopicSession.html" title="interface in jakarta.jms">TopicSession</a>, <a href="../../jakarta/jms/XAQueueSession.html" title="interface in jakarta.jms">XAQueueSession</a>, <a href="../../jakarta/jms/XASession.html" title="interface in jakarta.jms">XASession</a>, <a href="../../jakarta/jms/XATopicSession.html" title="interface in jakarta.jms">XATopicSession</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">Session</span>
extends java.lang.Runnable, java.lang.AutoCloseable</pre>
<div class="block">A <code>Session</code> object is a single-threaded context for producing and consuming messages. Although it may allocate
provider resources outside the Java virtual machine (JVM), it is considered a lightweight Jakarta Messaging object.
<p>
A session serves several purposes:
<ul>
<li>It is a factory for its message producers and consumers.
<li>It supplies provider-optimized message factories.
<li>It is a factory for <code>TemporaryTopics</code> and <code>TemporaryQueues</code>.
<li>It provides a way to create <code>Queue</code> or <code>Topic</code> objects for those clients that need to dynamically
manipulate provider-specific destination names.
<li>It supports a single series of transactions that combine work spanning its producers and consumers into atomic
units.
<li>It defines a serial order for the messages it consumes and the messages it produces.
<li>It retains messages it consumes until they have been acknowledged.
<li>It serializes execution of message listeners registered with its message consumers.
<li>It is a factory for <code>QueueBrowsers</code>.
</ul>
<p>
A session can create and service multiple message producers and consumers.
<p>
One typical use is to have a thread block on a synchronous <code>MessageConsumer</code> until a message arrives. The
thread may then use one or more of the <code>Session</code>'s <code>MessageProducer</code>s.
<p>
If a client desires to have one thread produce messages while others consume them, the client should use a separate
session for its producing thread.
<p>
Once a connection has been started, any session with one or more registered message listeners is dedicated to the
thread of control that delivers messages to it. It is erroneous for client code to use this session or any of its
constituent objects from another thread of control. The only exception to this rule is the use of the session or
message consumer <code>close</code> method.
<p>
It should be easy for most clients to partition their work naturally into sessions. This model allows clients to
start simply and incrementally add message processing complexity as their need for concurrency grows.
<p>
The <code>close</code> method is the only session method that can be called while some other session method is being
executed in another thread.
<p>
A session may be specified as transacted. Each transacted session supports a single series of transactions. Each
transaction groups a set of message sends and a set of message receives into an atomic unit of work. In effect,
transactions organize a session's input message stream and output message stream into series of atomic units. When a
transaction commits, its atomic unit of input is acknowledged and its associated atomic unit of output is sent. If a
transaction rollback is done, the transaction's sent messages are destroyed and the session's input is automatically
recovered.
<p>
The content of a transaction's input and output units is simply those messages that have been produced and consumed
within the session's current transaction.
<p>
A transaction is completed using either its session's <code>commit</code> method or its session's <code>rollback</code> method.
The completion of a session's current transaction automatically begins the next. The result is that a transacted
session always has a current transaction within which its work is done.
<p>
The Java Transaction Service (JTS) or some other transaction monitor may be used to combine a session's transaction
with transactions on other resources (databases, other Jakarta Messaging sessions, etc.). Since Java distributed transactions are
controlled via the Java Transaction API (JTA), use of the session's <code>commit</code> and <code>rollback</code> methods in
this context is prohibited.
<p>
The Jakarta Messaging API does not require support for JTA; however, it does define how a provider supplies this support.
<p>
Although it is also possible for a Jakarta Messaging client to handle distributed transactions directly, it is unlikely that many
Jakarta Messaging clients will do this. Support for JTA in the Jakarta Messaging API is targeted at systems vendors who will be integrating the
Jakarta Messaging API into their application server products.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/QueueSession.html" title="interface in jakarta.jms"><code>QueueSession</code></a>,
<a href="../../jakarta/jms/TopicSession.html" title="interface in jakarta.jms"><code>TopicSession</code></a>,
<a href="../../jakarta/jms/XASession.html" title="interface in jakarta.jms"><code>XASession</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#AUTO_ACKNOWLEDGE">AUTO_ACKNOWLEDGE</a></span></code>
<div class="block">With this acknowledgment mode, the session automatically acknowledges a client's receipt of a message either when the
session has successfully returned from a call to <code>receive</code> or when the message listener the session has called
to process the message successfully returns.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#CLIENT_ACKNOWLEDGE">CLIENT_ACKNOWLEDGE</a></span></code>
<div class="block">With this acknowledgment mode, the client acknowledges a consumed message by calling the message's
<code>acknowledge</code> method.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#DUPS_OK_ACKNOWLEDGE">DUPS_OK_ACKNOWLEDGE</a></span></code>
<div class="block">This acknowledgment mode instructs the session to lazily acknowledge the delivery of messages.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#SESSION_TRANSACTED">SESSION_TRANSACTED</a></span></code>
<div class="block">This value may be passed as the argument to the method <code>createSession(int sessionMode)</code> on the
<code>Connection</code> object to specify that the session should use a local transaction.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#close--">close</a></span>()</code>
<div class="block">Closes the session.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#commit--">commit</a></span>()</code>
<div class="block">Commits all messages done in this transaction and releases any locks currently held.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/QueueBrowser.html" title="interface in jakarta.jms">QueueBrowser</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createBrowser-jakarta.jms.Queue-">createBrowser</a></span>(<a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a>&nbsp;queue)</code>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/QueueBrowser.html" title="interface in jakarta.jms">QueueBrowser</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createBrowser-jakarta.jms.Queue-java.lang.String-">createBrowser</a></span>(<a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a>&nbsp;queue,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue using a message selector.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/BytesMessage.html" title="interface in jakarta.jms">BytesMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createBytesMessage--">createBytesMessage</a></span>()</code>
<div class="block">Creates a <code>BytesMessage</code> object.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createConsumer-jakarta.jms.Destination-">createConsumer</a></span>(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination)</code>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createConsumer-jakarta.jms.Destination-java.lang.String-">createConsumer</a></span>(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination, using a message selector.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createConsumer-jakarta.jms.Destination-java.lang.String-boolean-">createConsumer</a></span>(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination, specifying a message selector and the
<code>noLocal</code> parameter.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createDurableConsumer-jakarta.jms.Topic-java.lang.String-">createDurableConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createDurableConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TopicSubscriber.html" title="interface in jakarta.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createDurableSubscriber-jakarta.jms.Topic-java.lang.String-">createDurableSubscriber</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TopicSubscriber.html" title="interface in jakarta.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createDurableSubscriber-jakarta.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableSubscriber</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MapMessage.html" title="interface in jakarta.jms">MapMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createMapMessage--">createMapMessage</a></span>()</code>
<div class="block">Creates a <code>MapMessage</code> object.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/Message.html" title="interface in jakarta.jms">Message</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createMessage--">createMessage</a></span>()</code>
<div class="block">Creates a <code>Message</code> object.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/ObjectMessage.html" title="interface in jakarta.jms">ObjectMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createObjectMessage--">createObjectMessage</a></span>()</code>
<div class="block">Creates an <code>ObjectMessage</code> object.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/ObjectMessage.html" title="interface in jakarta.jms">ObjectMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createObjectMessage-java.io.Serializable-">createObjectMessage</a></span>(java.io.Serializable&nbsp;object)</code>
<div class="block">Creates an initialized <code>ObjectMessage</code> object.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageProducer.html" title="interface in jakarta.jms">MessageProducer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createProducer-jakarta.jms.Destination-">createProducer</a></span>(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination)</code>
<div class="block">Creates a <code>MessageProducer</code> to send messages to the specified destination.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createQueue-java.lang.String-">createQueue</a></span>(java.lang.String&nbsp;queueName)</code>
<div class="block">Creates a <code>Queue</code> object which encapsulates a specified provider-specific queue name.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createSharedConsumer-jakarta.jms.Topic-java.lang.String-">createSharedConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName)</code>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) and creates a consumer on that subscription.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createSharedConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-">createSharedConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) specifying a message selector, and creates a consumer on that subscription.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createSharedDurableConsumer-jakarta.jms.Topic-java.lang.String-">createSharedDurableConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</code>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createSharedDurableConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-">createSharedDurableConsumer</a></span>(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/StreamMessage.html" title="interface in jakarta.jms">StreamMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createStreamMessage--">createStreamMessage</a></span>()</code>
<div class="block">Creates a <code>StreamMessage</code> object.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TemporaryQueue.html" title="interface in jakarta.jms">TemporaryQueue</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createTemporaryQueue--">createTemporaryQueue</a></span>()</code>
<div class="block">Creates a <code>TemporaryQueue</code> object.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TemporaryTopic.html" title="interface in jakarta.jms">TemporaryTopic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createTemporaryTopic--">createTemporaryTopic</a></span>()</code>
<div class="block">Creates a <code>TemporaryTopic</code> object.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TextMessage.html" title="interface in jakarta.jms">TextMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createTextMessage--">createTextMessage</a></span>()</code>
<div class="block">Creates a <code>TextMessage</code> object.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/jms/TextMessage.html" title="interface in jakarta.jms">TextMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createTextMessage-java.lang.String-">createTextMessage</a></span>(java.lang.String&nbsp;text)</code>
<div class="block">Creates an initialized <code>TextMessage</code> object.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#createTopic-java.lang.String-">createTopic</a></span>(java.lang.String&nbsp;topicName)</code>
<div class="block">Creates a <code>Topic</code> object which encapsulates a specified provider-specific topic name.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#getAcknowledgeMode--">getAcknowledgeMode</a></span>()</code>
<div class="block">Returns the acknowledgement mode of the session.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/jms/MessageListener.html" title="interface in jakarta.jms">MessageListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#getMessageListener--">getMessageListener</a></span>()</code>
<div class="block">Returns the session's distinguished message listener (optional).</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#getTransacted--">getTransacted</a></span>()</code>
<div class="block">Indicates whether the session is in transacted mode.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#recover--">recover</a></span>()</code>
<div class="block">Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#rollback--">rollback</a></span>()</code>
<div class="block">Rolls back any messages done in this transaction and releases any locks currently held.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#run--">run</a></span>()</code>
<div class="block">Optional operation, intended to be used only by Application Servers, not by ordinary Jakarta Messaging clients.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#setMessageListener-jakarta.jms.MessageListener-">setMessageListener</a></span>(<a href="../../jakarta/jms/MessageListener.html" title="interface in jakarta.jms">MessageListener</a>&nbsp;listener)</code>
<div class="block">Sets the session's distinguished message listener (optional).</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/jms/Session.html#unsubscribe-java.lang.String-">unsubscribe</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Unsubscribes a durable subscription that has been created by a client.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="AUTO_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AUTO_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int AUTO_ACKNOWLEDGE</pre>
<div class="block">With this acknowledgment mode, the session automatically acknowledges a client's receipt of a message either when the
session has successfully returned from a call to <code>receive</code> or when the message listener the session has called
to process the message successfully returns.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.jms.Session.AUTO_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="CLIENT_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CLIENT_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int CLIENT_ACKNOWLEDGE</pre>
<div class="block">With this acknowledgment mode, the client acknowledges a consumed message by calling the message's
<code>acknowledge</code> method. Acknowledging a consumed message acknowledges all messages that the session has consumed.
<p>
When client acknowledgment mode is used, a client may build up a large number of unacknowledged messages while
attempting to process them. A Jakarta Messaging provider should provide administrators with a way to limit client overrun so that
clients are not driven to resource exhaustion and ensuing failure when some resource they are using is temporarily
blocked.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/Message.html#acknowledge--"><code>Message.acknowledge()</code></a>,
<a href="../../constant-values.html#jakarta.jms.Session.CLIENT_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DUPS_OK_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DUPS_OK_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int DUPS_OK_ACKNOWLEDGE</pre>
<div class="block">This acknowledgment mode instructs the session to lazily acknowledge the delivery of messages. This is likely to
result in the delivery of some duplicate messages if the Jakarta Messaging provider fails, so it should only be used by consumers
that can tolerate duplicate messages. Use of this mode can reduce session overhead by minimizing the work the session
does to prevent duplicates.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.jms.Session.DUPS_OK_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SESSION_TRANSACTED">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SESSION_TRANSACTED</h4>
<pre>static final&nbsp;int SESSION_TRANSACTED</pre>
<div class="block">This value may be passed as the argument to the method <code>createSession(int sessionMode)</code> on the
<code>Connection</code> object to specify that the session should use a local transaction.
<p>
This value is returned from the method <code>getAcknowledgeMode</code> if the session is using a local transaction,
irrespective of whether the session was created by calling the method <code>createSession(int sessionMode)</code> or the
method <code>createSession(boolean transacted, int acknowledgeMode)</code>.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.jms.Session.SESSION_TRANSACTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="createBytesMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBytesMessage</h4>
<pre><a href="../../jakarta/jms/BytesMessage.html" title="interface in jakarta.jms">BytesMessage</a>&nbsp;createBytesMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>BytesMessage</code> object. A <code>BytesMessage</code> object is used to send a message containing a stream of
uninterpreted bytes.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>BytesMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createMapMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createMapMessage</h4>
<pre><a href="../../jakarta/jms/MapMessage.html" title="interface in jakarta.jms">MapMessage</a>&nbsp;createMapMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>MapMessage</code> object. A <code>MapMessage</code> object is used to send a self-defining set of name-value
pairs, where names are <code>String</code> objects and values are primitive values in the Java programming language.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>MapMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createMessage</h4>
<pre><a href="../../jakarta/jms/Message.html" title="interface in jakarta.jms">Message</a>&nbsp;createMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>Message</code> object. The <code>Message</code> interface is the root interface of all Jakarta Messaging messages. A
<code>Message</code> object holds all the standard message header information. It can be sent when a message containing
only header information is sufficient.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>Message</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createObjectMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createObjectMessage</h4>
<pre><a href="../../jakarta/jms/ObjectMessage.html" title="interface in jakarta.jms">ObjectMessage</a>&nbsp;createObjectMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an <code>ObjectMessage</code> object. An <code>ObjectMessage</code> object is used to send a message that contains a
serializable Java object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>ObjectMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createObjectMessage-java.io.Serializable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createObjectMessage</h4>
<pre><a href="../../jakarta/jms/ObjectMessage.html" title="interface in jakarta.jms">ObjectMessage</a>&nbsp;createObjectMessage(java.io.Serializable&nbsp;object)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an initialized <code>ObjectMessage</code> object. An <code>ObjectMessage</code> object is used to send a message that
contains a serializable Java object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>object</code> - the object to use to initialize this message</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>ObjectMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createStreamMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createStreamMessage</h4>
<pre><a href="../../jakarta/jms/StreamMessage.html" title="interface in jakarta.jms">StreamMessage</a>&nbsp;createStreamMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>StreamMessage</code> object. A <code>StreamMessage</code> object is used to send a self-defining stream of
primitive values in the Java programming language.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>StreamMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createTextMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTextMessage</h4>
<pre><a href="../../jakarta/jms/TextMessage.html" title="interface in jakarta.jms">TextMessage</a>&nbsp;createTextMessage()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>TextMessage</code> object. A <code>TextMessage</code> object is used to send a message containing a
<code>String</code> object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>TextMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createTextMessage-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTextMessage</h4>
<pre><a href="../../jakarta/jms/TextMessage.html" title="interface in jakarta.jms">TextMessage</a>&nbsp;createTextMessage(java.lang.String&nbsp;text)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an initialized <code>TextMessage</code> object. A <code>TextMessage</code> object is used to send a message containing
a <code>String</code>.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the Jakarta Messaging provider used to create it. However it can be sent
using any Jakarta Messaging provider, not just the Jakarta Messaging provider used to create it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>text</code> - the string used to initialize this message</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>TextMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="getTransacted--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransacted</h4>
<pre>boolean&nbsp;getTransacted()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Indicates whether the session is in transacted mode.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the session is in transacted mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to return the transaction mode due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="getAcknowledgeMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAcknowledgeMode</h4>
<pre>int&nbsp;getAcknowledgeMode()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Returns 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.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>If the session is not transacted, returns the current acknowledgement mode for the session. If the session is
transacted, returns SESSION_TRANSACTED.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to return the acknowledgment mode due to some internal error.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/Connection.html#createSession-boolean-int-"><code>Connection.createSession(boolean, int)</code></a></dd>
</dl>
</li>
</ul>
<a name="commit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>commit</h4>
<pre>void&nbsp;commit()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Commits all messages done in this transaction and releases any locks currently held.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>Session</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>commit</tt> on its own <tt>Session</tt>. Doing so
will cause an <tt>IllegalStateException</tt> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - <ul>
<li>the session is not using a local transaction
<li>this method has been called by a <tt>CompletionListener</tt> callback method on its own <tt>Session</tt></li>
</ul></dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to commit the transaction due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/TransactionRolledBackException.html" title="class in jakarta.jms">TransactionRolledBackException</a></code> - if the transaction is rolled back due to some internal error during commit.</dd>
</dl>
</li>
</ul>
<a name="rollback--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rollback</h4>
<pre>void&nbsp;rollback()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Rolls back any messages done in this transaction and releases any locks currently held.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>Session</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>commit</tt> on its own <tt>Session</tt>. Doing so
will cause an <tt>IllegalStateException</tt> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - <ul>
<li>the session is not using a local transaction
<li>this method has been called by a <tt>CompletionListener</tt> callback method on its own <tt>Session</tt></li>
</ul></dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to roll back the transaction due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>void&nbsp;close()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Closes the session.
<p>
Since a provider may allocate some resources on behalf of a session outside the JVM, clients should close the
resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be
timely enough.
<p>
There is no need to close the producers and consumers of a closed session.
<p>
This call will block until a <code>receive</code> call or message listener in progress has completed. A blocked message
consumer <code>receive</code> call returns <code>null</code> when this session is closed.
<p>
However if the close method is called from a message listener on its own <code>Session</code>, then it will either fail
and throw a <code>jakarta.jms.IllegalStateException</code>, or it will succeed and close the <code>Session</code>, blocking until
any pending receive call in progress has completed. If close succeeds and the acknowledge mode of the <code>Session</code>
is set to <code>AUTO_ACKNOWLEDGE</code>, the current message will still be acknowledged automatically when the
<code>onMessage</code> call completes.
<p>
Since two alternative behaviors are permitted in this case, applications should avoid calling close from a message
listener on its own <code>Session</code> because this is not portable.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>Session</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
For the avoidance of doubt, if an exception listener for this session's connection is running when <code>close</code> is
invoked, there is no requirement for the <code>close</code> call to wait until the exception listener has returned before
it may return.
<p>
Closing a transacted session must roll back the transaction in progress.
<p>
This method is the only <code>Session</code> method that can be called concurrently.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>close</tt> on its own <tt>Session</tt>. Doing so will
cause an <tt>IllegalStateException</tt> to be thrown.
<p>
Invoking any other <code>Session</code> method on a closed session must throw a <code>IllegalStateException</code>. Closing a
closed session must <I>not</I> throw an exception.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - <ul>
<li>this method has been called by a <tt>MessageListener
</tt> on its own <tt>Session</tt></li>
<li>this method has been called by a <tt>CompletionListener</tt> callback method on its own <tt>Session</tt></li>
</ul></dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to close the session due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="recover--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>recover</h4>
<pre>void&nbsp;recover()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.
<p>
All consumers deliver messages in a serial order. Acknowledging a received message automatically acknowledges all
messages that have been delivered to the client.
<p>
Restarting a session causes it to take the following actions:
<ul>
<li>Stop message delivery
<li>Mark all messages that might have been delivered but not acknowledged as "redelivered"
<li>Restart the delivery sequence including all unacknowledged messages that had been previously delivered.
Redelivered messages do not have to be delivered in exactly their original delivery order.
</ul></div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to stop and restart message delivery due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - if the method is called by a transacted session.</dd>
</dl>
</li>
</ul>
<a name="getMessageListener--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMessageListener</h4>
<pre><a href="../../jakarta/jms/MessageListener.html" title="interface in jakarta.jms">MessageListener</a>&nbsp;getMessageListener()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Returns the session's distinguished message listener (optional).
<p>
This method must not be used in a Jakarta EE web or EJB application. Doing so may cause a <code>JMSException</code> to be
thrown though this is not guaranteed.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the distinguished message listener associated with this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to get the session's distinguished message listener for one of the
following reasons:
<ul>
<li>an internal error has occurred
<li>this method has been called in a Jakarta EE web or EJB application (though it is not guaranteed that an exception is
thrown in this case)
</ul></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/Session.html#setMessageListener-jakarta.jms.MessageListener-"><code>setMessageListener(jakarta.jms.MessageListener)</code></a>,
<a href="../../jakarta/jms/ServerSessionPool.html" title="interface in jakarta.jms"><code>ServerSessionPool</code></a>,
<a href="../../jakarta/jms/ServerSession.html" title="interface in jakarta.jms"><code>ServerSession</code></a></dd>
</dl>
</li>
</ul>
<a name="setMessageListener-jakarta.jms.MessageListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMessageListener</h4>
<pre>void&nbsp;setMessageListener(<a href="../../jakarta/jms/MessageListener.html" title="interface in jakarta.jms">MessageListener</a>&nbsp;listener)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Sets the session's distinguished message listener (optional).
<p>
When the distinguished message listener is set, no other form of message receipt in the session can be used; however,
all forms of sending messages are still supported.
<p>
This is an expert facility not used by ordinary Jakarta Messaging clients.
<p>
This method must not be used in a Jakarta EE web or EJB application. Doing so may cause a <code>JMSException</code> to be
thrown though this is not guaranteed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - the message listener to associate with this session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the Jakarta Messaging provider fails to set the session's distinguished message listener for one of the
following reasons:
<ul>
<li>an internal error has occurred
<li>this method has been called in a Jakarta EE web or EJB application (though it is not guaranteed that an exception is
thrown in this case)
</ul></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/Session.html#getMessageListener--"><code>getMessageListener()</code></a>,
<a href="../../jakarta/jms/ServerSessionPool.html" title="interface in jakarta.jms"><code>ServerSessionPool</code></a>,
<a href="../../jakarta/jms/ServerSession.html" title="interface in jakarta.jms"><code>ServerSession</code></a></dd>
</dl>
</li>
</ul>
<a name="run--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>run</h4>
<pre>void&nbsp;run()</pre>
<div class="block">Optional operation, intended to be used only by Application Servers, not by ordinary Jakarta Messaging clients.
<p>
This method must not be used in a Jakarta EE web or EJB application. Doing so may cause a <code>JMSRuntimeException</code> to
be thrown though this is not guaranteed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>run</code>&nbsp;in interface&nbsp;<code>java.lang.Runnable</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSRuntimeException.html" title="class in jakarta.jms">JMSRuntimeException</a></code> - if this method has been called in a Jakarta EE web or EJB application (though it is not
guaranteed that an exception is thrown in this case)</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/jms/ServerSession.html" title="interface in jakarta.jms"><code>ServerSession</code></a></dd>
</dl>
</li>
</ul>
<a name="createProducer-jakarta.jms.Destination-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createProducer</h4>
<pre><a href="../../jakarta/jms/MessageProducer.html" title="interface in jakarta.jms">MessageProducer</a>&nbsp;createProducer(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>MessageProducer</code> to send messages to the specified destination.
<p>
A client uses a <code>MessageProducer</code> object to send messages to a destination. Since <code>Queue</code> and
<code>Topic</code> both inherit from <code>Destination</code>, they can be used in the destination parameter to create a
<code>MessageProducer</code> object.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to send to, or null if this is a producer which does not have a specified
destination.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>MessageProducer</code> to send messages.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a MessageProducer due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createConsumer-jakarta.jms.Destination-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createConsumer(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination. Since <code>Queue</code> and <code>Topic</code> both inherit
from <code>Destination</code>, they can be used in the destination parameter to create a <code>MessageConsumer</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>MessageConsumer</code> for the specified destination.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a consumer due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createConsumer-jakarta.jms.Destination-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createConsumer(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination, using a message selector. Since <code>Queue</code> and
<code>Topic</code> both inherit from <code>Destination</code>, they can be used in the destination parameter to create a
<code>MessageConsumer</code>.
<p>
A client uses a <code>MessageConsumer</code> object to receive messages that have been sent to a destination.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access</dd>
<dd><code>messageSelector</code> - 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.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>MessageConsumer</code> for the specified destination.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a MessageConsumer due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createConsumer-jakarta.jms.Destination-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createConsumer(<a href="../../jakarta/jms/Destination.html" title="interface in jakarta.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>MessageConsumer</code> for the specified destination, specifying a message selector and the
<code>noLocal</code> parameter.
<p>
Since <code>Queue</code> and <code>Topic</code> both inherit from <code>Destination</code>, they can be used in the destination
parameter to create a <code>MessageConsumer</code>.
<p>
A client uses a <code>MessageConsumer</code> object to receive messages that have been published to a destination.
<p>
The <code>noLocal</code> argument is for use when the destination is a topic and the session's connection is also being
used to publish messages to that topic. If <code>noLocal</code> is set to true then the <code>MessageConsumer</code> will not
receive messages published to the topic by its own connection. The default value of this argument is false. If the
destination is a queue then the effect of setting <code>noLocal</code> to true is not specified.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access</dd>
<dd><code>messageSelector</code> - 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.</dd>
<dd><code>noLocal</code> - - if true, and the destination is a topic, then the <code>MessageConsumer</code> will not receive messages
published to the topic by its own connection.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>MessageConsumer</code> for the specified destination.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a MessageConsumer due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createSharedConsumer-jakarta.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createSharedConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) and creates a consumer on that subscription. This method creates the non-durable subscription without a
message selector.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set), and the same
topic and message selector value has been specified, then this method creates a <code>MessageConsumer</code> on the
existing subscription.
<p>
A non-durable shared subscription is used by a client which needs to be able to share the work of receiving messages
from a topic subscription amongst multiple consumers. A non-durable shared subscription may therefore have more than
one consumer. Each message from the subscription will be delivered to only one of the consumers on that subscription.
Such a subscription is not persisted and will be deleted (together with any undelivered messages associated with it)
when there are no consumers on it. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code>
object in any client.
<p>
A shared non-durable subscription is identified by a name specified by the client and by the client identifier (which
may be unset). An application which subsequently wishes to create a consumer on that shared non-durable subscription
must use the same client identifier.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the
subscription, then a <code>JMSException</code> will be thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</dd>
<dd><code>sharedSubscriptionName</code> - the name used to identify the shared non-durable subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A shared non-durable subscription with the specified name on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create the shared non-durable subscription and <code>MessageConsumer</code>
due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createSharedConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName,
java.lang.String&nbsp;messageSelector)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) specifying a message selector, and creates a consumer on that subscription.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set), and the same
topic and message selector has been specified, then this method creates a <code>MessageConsumer</code> on the existing
subscription.
<p>
A non-durable shared subscription is used by a client which needs to be able to share the work of receiving messages
from a topic subscription amongst multiple consumers. A non-durable shared subscription may therefore have more than
one consumer. Each message from the subscription will be delivered to only one of the consumers on that subscription.
Such a subscription is not persisted and will be deleted (together with any undelivered messages associated with it)
when there are no consumers on it. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code>
object in any client.
<p>
A shared non-durable subscription is identified by a name specified by the client and by the client identifier (which
may be unset). An application which subsequently wishes to create a consumer on that shared non-durable subscription
must use the same client identifier.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the
subscription, then a <code>JMSException</code> will be thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</dd>
<dd><code>sharedSubscriptionName</code> - the name used to identify the shared non-durable subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the shared
non-durable subscription. A value of null or an empty string indicates that there is no message selector for the
shared non-durable subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A shared non-durable subscription with the specified name on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create the shared non-durable subscription and <code>MessageConsumer</code>
due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createQueue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQueue</h4>
<pre><a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a>&nbsp;createQueue(java.lang.String&nbsp;queueName)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>Queue</code> object which encapsulates a specified provider-specific queue name.
<p>
The use of provider-specific queue names in an application may render the application non-portable. Portable
applications are recommended to not use this method but instead look up an administratively-defined <code>Queue</code>
object using JNDI.
<p>
Note that this method simply creates an object that encapsulates the name of a queue. It does not create the physical
queue in the Jakarta Messaging provider. Jakarta Messaging does not provide a method to create the physical queue, since this would be specific
to a given Jakarta Messaging provider. Creating a physical queue is provider-specific and is typically an administrative task
performed by an administrator, though some providers may create them automatically when needed. The one exception to
this is the creation of a temporary queue, which is done using the <code>createTemporaryQueue</code> method.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queueName</code> - A provider-specific queue name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Queue object which encapsulates the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if a Queue object cannot be created due to some internal error</dd>
</dl>
</li>
</ul>
<a name="createTopic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTopic</h4>
<pre><a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;createTopic(java.lang.String&nbsp;topicName)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>Topic</code> object which encapsulates a specified provider-specific topic name.
<p>
The use of provider-specific topic names in an application may render the application non-portable. Portable
applications are recommended to not use this method but instead look up an administratively-defined <code>Topic</code>
object using JNDI.
<p>
Note that this method simply creates an object that encapsulates the name of a topic. It does not create the physical
topic in the Jakarta Messaging provider. Jakarta Messaging does not provide a method to create the physical topic, since this would be specific
to a given Jakarta Messaging provider. Creating a physical topic is provider-specific and is typically an administrative task
performed by an administrator, though some providers may create them automatically when needed. The one exception to
this is the creation of a temporary topic, which is done using the <code>createTemporaryTopic</code> method.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topicName</code> - A provider-specific topic name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Topic object which encapsulates the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if a Topic object cannot be created due to some internal error</dd>
</dl>
</li>
</ul>
<a name="createDurableSubscriber-jakarta.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableSubscriber</h4>
<pre><a href="../../jakarta/jms/TopicSubscriber.html" title="interface in jakarta.jms">TopicSubscriber</a>&nbsp;createDurableSubscriber(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription. This method creates the durable subscription without a message selector and
with a <code>noLocal</code> value of <code>false</code>.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>TopicSubscriber</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a <code>JMSException</code>
is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.
<p>
This method is identical to the corresponding <code>createDurableConsumer</code> method except that it returns a
<code>TopicSubscriber</code> rather than a <code>MessageConsumer</code> to represent the consumer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An unshared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the unshared durable subscription and <code>TopicSubscriber</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createDurableSubscriber-jakarta.jms.Topic-java.lang.String-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableSubscriber</h4>
<pre><a href="../../jakarta/jms/TopicSubscriber.html" title="interface in jakarta.jms">TopicSubscriber</a>&nbsp;createDurableSubscriber(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>TopicSubscriber</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
If <code>noLocal</code> is set to true then any messages published to the topic using this session's connection, or any
other connection with the same client identifier, will not be added to the durable subscription.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a <code>JMSException</code>
is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.
<p>
This method is identical to the corresponding <code>createDurableConsumer</code> method except that it returns a
<code>TopicSubscriber</code> rather than a <code>MessageConsumer</code> to represent the consumer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the
durable subscription. A value of null or an empty string indicates that there is no message selector for the durable
subscription.</dd>
<dd><code>noLocal</code> - if true then any messages published to the topic using this session's connection, or any other
connection with the same client identifier, will not be added to the durable subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An unshared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the unshared durable subscription and <code>TopicSubscriber</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createDurableConsumer-jakarta.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createDurableConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription. This method creates the durable subscription without a message selector and
with a <code>noLocal</code> value of <code>false</code>.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>MessageConsumer</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a <code>JMSException</code>
is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.
<p>
This method is identical to the corresponding <code>createDurableSubscriber</code> method except that it returns a
<code>MessageConsumer</code> rather than a <code>TopicSubscriber</code> to represent the consumer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An unshared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the unshared durable subscription and <code>MessageConsumer</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createDurableConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createDurableConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>MessageConsumer</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
If <code>noLocal</code> is set to true then any messages published to the topic using this session's connection, or any
other connection with the same client identifier, will not be added to the durable subscription.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a <code>JMSException</code>
is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.
<p>
This method is identical to the corresponding <code>createDurableSubscriber</code> method except that it returns a
<code>MessageConsumer</code> rather than a <code>TopicSubscriber</code> to represent the consumer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the
durable subscription. A value of null or an empty string indicates that there is no message selector for the durable
subscription.</dd>
<dd><code>noLocal</code> - if true then any messages published to the topic using this session's connection, or any other
connection with the same client identifier, will not be added to the durable subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An unshared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dd><code><a href="../../jakarta/jms/IllegalStateException.html" title="class in jakarta.jms">IllegalStateException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the unshared durable subscription and <code>MessageConsumer</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedDurableConsumer-jakarta.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedDurableConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createSharedDurableConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription. This method creates
the durable subscription without a message selector.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with shared durable subscriptions. Any durable subscription created using this method
will be shared. This means that multiple active (i.e. not closed) consumers on the subscription may exist at the same
time. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code> object in any client.
<p>
A shared durable subscription is identified by a name specified by the client and by the client identifier (which may
be unset). An application which subsequently wishes to create a consumer on that shared durable subscription must use
the same client identifier.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set), and the same topic
and message selector has been specified, then this method creates a <code>MessageConsumer</code> on the existing shared
durable subscription.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is no consumer already active (i.e. not closed) on the
durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a new one.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the durable
subscription, then a <code>JMSException</code> will be thrown.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier
(if set). If an unshared durable subscription already exists with the same name and client identifier (if set) then a
<code>JMSException</code> is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A shared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the shared durable subscription and <code>MessageConsumer</code> due to some internal
error
<li>if a shared durable subscription already exists with the same name and client identifier, but a different topic
or message selector, and there is a consumer already active
<li>if an unshared durable subscription already exists with the same name and client identifier
</ul></dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedDurableConsumer-jakarta.jms.Topic-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedDurableConsumer</h4>
<pre><a href="../../jakarta/jms/MessageConsumer.html" title="interface in jakarta.jms">MessageConsumer</a>&nbsp;createSharedDurableConsumer(<a href="../../jakarta/jms/Topic.html" title="interface in jakarta.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The Jakarta Messaging provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with shared durable subscriptions. Any durable subscription created using this method
will be shared. This means that multiple active (i.e. not closed) consumers on the subscription may exist at the same
time. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code> object in any client.
<p>
A shared durable subscription is identified by a name specified by the client and by the client identifier (which may
be unset). An application which subsequently wishes to create a consumer on that shared durable subscription must use
the same client identifier.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set), and the same topic
and message selector has been specified, then this method creates a <code>MessageConsumer</code> on the existing shared
durable subscription.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is no consumer already active (i.e. not closed) on the
durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a new one.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the durable
subscription, then a <code>JMSException</code> will be thrown.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier
(if set). If an unshared durable subscription already exists with the same name and client identifier (if set) then a
<code>JMSException</code> is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the
durable subscription. A value of null or an empty string indicates that there is no message selector for the durable
subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A shared durable subscription on the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the shared durable subscription and <code>MessageConsumer</code> due to some internal
error
<li>if a shared durable subscription already exists with the same name and client identifier, but a different topic
or message selector, and there is a consumer already active
<li>if an unshared durable subscription already exists with the same name and client identifier
</ul></dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createBrowser-jakarta.jms.Queue-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBrowser</h4>
<pre><a href="../../jakarta/jms/QueueBrowser.html" title="interface in jakarta.jms">QueueBrowser</a>&nbsp;createBrowser(<a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a>&nbsp;queue)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queue</code> - the <code>queue</code> to access</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>QueueBrowser</code> object to peek at the messages on the specified queue.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a browser due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createBrowser-jakarta.jms.Queue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBrowser</h4>
<pre><a href="../../jakarta/jms/QueueBrowser.html" title="interface in jakarta.jms">QueueBrowser</a>&nbsp;createBrowser(<a href="../../jakarta/jms/Queue.html" title="interface in jakarta.jms">Queue</a>&nbsp;queue,
java.lang.String&nbsp;messageSelector)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue using a message selector.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queue</code> - the <code>queue</code> to access</dd>
<dd><code>messageSelector</code> - 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.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A <code>QueueBrowser</code> object to peek at the messages on the specified queue.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a browser due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid destination is specified</dd>
<dd><code><a href="../../jakarta/jms/InvalidSelectorException.html" title="class in jakarta.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createTemporaryQueue--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTemporaryQueue</h4>
<pre><a href="../../jakarta/jms/TemporaryQueue.html" title="interface in jakarta.jms">TemporaryQueue</a>&nbsp;createTemporaryQueue()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>TemporaryQueue</code> object. Its lifetime will be that of the <code>Connection</code> unless it is deleted
earlier.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a temporary queue identity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a temporary queue due to some internal error.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="createTemporaryTopic--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTemporaryTopic</h4>
<pre><a href="../../jakarta/jms/TemporaryTopic.html" title="interface in jakarta.jms">TemporaryTopic</a>&nbsp;createTemporaryTopic()
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Creates a <code>TemporaryTopic</code> object. Its lifetime will be that of the <code>Connection</code> unless it is deleted
earlier.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a temporary topic identity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to create a temporary topic due to some internal error.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
<a name="unsubscribe-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>unsubscribe</h4>
<pre>void&nbsp;unsubscribe(java.lang.String&nbsp;name)
throws <a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></pre>
<div class="block">Unsubscribes a durable subscription that has been created by a client.
<p>
This method deletes the state being maintained on behalf of the subscriber by its provider.
<p>
A durable subscription is identified by a name specified by the client and by the client identifier if set. If the
client identifier was set when the durable subscription was created then a client which subsequently wishes to use
this method to delete a durable subscription must use the same client identifier.
<p>
It is erroneous for a client to delete a durable subscription while there is an active (not closed) consumer for the
subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the
session.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/jms/JMSException.html" title="class in jakarta.jms">JMSException</a></code> - if the session fails to unsubscribe to the durable subscription due to some internal error.</dd>
<dd><code><a href="../../jakarta/jms/InvalidDestinationException.html" title="class in jakarta.jms">InvalidDestinationException</a></code> - if an invalid subscription name is specified.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 1.1</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../jakarta/jms/ServerSessionPool.html" title="interface in jakarta.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/jms/StreamMessage.html" title="interface in jakarta.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/jms/Session.html" target="_top">Frames</a></li>
<li><a href="Session.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>