messageconsumer.html

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

HTML
374
字号
<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getMessageSelector()"><!-- --></A><H3>
getMessageSelector</H3>
<PRE>
public java.lang.String <B>getMessageSelector</B>()
                                    throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets this message consumer's message selector expression.<DD><DL>
<DT><B>Returns:</B><DD>this message consumer's message selector, or null if no
         message selector exists for the message consumer (that is, if 
         the message selector was not set or was set to null or the 
         empty string)<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the message
                         selector due to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="getMessageListener()"><!-- --></A><H3>
getMessageListener</H3>
<PRE>
public <A HREF="../../javax/jms/MessageListener.html">MessageListener</A> <B>getMessageListener</B>()
                                   throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the message consumer's <CODE>MessageListener</CODE>.<DD><DL>
<DT><B>Returns:</B><DD>the listener for the message consumer, or null if no listener
 is set<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the message
                         listener due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/MessageConsumer.html#setMessageListener(javax.jms.MessageListener)"><CODE>setMessageListener(javax.jms.MessageListener)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setMessageListener(javax.jms.MessageListener)"><!-- --></A><H3>
setMessageListener</H3>
<PRE>
public void <B>setMessageListener</B>(<A HREF="../../javax/jms/MessageListener.html">MessageListener</A>&nbsp;listener)
                        throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the message consumer's <CODE>MessageListener</CODE>.
 
 <P>Setting the message listener to null is the equivalent of 
 unsetting the message listener for the message consumer.

 <P>The effect of calling <CODE>MessageConsumer.setMessageListener</CODE>
 while messages are being consumed by an existing listener
 or the consumer is being used to consume messages synchronously
 is undefined.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>listener</CODE> - the listener to which the messages are to be 
                 delivered<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the message
                         listener due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/MessageConsumer.html#getMessageListener()"><CODE>getMessageListener()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="receive()"><!-- --></A><H3>
receive</H3>
<PRE>
public <A HREF="../../javax/jms/Message.html">Message</A> <B>receive</B>()
                throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Receives the next message produced for this message consumer.
  
 <P>This call blocks indefinitely until a message is produced
 or until this message consumer is closed.

 <P>If this <CODE>receive</CODE> is done within a transaction, the 
 consumer retains the message until the transaction commits.<DD><DL>
<DT><B>Returns:</B><DD>the next message produced for this message consumer, or 
 null if this message consumer is concurrently closed<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to receive the next
                         message due to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="receive(long)"><!-- --></A><H3>
receive</H3>
<PRE>
public <A HREF="../../javax/jms/Message.html">Message</A> <B>receive</B>(long&nbsp;timeout)
                throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Receives the next message that arrives within the specified
 timeout interval.
  
 <P>This call blocks until a message arrives, the
 timeout expires, or this message consumer is closed.
 A <CODE>timeout</CODE> of zero never expires, and the call blocks 
 indefinitely.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - the timeout value (in milliseconds)<DT><B>Returns:</B><DD>the next message produced for this message consumer, or 
 null if the timeout expires or this message consumer is concurrently 
 closed<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to receive the next
                         message due to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="receiveNoWait()"><!-- --></A><H3>
receiveNoWait</H3>
<PRE>
public <A HREF="../../javax/jms/Message.html">Message</A> <B>receiveNoWait</B>()
                      throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Receives the next message if one is immediately available.<DD><DL>
<DT><B>Returns:</B><DD>the next message produced for this message consumer, or 
 null if one is not available<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to receive the next
                         message due to some internal error.</DL>
</DD>
</DL>
<HR>

<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()
           throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Closes the message consumer.

 <P>Since a provider may allocate some resources on behalf of a
 <CODE>MessageConsumer</CODE> outside the Java virtual machine, clients 
 should close them when they
 are not needed. Relying on garbage collection to eventually reclaim
 these resources may not be timely enough.

 <P>This call blocks until a <CODE>receive</CODE> or message listener in 
 progress has completed. A blocked message consumer <CODE>receive</CODE> 
 call 
 returns null when this message consumer is closed.<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to close the consumer
                         due to some internal error.</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/Message.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../javax/jms/MessageListener.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="MessageConsumer.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 + -
显示快捷键?