blob: c1acecbf4576c0c639827229c32209ecd7dfc839 [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>TopicSubscriber</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="TopicSubscriber";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":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/TopicSession.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TransactionInProgressException.html" title="class in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/TopicSubscriber.html" target="_top">Frames</a></li>
<li><a href="TopicSubscriber.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 TopicSubscriber" class="title">Interface TopicSubscriber</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd>java.lang.AutoCloseable, <a href="../../javax/jms/MessageConsumer.html" title="interface in javax.jms">MessageConsumer</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">TopicSubscriber</span>
extends <a href="../../javax/jms/MessageConsumer.html" title="interface in javax.jms">MessageConsumer</a></pre>
<div class="block">A client uses a <code>TopicSubscriber</code> object to receive messages that have been published to a topic. A
<code>TopicSubscriber</code> object is the publish/subscribe form of a message consumer. A <code>MessageConsumer</code> can be
created by using <code>Session.createConsumer</code>.
<p>
A <code>TopicSession</code> allows the creation of multiple <code>TopicSubscriber</code> objects per topic. It will deliver
each message for a topic to each subscriber eligible to receive it. Each copy of the message is treated as a
completely separate message. Work done on one copy has no effect on the others; acknowledging one does not
acknowledge the others; one message may be delivered immediately, while another waits for its subscriber to process
messages ahead of it.
<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.
<p>
If a client needs to receive all the messages published on a topic, including the ones published while the subscriber
is inactive, it uses a durable <code>TopicSubscriber</code>. The JMS provider retains a record of this durable
subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by
this durable subscriber or they have expired.
<p>
Sessions with durable subscribers must always provide the same client identifier. In addition, each client must
specify a name that uniquely identifies (within client identifier) each durable subscription it creates. Only one
session at a time can have a <code>TopicSubscriber</code> for a particular durable subscription.
<p>
A client can change an existing durable subscription by creating a durable <code>TopicSubscriber</code> with the same name
and a new topic and/or message selector. Changing a durable subscription is equivalent to unsubscribing (deleting)
the old one and creating a new one.
<p>
The <code>unsubscribe</code> method is used to delete a durable subscription. The <code>unsubscribe</code> method can be used
at the <code>Session</code> or <code>TopicSession</code> level. This method deletes the state being maintained on behalf of the
subscriber by its provider.
<p>
Creating a <code>MessageConsumer</code> provides the same features as creating a <code>TopicSubscriber</code>. To create a
durable subscriber, use of <code>Session.CreateDurableSubscriber</code> is recommended. The <code>TopicSubscriber</code> is
provided to support existing code.</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#createConsumer-javax.jms.Destination-"><code>Session.createConsumer(javax.jms.Destination)</code></a>,
<a href="../../javax/jms/Session.html#createDurableSubscriber-javax.jms.Topic-java.lang.String-"><code>Session.createDurableSubscriber(javax.jms.Topic, java.lang.String)</code></a>,
<a href="../../javax/jms/TopicSession.html" title="interface in javax.jms"><code>TopicSession</code></a>,
<a href="../../javax/jms/TopicSession.html#createSubscriber-javax.jms.Topic-"><code>TopicSession.createSubscriber(javax.jms.Topic)</code></a>,
<a href="../../javax/jms/MessageConsumer.html" title="interface in javax.jms"><code>MessageConsumer</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicSubscriber.html#getNoLocal--">getNoLocal</a></span>()</code>
<div class="block">Gets the <code>NoLocal</code> attribute for this subscriber.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<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/TopicSubscriber.html#getTopic--">getTopic</a></span>()</code>
<div class="block">Gets the <code>Topic</code> associated with this subscriber.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.javax.jms.MessageConsumer">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;javax.jms.<a href="../../javax/jms/MessageConsumer.html" title="interface in javax.jms">MessageConsumer</a></h3>
<code><a href="../../javax/jms/MessageConsumer.html#close--">close</a>, <a href="../../javax/jms/MessageConsumer.html#getMessageListener--">getMessageListener</a>, <a href="../../javax/jms/MessageConsumer.html#getMessageSelector--">getMessageSelector</a>, <a href="../../javax/jms/MessageConsumer.html#receive--">receive</a>, <a href="../../javax/jms/MessageConsumer.html#receive-long-">receive</a>, <a href="../../javax/jms/MessageConsumer.html#receiveNoWait--">receiveNoWait</a>, <a href="../../javax/jms/MessageConsumer.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="getTopic--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTopic</h4>
<pre><a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;getTopic()
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Gets the <code>Topic</code> associated with this subscriber.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this subscriber's <code>Topic</code></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 JMS provider fails to get the topic for this topic subscriber due to some internal
error.</dd>
</dl>
</li>
</ul>
<a name="getNoLocal--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getNoLocal</h4>
<pre>boolean&nbsp;getNoLocal()
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Gets the <code>NoLocal</code> attribute for this subscriber. The default value for this attribute is false.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if locally published messages are being inhibited</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 JMS provider fails to get the <code>NoLocal</code> attribute for this topic subscriber due
to some internal error.</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/TopicSession.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TransactionInProgressException.html" title="class in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/TopicSubscriber.html" target="_top">Frames</a></li>
<li><a href="TopicSubscriber.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>