📄 messageproducer.html
字号:
<DD><DL><DT><B>Parameters:</B><DD><CODE>timeToLive</CODE> - the message time to live in milliseconds; zero is unlimited<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to set the time to live due to some internal error.<DT><B>See Also:</B><DD><A HREF="../../javax/jms/MessageProducer.html#getTimeToLive()"><CODE>getTimeToLive()</CODE></A>, <A HREF="../../javax/jms/Message.html#DEFAULT_TIME_TO_LIVE"><CODE>Message.DEFAULT_TIME_TO_LIVE</CODE></A></DL></DD></DL><HR><A NAME="getTimeToLive()"><!-- --></A><H3>getTimeToLive</H3><PRE>public long <B>getTimeToLive</B>() throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.<P><DD><DL><DT><B>Returns:</B><DD>the message time to live in milliseconds; zero is unlimited<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to get the time to live due to some internal error.<DT><B>See Also:</B><DD><A HREF="../../javax/jms/MessageProducer.html#setTimeToLive(long)"><CODE>setTimeToLive(long)</CODE></A></DL></DD></DL><HR><A NAME="getDestination()"><!-- --></A><H3>getDestination</H3><PRE>public <A HREF="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</A> <B>getDestination</B>() throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Gets the destination associated with this <CODE>MessageProducer</CODE>.<P><DD><DL><DT><B>Returns:</B><DD>this producer's <CODE>Destination/<CODE><DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to get the destination for this <CODE>MessageProducer</CODE> due to some internal error.<DT><B>Since:</B></DT> <DD>1.1</DD></DL></DD></DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>public void <B>close</B>() throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Closes the message producer. <P>Since a provider may allocate some resources on behalf of a <CODE>MessageProducer</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><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to close the producer due to some internal error.</DL></DD></DL><HR><A NAME="send(javax.jms.Message)"><!-- --></A><H3>send</H3><PRE>public void <B>send</B>(<A HREF="../../javax/jms/Message.html" title="interface in javax.jms">Message</A> message) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Sends a message using the <CODE>MessageProducer</CODE>'s default delivery mode, priority, and time to live.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>message</CODE> - the message to send<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to send the message due to some internal error.<DD><CODE><A HREF="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</A></CODE> - if an invalid message is specified.<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>MessageProducer</CODE> with an invalid destination.<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if a client uses this method with a <CODE>MessageProducer</CODE> that did not specify a destination at creation time.<DT><B>Since:</B></DT> <DD>1.1</DD><DT><B>See Also:</B><DD><A HREF="../../javax/jms/Session.html#createProducer(javax.jms.Destination)"><CODE>Session.createProducer(javax.jms.Destination)</CODE></A>, <A HREF="../../javax/jms/MessageProducer.html" title="interface in javax.jms"><CODE>MessageProducer</CODE></A></DL></DD></DL><HR><A NAME="send(javax.jms.Message, int, int, long)"><!-- --></A><H3>send</H3><PRE>public void <B>send</B>(<A HREF="../../javax/jms/Message.html" title="interface in javax.jms">Message</A> message, int deliveryMode, int priority, long timeToLive) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Sends a message to the destination, specifying delivery mode, priority, and time to live.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>message</CODE> - the message to send<DD><CODE>deliveryMode</CODE> - the delivery mode to use<DD><CODE>priority</CODE> - the priority for this message<DD><CODE>timeToLive</CODE> - the message's lifetime (in milliseconds)<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to send the message due to some internal error.<DD><CODE><A HREF="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</A></CODE> - if an invalid message is specified.<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>MessageProducer</CODE> with an invalid destination.<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if a client uses this method with a <CODE>MessageProducer</CODE> that did not specify a destination at creation time.<DT><B>Since:</B></DT> <DD>1.1</DD><DT><B>See Also:</B><DD><A HREF="../../javax/jms/Session.html#createProducer(javax.jms.Destination)"><CODE>Session.createProducer(javax.jms.Destination)</CODE></A></DL></DD></DL><HR><A NAME="send(javax.jms.Destination, javax.jms.Message)"><!-- --></A><H3>send</H3><PRE>public void <B>send</B>(<A HREF="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</A> destination, <A HREF="../../javax/jms/Message.html" title="interface in javax.jms">Message</A> message) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Sends a message to a destination for an unidentified message producer. Uses the <CODE>MessageProducer</CODE>'s default delivery mode, priority, and time to live. <P>Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>destination</CODE> - the destination to send this message to<DD><CODE>message</CODE> - the message to send<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to send the message due to some internal error.<DD><CODE><A HREF="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</A></CODE> - if an invalid message is specified.<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 destination.<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if a client uses this method with a <CODE>MessageProducer</CODE> that specified a destination at creation time.<DT><B>Since:</B></DT> <DD>1.1</DD><DT><B>See Also:</B><DD><A HREF="../../javax/jms/Session.html#createProducer(javax.jms.Destination)"><CODE>Session.createProducer(javax.jms.Destination)</CODE></A>, <A HREF="../../javax/jms/MessageProducer.html" title="interface in javax.jms"><CODE>MessageProducer</CODE></A></DL></DD></DL><HR><A NAME="send(javax.jms.Destination, javax.jms.Message, int, int, long)"><!-- --></A><H3>send</H3><PRE>public void <B>send</B>(<A HREF="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</A> destination, <A HREF="../../javax/jms/Message.html" title="interface in javax.jms">Message</A> message, int deliveryMode, int priority, long timeToLive) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></PRE><DL><DD>Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live. <P>Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>destination</CODE> - the destination to send this message to<DD><CODE>message</CODE> - the message to send<DD><CODE>deliveryMode</CODE> - the delivery mode to use<DD><CODE>priority</CODE> - the priority for this message<DD><CODE>timeToLive</CODE> - the message's lifetime (in milliseconds)<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">JMSException</A></CODE> - if the JMS provider fails to send the message due to some internal error.<DD><CODE><A HREF="../../javax/jms/MessageFormatException.html" title="class in javax.jms">MessageFormatException</A></CODE> - if an invalid message is specified.<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 destination.<DT><B>Since:</B></DT> <DD>1.1</DD><DT><B>See Also:</B><DD><A HREF="../../javax/jms/Session.html#createProducer(javax.jms.Destination)"><CODE>Session.createProducer(javax.jms.Destination)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/jms/MessageListener.html" title="interface in javax.jms"><B>PREV CLASS</B></A> <A HREF="../../javax/jms/ObjectMessage.html" title="interface in javax.jms"><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> <A HREF="MessageProducer.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -