Files
123123/doc-10.0.10/Docs2017/api/mgmt_api/javax/jms/MessageConsumer.html
GizzlerandCursor 58b7826162 Add live TLS certificate probing and improve restart error handling.
Configure CertificateCheckUrl per container for curl-like TLS checks, classify Sonic permission errors, and extend setup wizard for container management.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 13:16:21 +02:00

442 lines
18 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_19) on Fri Aug 12 11:25:13 EDT 2011 -->
<TITLE>
MessageConsumer (Management Application API)
</TITLE>
<META NAME="keywords" CONTENT="javax.jms.MessageConsumer interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="MessageConsumer (Management Application API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="MessageConsumer.html#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<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="../../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>
Sonic Management API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="Message.html" title="interface in javax.jms"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="MessageEOFException.html" title="class in javax.jms"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html@javax%252Fjms%252FMessageConsumer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="MessageConsumer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="MessageConsumer.html#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="MessageConsumer.html#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.jms</FONT>
<BR>
Interface MessageConsumer</H2>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="QueueReceiver.html" title="interface in javax.jms">QueueReceiver</A>, <A HREF="TopicSubscriber.html" title="interface in javax.jms">TopicSubscriber</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>MessageConsumer</B></DL>
</PRE>
<P>
A client uses a <CODE>MessageConsumer</CODE> object to receive messages
from a destination. A <CODE>MessageConsumer</CODE> object is created by
passing a <CODE>Destination</CODE> object to a message-consumer creation
method supplied by a session.
<P><CODE>MessageConsumer</CODE> is the parent interface for all message
consumers.
<P>A message consumer can be created with a message selector. A message
selector allows
the client to restrict the messages delivered to the message consumer to
those that match the selector.
<P>A client may either synchronously receive a message consumer's messages
or have the consumer asynchronously deliver them as they arrive.
<P>For synchronous receipt, a client can request the next message from a
message consumer using one of its <CODE>receive</CODE> methods. There are
several variations of <CODE>receive</CODE> that allow a
client to poll or wait for the next message.
<P>For asynchronous delivery, a client can register a
<CODE>MessageListener</CODE> object with a message consumer.
As messages arrive at the message consumer, it delivers them by calling the
<CODE>MessageListener</CODE>'s <CODE>onMessage</CODE> method.
<P>It is a client programming error for a <CODE>MessageListener</CODE> to
throw an exception.
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="QueueReceiver.html" title="interface in javax.jms"><CODE>QueueReceiver</CODE></A>,
<A HREF="TopicSubscriber.html" title="interface in javax.jms"><CODE>TopicSubscriber</CODE></A>,
<A HREF="Session.html" title="interface in javax.jms"><CODE>Session</CODE></A></DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#close()">close</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Closes the message consumer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="MessageListener.html" title="interface in javax.jms">MessageListener</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#getMessageListener()">getMessageListener</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the message consumer's <CODE>MessageListener</CODE>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#getMessageSelector()">getMessageSelector</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets this message consumer's message selector expression.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="Message.html" title="interface in javax.jms">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#receive()">receive</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receives the next message produced for this message consumer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="Message.html" title="interface in javax.jms">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#receive(long)">receive</A></B>(long&nbsp;timeout)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receives the next message that arrives within the specified
timeout interval.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="Message.html" title="interface in javax.jms">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#receiveNoWait()">receiveNoWait</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receives the next message if one is immediately available.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="MessageConsumer.html#setMessageListener(javax.jms.MessageListener)">setMessageListener</A></B>(<A HREF="MessageListener.html" title="interface in javax.jms">MessageListener</A>&nbsp;listener)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the message consumer's <CODE>MessageListener</CODE>.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
void <B>close</B>()
throws <A HREF="JMSException.html" title="class in javax.jms">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.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to close the consumer
due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="getMessageListener()"><!-- --></A><H3>
getMessageListener</H3>
<PRE>
<A HREF="MessageListener.html" title="interface in javax.jms">MessageListener</A> <B>getMessageListener</B>()
throws <A HREF="JMSException.html" title="class in javax.jms">JMSException</A></PRE>
<DL>
<DD>Gets the message consumer's <CODE>MessageListener</CODE>.
<P>
<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="JMSException.html" title="class in javax.jms">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="MessageConsumer.html#setMessageListener(javax.jms.MessageListener)"><CODE>setMessageListener(javax.jms.MessageListener)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getMessageSelector()"><!-- --></A><H3>
getMessageSelector</H3>
<PRE>
java.lang.String <B>getMessageSelector</B>()
throws <A HREF="JMSException.html" title="class in javax.jms">JMSException</A></PRE>
<DL>
<DD>Gets this message consumer's message selector expression.
<P>
<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="JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to get the message
selector due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="receive()"><!-- --></A><H3>
receive</H3>
<PRE>
<A HREF="Message.html" title="interface in javax.jms">Message</A> <B>receive</B>()
throws <A HREF="JMSException.html" title="class in javax.jms">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.
<P>
<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="JMSException.html" title="class in javax.jms">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>
<A HREF="Message.html" title="interface in javax.jms">Message</A> <B>receive</B>(long&nbsp;timeout)
throws <A HREF="JMSException.html" title="class in javax.jms">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.
<P>
<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="JMSException.html" title="class in javax.jms">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>
<A HREF="Message.html" title="interface in javax.jms">Message</A> <B>receiveNoWait</B>()
throws <A HREF="JMSException.html" title="class in javax.jms">JMSException</A></PRE>
<DL>
<DD>Receives the next message if one is immediately available.
<P>
<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="JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to receive the next
message due to some internal error.</DL>
</DD>
</DL>
<HR>
<A NAME="setMessageListener(javax.jms.MessageListener)"><!-- --></A><H3>
setMessageListener</H3>
<PRE>
void <B>setMessageListener</B>(<A HREF="MessageListener.html" title="interface in javax.jms">MessageListener</A>&nbsp;listener)
throws <A HREF="JMSException.html" title="class in javax.jms">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.
<P>
<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="JMSException.html" title="class in javax.jms">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="MessageConsumer.html#getMessageListener()"><CODE>getMessageListener()</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="MessageConsumer.html#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<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="../../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>
Sonic Management API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="Message.html" title="interface in javax.jms"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="MessageEOFException.html" title="class in javax.jms"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html@javax%252Fjms%252FMessageConsumer.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="MessageConsumer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="MessageConsumer.html#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="MessageConsumer.html#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1">Copyright &copy; 2001-2011
<a href="http://www.progress.com" target="_top"> Progress Software Corporation</a>. All Rights Reserved.
<br>HTML formatted on 12-Aug-2011.</font>
</BODY>
</HTML>