blob: ecc62c46b2730e38ef04ff012c45fa8468dba500 [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>TopicSession</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="TopicSession";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":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="../../javax/jms/TopicRequestor.html" title="class in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/TopicSession.html" target="_top">Frames</a></li>
<li><a href="TopicSession.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>Field&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>Field&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">javax.jms</div>
<h2 title="Interface TopicSession" class="title">Interface TopicSession</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, <a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">TopicSession</span>
extends <a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></pre>
<div class="block">A <code>TopicSession</code> object provides methods for creating <code>TopicPublisher</code>, <code>TopicSubscriber</code>, and
<code>TemporaryTopic</code> objects. It also provides a method for deleting its client's durable subscribers.
<p>
A <code>TopicSession</code> is used for creating Pub/Sub specific objects. In general, use the <code>Session</code> object, and
use <code>TopicSession</code> only to support existing code. Using the <code>Session</code> object simplifies the programming
model, and allows transactions to be used across the two messaging domains.
<p>
A <code>TopicSession</code> cannot be used to create objects specific to the point-to-point domain. The following methods
inherit from <code>Session</code>, but must throw an <code>IllegalStateException</code> if used from <code>TopicSession</code>:
<ul>
<li><code>createBrowser</code>
<li><code>createQueue</code>
<li><code>createTemporaryQueue</code>
</ul></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="../../javax/jms/Session.html" title="interface in javax.jms"><code>Session</code></a>,
<a href="../../javax/jms/Connection.html#createSession-boolean-int-"><code>Connection.createSession(boolean, int)</code></a>,
<a href="../../javax/jms/TopicConnection.html#createTopicSession-boolean-int-"><code>TopicConnection.createTopicSession(boolean, int)</code></a>,
<a href="../../javax/jms/XATopicSession.html#getTopicSession--"><code>XATopicSession.getTopicSession()</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>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.javax.jms.Session">
<!-- -->
</a>
<h3>Fields inherited from interface&nbsp;javax.jms.<a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></h3>
<code><a href="../../javax/jms/Session.html#AUTO_ACKNOWLEDGE">AUTO_ACKNOWLEDGE</a>, <a href="../../javax/jms/Session.html#CLIENT_ACKNOWLEDGE">CLIENT_ACKNOWLEDGE</a>, <a href="../../javax/jms/Session.html#DUPS_OK_ACKNOWLEDGE">DUPS_OK_ACKNOWLEDGE</a>, <a href="../../javax/jms/Session.html#SESSION_TRANSACTED">SESSION_TRANSACTED</a></code></li>
</ul>
</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><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createDurableSubscriber-javax.jms.Topic-java.lang.String-">createDurableSubscriber</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.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="i1" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createDurableSubscriber-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableSubscriber</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.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="i2" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/TopicPublisher.html" title="interface in javax.jms">TopicPublisher</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createPublisher-javax.jms.Topic-">createPublisher</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic)</code>
<div class="block">Creates a publisher for the specified topic.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createSubscriber-javax.jms.Topic-">createSubscriber</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic)</code>
<div class="block">Creates a nondurable subscriber to the specified topic.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createSubscriber-javax.jms.Topic-java.lang.String-boolean-">createSubscriber</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates a nondurable subscriber to the specified topic, using a message selector or specifying whether messages
published by its own connection should be delivered to it.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/TemporaryTopic.html" title="interface in javax.jms">TemporaryTopic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createTemporaryTopic--">createTemporaryTopic</a></span>()</code>
<div class="block">Creates a <code>TemporaryTopic</code> object.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.html#createTopic-java.lang.String-">createTopic</a></span>(java.lang.String&nbsp;topicName)</code>
<div class="block">Creates a topic identity given a <code>Topic</code> name.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSession.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>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.javax.jms.Session">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;javax.jms.<a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></h3>
<code><a href="../../javax/jms/Session.html#close--">close</a>, <a href="../../javax/jms/Session.html#commit--">commit</a>, <a href="../../javax/jms/Session.html#createBrowser-javax.jms.Queue-">createBrowser</a>, <a href="../../javax/jms/Session.html#createBrowser-javax.jms.Queue-java.lang.String-">createBrowser</a>, <a href="../../javax/jms/Session.html#createBytesMessage--">createBytesMessage</a>, <a href="../../javax/jms/Session.html#createConsumer-javax.jms.Destination-">createConsumer</a>, <a href="../../javax/jms/Session.html#createConsumer-javax.jms.Destination-java.lang.String-">createConsumer</a>, <a href="../../javax/jms/Session.html#createConsumer-javax.jms.Destination-java.lang.String-boolean-">createConsumer</a>, <a href="../../javax/jms/Session.html#createDurableConsumer-javax.jms.Topic-java.lang.String-">createDurableConsumer</a>, <a href="../../javax/jms/Session.html#createDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableConsumer</a>, <a href="../../javax/jms/Session.html#createMapMessage--">createMapMessage</a>, <a href="../../javax/jms/Session.html#createMessage--">createMessage</a>, <a href="../../javax/jms/Session.html#createObjectMessage--">createObjectMessage</a>, <a href="../../javax/jms/Session.html#createObjectMessage-java.io.Serializable-">createObjectMessage</a>, <a href="../../javax/jms/Session.html#createProducer-javax.jms.Destination-">createProducer</a>, <a href="../../javax/jms/Session.html#createQueue-java.lang.String-">createQueue</a>, <a href="../../javax/jms/Session.html#createSharedConsumer-javax.jms.Topic-java.lang.String-">createSharedConsumer</a>, <a href="../../javax/jms/Session.html#createSharedConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">createSharedConsumer</a>, <a href="../../javax/jms/Session.html#createSharedDurableConsumer-javax.jms.Topic-java.lang.String-">createSharedDurableConsumer</a>, <a href="../../javax/jms/Session.html#createSharedDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">createSharedDurableConsumer</a>, <a href="../../javax/jms/Session.html#createStreamMessage--">createStreamMessage</a>, <a href="../../javax/jms/Session.html#createTemporaryQueue--">createTemporaryQueue</a>, <a href="../../javax/jms/Session.html#createTextMessage--">createTextMessage</a>, <a href="../../javax/jms/Session.html#createTextMessage-java.lang.String-">createTextMessage</a>, <a href="../../javax/jms/Session.html#getAcknowledgeMode--">getAcknowledgeMode</a>, <a href="../../javax/jms/Session.html#getMessageListener--">getMessageListener</a>, <a href="../../javax/jms/Session.html#getTransacted--">getTransacted</a>, <a href="../../javax/jms/Session.html#recover--">recover</a>, <a href="../../javax/jms/Session.html#rollback--">rollback</a>, <a href="../../javax/jms/Session.html#run--">run</a>, <a href="../../javax/jms/Session.html#setMessageListener-javax.jms.MessageListener-">setMessageListener</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="createTopic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTopic</h4>
<pre><a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;createTopic(java.lang.String&nbsp;topicName)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Creates a topic identity given a <code>Topic</code> name.
<p>
This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows
the creation of a topic identity with a provider-specific name. Clients that depend on this ability are not portable.
<p>
Note that this method is not for creating the physical topic. The physical creation of topics is an administrative
task and is not to be initiated by the JMS API. The one exception is the creation of temporary topics, which is
accomplished with the <code>createTemporaryTopic</code> method.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/jms/Session.html#createTopic-java.lang.String-">createTopic</a></code>&nbsp;in interface&nbsp;<code><a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topicName</code> - the name of this <code>Topic</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <code>Topic</code> with the given name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to create a topic due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createSubscriber-javax.jms.Topic-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSubscriber</h4>
<pre><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a>&nbsp;createSubscriber(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Creates a nondurable subscriber to the specified topic.
<p>
A client uses a <code>TopicSubscriber</code> object to receive messages that have been published to a topic.
<p>
Regular <code>TopicSubscriber</code> objects are not durable. They receive only messages that are published while they are
active.
<p>
In some cases, a connection may both publish and subscribe to a topic. The subscriber <code>NoLocal</code> attribute
allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this
attribute is false.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A nondurable subscriber to the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to create a subscriber due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
</dl>
</li>
</ul>
<a name="createSubscriber-javax.jms.Topic-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSubscriber</h4>
<pre><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a>&nbsp;createSubscriber(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Creates a nondurable subscriber to the specified topic, using a message selector or specifying whether messages
published by its own connection should be delivered to it.
<p>
A client uses a <code>TopicSubscriber</code> object to receive messages that have been published to a topic.
<p>
Regular <code>TopicSubscriber</code> objects are not durable. They receive only messages that are published while they are
active.
<p>
Messages filtered out by a subscriber's message selector will never be delivered to the subscriber. From the
subscriber's perspective, they do not exist.
<p>
In some cases, a connection may both publish and subscribe to a topic. The subscriber <code>NoLocal</code> attribute
allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this
attribute is false.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</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 set, inhibits the delivery of messages published by its own connection</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A nondurable subscriber to the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to create a subscriber due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorException.html" title="class in javax.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createDurableSubscriber-javax.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableSubscriber</h4>
<pre><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a>&nbsp;createDurableSubscriber(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.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 JMS 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 non-shared durable subscriptions. Any durable subscription created using this
method will be non-shared. 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 non-shared 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 and
message selector, and there is no consumer already active (i.e. not closed) on the durable subscription, and no
consumed messages from that subscription are still part of a pending transaction or are not yet acknowledged in the
session, 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, or consumed messages from that subscription are still
part of a pending transaction or are not yet acknowledged in the session, 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, and no consumed messages from that subscription are still part of a pending
transaction or are not yet acknowledged in the session, then the durable subscription will be deleted and a new one
created.
<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="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/jms/Session.html#createDurableSubscriber-javax.jms.Topic-java.lang.String-">createDurableSubscriber</a></code>&nbsp;in interface&nbsp;<code><a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></code></dd>
<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="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the non-shared durable subscription and <code>TopicSubscriber</code> due to some
internal error
<li>if the client identifier is unset
<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>
</dl>
</li>
</ul>
<a name="createDurableSubscriber-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableSubscriber</h4>
<pre><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</a>&nbsp;createDurableSubscriber(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.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 JMS 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 non-shared durable subscriptions. Any durable subscription created using this
method will be non-shared. 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 non-shared 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 and
message selector, and there is no consumer already active (i.e. not closed) on the durable subscription, and no
consumed messages from that subscription are still part of a pending transaction or are not yet acknowledged in the
session, 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, or consumed messages from that subscription are still
part of a pending transaction or are not yet acknowledged in the session, 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, and no consumed messages from that subscription are still part of a pending
transaction or are not yet acknowledged in the session, then the durable subscription will be deleted and a new one
created.
<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>
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>
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="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/jms/Session.html#createDurableSubscriber-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableSubscriber</a></code>&nbsp;in interface&nbsp;<code><a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></code></dd>
<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="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorException.html" title="class in javax.jms">InvalidSelectorException</a></code> - if the message selector is invalid.</dd>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - <ul>
<li>if the session fails to create the non-shared durable subscription and <code>TopicSubscriber</code> due to some
internal error
<li>if the client identifier is unset
<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>
</dl>
</li>
</ul>
<a name="createPublisher-javax.jms.Topic-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createPublisher</h4>
<pre><a href="../../javax/jms/TopicPublisher.html" title="interface in javax.jms">TopicPublisher</a>&nbsp;createPublisher(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Creates a publisher for the specified topic.
<p>
A client uses a <code>TopicPublisher</code> object to publish messages on a topic. Each time a client creates a
<code>TopicPublisher</code> on a topic, it defines a new sequence of messages that have no ordering relationship with the
messages it has previously sent.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to publish to, or null if this is an unidentified producer</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A publisher for the specified topic.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to create a publisher due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid topic is specified.</dd>
</dl>
</li>
</ul>
<a name="createTemporaryTopic--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTemporaryTopic</h4>
<pre><a href="../../javax/jms/TemporaryTopic.html" title="interface in javax.jms">TemporaryTopic</a>&nbsp;createTemporaryTopic()
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Creates a <code>TemporaryTopic</code> object. Its lifetime will be that of the <code>TopicConnection</code> unless it is
deleted earlier.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/jms/Session.html#createTemporaryTopic--">createTemporaryTopic</a></code>&nbsp;in interface&nbsp;<code><a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a temporary topic identity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to create a temporary topic due to some internal error.</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="../../javax/jms/JMSException.html" title="class in javax.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>
It is erroneous for a client to delete a durable subscription while there is an active <code>TopicSubscriber</code> 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="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../javax/jms/Session.html#unsubscribe-java.lang.String-">unsubscribe</a></code>&nbsp;in interface&nbsp;<code><a href="../../javax/jms/Session.html" title="interface in javax.jms">Session</a></code></dd>
<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="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></code> - if the session fails to unsubscribe to the durable subscription due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if an invalid subscription name is specified.</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="../../javax/jms/TopicRequestor.html" title="class in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/TopicSession.html" target="_top">Frames</a></li>
<li><a href="TopicSession.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>Field&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>Field&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>