topicsession.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 502 行 · 第 1/2 页

HTML
502
字号
 to inhibit the delivery of messages published by its own connection.
 The default value for this attribute is false.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>topic</CODE> - the <CODE>Topic</CODE> to subscribe to<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a subscriber
                         due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid topic is specified.</DL>
</DD>
</DL>
<HR>

<A NAME="createSubscriber(javax.jms.Topic, java.lang.String, boolean)"><!-- --></A><H3>
createSubscriber</H3>
<PRE>
public <A HREF="../../javax/jms/TopicSubscriber.html">TopicSubscriber</A> <B>createSubscriber</B>(<A HREF="../../javax/jms/Topic.html">Topic</A>&nbsp;topic,
                                        java.lang.String&nbsp;messageSelector,
                                        boolean&nbsp;noLocal)
                                 throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>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.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>topic</CODE> - the <CODE>Topic</CODE> to subscribe to<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><CODE>noLocal</CODE> - if set, inhibits the delivery of messages published
 by its own connection<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a subscriber
                         due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid topic is specified.<DD><CODE><A HREF="../../javax/jms/InvalidSelectorException.html">InvalidSelectorException</A></CODE> - if the message selector is invalid.</DL>
</DD>
</DL>
<HR>

<A NAME="createDurableSubscriber(javax.jms.Topic, java.lang.String)"><!-- --></A><H3>
createDurableSubscriber</H3>
<PRE>
public <A HREF="../../javax/jms/TopicSubscriber.html">TopicSubscriber</A> <B>createDurableSubscriber</B>(<A HREF="../../javax/jms/Topic.html">Topic</A>&nbsp;topic,
                                               java.lang.String&nbsp;name)
                                        throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Creates a durable subscriber to the specified topic.
  
 <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 subscriber is equivalent to 
 unsubscribing (deleting) the old one and creating a new one.

 <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.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>topic</CODE> - the non-temporary <CODE>Topic</CODE> to subscribe to<DD><CODE>name</CODE> - the name used to identify this subscription<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a subscriber
                         due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid topic is specified.</DL>
</DD>
</DL>
<HR>

<A NAME="createDurableSubscriber(javax.jms.Topic, java.lang.String, java.lang.String, boolean)"><!-- --></A><H3>
createDurableSubscriber</H3>
<PRE>
public <A HREF="../../javax/jms/TopicSubscriber.html">TopicSubscriber</A> <B>createDurableSubscriber</B>(<A HREF="../../javax/jms/Topic.html">Topic</A>&nbsp;topic,
                                               java.lang.String&nbsp;name,
                                               java.lang.String&nbsp;messageSelector,
                                               boolean&nbsp;noLocal)
                                        throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Creates a durable subscriber to the specified topic, using a
 message selector or specifying whether messages published by its
 own connection should be delivered to it.
  
 <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 which
 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.
 An inactive durable subscriber is one that exists but
 does not currently have a message consumer associated with it.

 <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 subscriber is equivalent to 
 unsubscribing (deleting) the old one and creating a new one.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>topic</CODE> - the non-temporary <CODE>Topic</CODE> to subscribe to<DD><CODE>name</CODE> - the name used to identify this subscription<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><CODE>noLocal</CODE> - if set, inhibits the delivery of messages published
 by its own connection<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a subscriber
                         due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid topic is specified.<DD><CODE><A HREF="../../javax/jms/InvalidSelectorException.html">InvalidSelectorException</A></CODE> - if the message selector is invalid.</DL>
</DD>
</DL>
<HR>

<A NAME="createPublisher(javax.jms.Topic)"><!-- --></A><H3>
createPublisher</H3>
<PRE>
public <A HREF="../../javax/jms/TopicPublisher.html">TopicPublisher</A> <B>createPublisher</B>(<A HREF="../../javax/jms/Topic.html">Topic</A>&nbsp;topic)
                               throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>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.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>topic</CODE> - the <CODE>Topic</CODE> to publish to, or null if this is an
 unidentified producer<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a publisher
                         due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid topic is specified.</DL>
</DD>
</DL>
<HR>

<A NAME="createTemporaryTopic()"><!-- --></A><H3>
createTemporaryTopic</H3>
<PRE>
public <A HREF="../../javax/jms/TemporaryTopic.html">TemporaryTopic</A> <B>createTemporaryTopic</B>()
                                    throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Creates a <CODE>TemporaryTopic</CODE> object. Its lifetime will be that 
 of the <CODE>TopicConnection</CODE> unless it is deleted earlier.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a temporary topic identity<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to create a temporary
                         topic due to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="unsubscribe(java.lang.String)"><!-- --></A><H3>
unsubscribe</H3>
<PRE>
public void <B>unsubscribe</B>(java.lang.String&nbsp;name)
                 throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>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.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name used to identify this subscription<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the session fails to unsubscribe to the 
                         durable subscription due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html">InvalidDestinationException</A></CODE> - if an invalid subscription name
                                        is specified.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../javax/jms/TopicPublisher.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../javax/jms/TopicSubscriber.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="TopicSession.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?