blob: 1e590d5e6404a3eb33bf316156698c9c3b1dca41 [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>TopicPublisher</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="TopicPublisher";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":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/TopicConnectionFactory.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TopicRequestor.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/TopicPublisher.html" target="_top">Frames</a></li>
<li><a href="TopicPublisher.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 TopicPublisher" class="title">Interface TopicPublisher</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/MessageProducer.html" title="interface in javax.jms">MessageProducer</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">TopicPublisher</span>
extends <a href="../../javax/jms/MessageProducer.html" title="interface in javax.jms">MessageProducer</a></pre>
<div class="block">A client uses a <code>TopicPublisher</code> object to publish messages on a topic. A <code>TopicPublisher</code> object is the
publish-subscribe form of a message producer.
<p>
Normally, the <code>Topic</code> is specified when a <code>TopicPublisher</code> is created. In this case, an attempt to use
the <code>publish</code> methods for an unidentified <code>TopicPublisher</code> will throw a
<code>java.lang.UnsupportedOperationException</code>.
<p>
If the <code>TopicPublisher</code> is created with an unidentified <code>Topic</code>, an attempt to use the <code>publish</code>
methods that assume that the <code>Topic</code> has been identified will throw a
<code>java.lang.UnsupportedOperationException</code>.
<p>
During the execution of its <code>publish</code> method, a message must not be changed by other threads within the client.
If the message is modified, the result of the <code>publish</code> is undefined.
<p>
After publishing a message, a client may retain and modify it without affecting the message that has been published.
The same message object may be published multiple times.
<p>
The following message headers are set as part of publishing a message: <code>JMSDestination</code>,
<code>JMSDeliveryMode</code>, <code>JMSExpiration</code>, <code>JMSPriority</code>, <code>JMSMessageID</code> and <code>JMSTimeStamp</code>.
When the message is published, the values of these headers are ignored. After completion of the <code>publish</code>, the
headers hold the values specified by the method publishing the message. It is possible for the <code>publish</code> method
not to set <code>JMSMessageID</code> and <code>JMSTimeStamp</code> if the setting of these headers is explicitly disabled by
the <code>MessageProducer.setDisableMessageID</code> or <code>MessageProducer.setDisableMessageTimestamp</code> method.
<p>
Creating a <code>MessageProducer</code> provides the same features as creating a <code>TopicPublisher</code>. A
<code>MessageProducer</code> object is recommended when creating new code. The <code>TopicPublisher</code> is provided to
support existing code.
<p>
Because <code>TopicPublisher</code> inherits from <code>MessageProducer</code>, it inherits the <code>send</code> methods that are a
part of the <code>MessageProducer</code> interface. Using the <code>send</code> methods will have the same effect as using the
<code>publish</code> methods: they are functionally the same.</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#createProducer-javax.jms.Destination-"><code>Session.createProducer(Destination)</code></a>,
<a href="../../javax/jms/TopicSession.html#createPublisher-javax.jms.Topic-"><code>TopicSession.createPublisher(Topic)</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><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/TopicPublisher.html#getTopic--">getTopic</a></span>()</code>
<div class="block">Gets the topic associated with this <code>TopicPublisher</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicPublisher.html#publish-javax.jms.Message-">publish</a></span>(<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message)</code>
<div class="block">Publishes a message to the topic.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicPublisher.html#publish-javax.jms.Message-int-int-long-">publish</a></span>(<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message,
int&nbsp;deliveryMode,
int&nbsp;priority,
long&nbsp;timeToLive)</code>
<div class="block">Publishes a message to the topic, specifying delivery mode, priority, and time to live.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicPublisher.html#publish-javax.jms.Topic-javax.jms.Message-">publish</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message)</code>
<div class="block">Publishes a message to a topic for an unidentified message producer.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/TopicPublisher.html#publish-javax.jms.Topic-javax.jms.Message-int-int-long-">publish</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message,
int&nbsp;deliveryMode,
int&nbsp;priority,
long&nbsp;timeToLive)</code>
<div class="block">Publishes a message to a topic for an unidentified message producer, specifying delivery mode, priority and time to
live.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.javax.jms.MessageProducer">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;javax.jms.<a href="../../javax/jms/MessageProducer.html" title="interface in javax.jms">MessageProducer</a></h3>
<code><a href="../../javax/jms/MessageProducer.html#close--">close</a>, <a href="../../javax/jms/MessageProducer.html#getDeliveryDelay--">getDeliveryDelay</a>, <a href="../../javax/jms/MessageProducer.html#getDeliveryMode--">getDeliveryMode</a>, <a href="../../javax/jms/MessageProducer.html#getDestination--">getDestination</a>, <a href="../../javax/jms/MessageProducer.html#getDisableMessageID--">getDisableMessageID</a>, <a href="../../javax/jms/MessageProducer.html#getDisableMessageTimestamp--">getDisableMessageTimestamp</a>, <a href="../../javax/jms/MessageProducer.html#getPriority--">getPriority</a>, <a href="../../javax/jms/MessageProducer.html#getTimeToLive--">getTimeToLive</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Destination-javax.jms.Message-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Destination-javax.jms.Message-javax.jms.CompletionListener-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Destination-javax.jms.Message-int-int-long-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Destination-javax.jms.Message-int-int-long-javax.jms.CompletionListener-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Message-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Message-javax.jms.CompletionListener-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Message-int-int-long-">send</a>, <a href="../../javax/jms/MessageProducer.html#send-javax.jms.Message-int-int-long-javax.jms.CompletionListener-">send</a>, <a href="../../javax/jms/MessageProducer.html#setDeliveryDelay-long-">setDeliveryDelay</a>, <a href="../../javax/jms/MessageProducer.html#setDeliveryMode-int-">setDeliveryMode</a>, <a href="../../javax/jms/MessageProducer.html#setDisableMessageID-boolean-">setDisableMessageID</a>, <a href="../../javax/jms/MessageProducer.html#setDisableMessageTimestamp-boolean-">setDisableMessageTimestamp</a>, <a href="../../javax/jms/MessageProducer.html#setPriority-int-">setPriority</a>, <a href="../../javax/jms/MessageProducer.html#setTimeToLive-long-">setTimeToLive</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 topic associated with this <code>TopicPublisher</code>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this publisher's 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 JMS provider fails to get the topic for this <code>TopicPublisher</code> due to some
internal error.</dd>
</dl>
</li>
</ul>
<a name="publish-javax.jms.Message-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre>void&nbsp;publish(<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Publishes a message to the topic. Uses the <code>TopicPublisher</code>'s default delivery mode, priority, and time to
live.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>message</code> - the message to publish</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 publish the message due to some internal error.</dd>
<dd><code><a href="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</a></code> - if an invalid message is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if a client uses this method with a <code>TopicPublisher</code> with an invalid
topic.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if a client uses this method with a <code>TopicPublisher</code> that
did not specify a topic at creation time.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/MessageProducer.html#getDeliveryMode--"><code>MessageProducer.getDeliveryMode()</code></a>,
<a href="../../javax/jms/MessageProducer.html#getTimeToLive--"><code>MessageProducer.getTimeToLive()</code></a>,
<a href="../../javax/jms/MessageProducer.html#getPriority--"><code>MessageProducer.getPriority()</code></a></dd>
</dl>
</li>
</ul>
<a name="publish-javax.jms.Message-int-int-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre>void&nbsp;publish(<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message,
int&nbsp;deliveryMode,
int&nbsp;priority,
long&nbsp;timeToLive)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Publishes a message to the topic, specifying delivery mode, priority, and time to live.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>message</code> - the message to publish</dd>
<dd><code>deliveryMode</code> - the delivery mode to use</dd>
<dd><code>priority</code> - the priority for this message</dd>
<dd><code>timeToLive</code> - the message's lifetime (in milliseconds)</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 publish the message due to some internal error.</dd>
<dd><code><a href="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</a></code> - if an invalid message is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if a client uses this method with a <code>TopicPublisher</code> with an invalid
topic.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if a client uses this method with a <code>TopicPublisher</code> that
did not specify a topic at creation time.</dd>
</dl>
</li>
</ul>
<a name="publish-javax.jms.Topic-javax.jms.Message-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre>void&nbsp;publish(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Publishes a message to a topic for an unidentified message producer. Uses the <code>TopicPublisher</code>'s default
delivery mode, priority, and time to live.
<p>
Typically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified
message producers, which require that the topic be supplied every time a message is published.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the topic to publish this message to</dd>
<dd><code>message</code> - the message to publish</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 publish the message due to some internal error.</dd>
<dd><code><a href="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</a></code> - if an invalid message is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if a client uses this method with an invalid topic.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/MessageProducer.html#getDeliveryMode--"><code>MessageProducer.getDeliveryMode()</code></a>,
<a href="../../javax/jms/MessageProducer.html#getTimeToLive--"><code>MessageProducer.getTimeToLive()</code></a>,
<a href="../../javax/jms/MessageProducer.html#getPriority--"><code>MessageProducer.getPriority()</code></a></dd>
</dl>
</li>
</ul>
<a name="publish-javax.jms.Topic-javax.jms.Message-int-int-long-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>publish</h4>
<pre>void&nbsp;publish(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
<a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;message,
int&nbsp;deliveryMode,
int&nbsp;priority,
long&nbsp;timeToLive)
throws <a href="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</a></pre>
<div class="block">Publishes a message to a topic for an unidentified message producer, specifying delivery mode, priority and time to
live.
<p>
Typically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified
message producers, which require that the topic be supplied every time a message is published.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the topic to publish this message to</dd>
<dd><code>message</code> - the message to publish</dd>
<dd><code>deliveryMode</code> - the delivery mode to use</dd>
<dd><code>priority</code> - the priority for this message</dd>
<dd><code>timeToLive</code> - the message's lifetime (in milliseconds)</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 publish the message due to some internal error.</dd>
<dd><code><a href="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</a></code> - if an invalid message is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</a></code> - if a client uses this method with an invalid topic.</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/TopicConnectionFactory.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/TopicRequestor.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/TopicPublisher.html" target="_top">Frames</a></li>
<li><a href="TopicPublisher.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>