📄 topicsession.html
字号:
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/TopicSession.html#createSubscriber(javax.jms.Topic, java.lang.String, boolean)">createSubscriber</A></B>(<A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> topic, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> messageSelector, boolean noLocal)</CODE><BR> 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. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/TemporaryTopic.html" title="interface in javax.jms">TemporaryTopic</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/TopicSession.html#createTemporaryTopic()">createTemporaryTopic</A></B>()</CODE><BR> Creates a <CODE>TemporaryTopic</CODE> object. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/TopicSession.html#createTopic(java.lang.String)">createTopic</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> topicName)</CODE><BR> Creates a topic identity given a <CODE>Topic</CODE> name. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/jms/TopicSession.html#unsubscribe(java.lang.String)">unsubscribe</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</CODE><BR> Unsubscribes a durable subscription that has been created by a client. </TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.jms.Session"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.jms.<A HREF="../../javax/jms/Session.html" title="interface in javax.jms">Session</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><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#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#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></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="createTopic(java.lang.String)"><!-- --></A><H3>createTopic</H3><PRE>public <A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> <B>createTopic</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> topicName) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>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.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../javax/jms/Session.html#createTopic(java.lang.String)">createTopic</A></CODE> in interface <CODE><A HREF="../../javax/jms/Session.html" title="interface in javax.jms">Session</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>topicName</CODE> - the name of this <CODE>Topic</CODE><DT><B>Returns:</B><DD>a <CODE>Topic</CODE> with the given name<DT><B>Throws:</B><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.</DL></DD></DL><HR><A NAME="createSubscriber(javax.jms.Topic)"><!-- --></A><H3>createSubscriber</H3><PRE>public <A HREF="../../javax/jms/TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</A> <B>createSubscriber</B>(<A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> topic) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>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.<P><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" title="class in javax.jms">JMSException</A></CODE> - if the session fails to create a subscriber due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">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" title="interface in javax.jms">TopicSubscriber</A> <B>createSubscriber</B>(<A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> topic, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> messageSelector, boolean noLocal) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.<P><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" title="class in javax.jms">JMSException</A></CODE> - if the session fails to create a subscriber due to some internal error.<DD><CODE><A HREF="../../javax/jms/InvalidDestinationException.html" title="class in javax.jms">InvalidDestinationException</A></CODE> - if an invalid topic is specified.<DD><CODE><A HREF="../../javax/jms/InvalidSelectorException.html" title="class in javax.jms">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" title="interface in javax.jms">TopicSubscriber</A> <B>createDurableSubscriber</B>(<A HREF="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</A> topic, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -