message.html

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

HTML
1,316
字号

<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ 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="getJMSMessageID()"><!-- --></A><H3>
getJMSMessageID</H3>
<PRE>
public java.lang.String <B>getJMSMessageID</B>()
                                 throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the message ID.

 <P>The <CODE>JMSMessageID</CODE> header field contains a value that 
 uniquely identifies each message sent by a provider.
  
 <P>When a message is sent, <CODE>JMSMessageID</CODE> can be ignored. 
 When the <CODE>send</CODE> or <CODE>publish</CODE> method returns, it 
 contains a provider-assigned value.

 <P>A <CODE>JMSMessageID</CODE> is a <CODE>String</CODE> value that 
 should function as a 
 unique key for identifying messages in a historical repository. 
 The exact scope of uniqueness is provider-defined. It should at 
 least cover all messages for a specific installation of a 
 provider, where an installation is some connected set of message 
 routers.

 <P>All <CODE>JMSMessageID</CODE> values must start with the prefix 
 <CODE>'ID:'</CODE>. 
 Uniqueness of message ID values across different providers is 
 not required.

 <P>Since message IDs take some effort to create and increase a
 message's size, some JMS providers may be able to optimize message
 overhead if they are given a hint that the message ID is not used by
 an application. By calling the 
 <CODE>MessageProducer.setDisableMessageID</CODE> method, a JMS client 
 enables this potential optimization for all messages sent by that 
 message producer. If the JMS provider accepts this
 hint, these messages must have the message ID set to null; if the 
 provider ignores the hint, the message ID must be set to its normal 
 unique value.<DD><DL>
<DT><B>Returns:</B><DD>the message ID<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the message ID 
                         due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSMessageID(java.lang.String)"><CODE>setJMSMessageID(String)</CODE></A>, 
<A HREF="../../javax/jms/MessageProducer.html#setDisableMessageID(boolean)"><CODE>MessageProducer.setDisableMessageID(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setJMSMessageID(java.lang.String)"><!-- --></A><H3>
setJMSMessageID</H3>
<PRE>
public void <B>setJMSMessageID</B>(java.lang.String&nbsp;id)
                     throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the message ID.
  
 <P>JMS providers set this field when a message is sent. This method
 can be used to change the value for a message that has been received.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>id</CODE> - the ID of the message<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the message ID 
                         due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#getJMSMessageID()"><CODE>getJMSMessageID()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getJMSTimestamp()"><!-- --></A><H3>
getJMSTimestamp</H3>
<PRE>
public long <B>getJMSTimestamp</B>()
                     throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the message timestamp.
  
 <P>The <CODE>JMSTimestamp</CODE> header field contains the time a 
 message was 
 handed off to a provider to be sent. It is not the time the 
 message was actually transmitted, because the actual send may occur 
 later due to transactions or other client-side queueing of messages.

 <P>When a message is sent, <CODE>JMSTimestamp</CODE> is ignored. When 
 the <CODE>send</CODE> or <CODE>publish</CODE>
 method returns, it contains a a time value somewhere in the interval 
 between the call and the return. The value is in the format of a normal 
 millis time value in the Java programming language.

 <P>Since timestamps take some effort to create and increase a 
 message's size, some JMS providers may be able to optimize message 
 overhead if they are given a hint that the timestamp is not used by an 
 application. By calling the
 <CODE>MessageProducer.setDisableMessageTimestamp</CODE> method, a JMS 
 client enables this potential optimization for all messages sent by 
 that message producer. If the JMS provider accepts this
 hint, these messages must have the timestamp set to zero; if the 
 provider ignores the hint, the timestamp must be set to its normal 
 value.<DD><DL>
<DT><B>Returns:</B><DD>the message timestamp<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the timestamp
                         due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSTimestamp(long)"><CODE>setJMSTimestamp(long)</CODE></A>, 
<A HREF="../../javax/jms/MessageProducer.html#setDisableMessageTimestamp(boolean)"><CODE>MessageProducer.setDisableMessageTimestamp(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setJMSTimestamp(long)"><!-- --></A><H3>
setJMSTimestamp</H3>
<PRE>
public void <B>setJMSTimestamp</B>(long&nbsp;timestamp)
                     throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the message timestamp.
  
 <P>JMS providers set this field when a message is sent. This method
 can be used to change the value for a message that has been received.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>timestamp</CODE> - the timestamp for this message<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the timestamp
                         due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#getJMSTimestamp()"><CODE>getJMSTimestamp()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getJMSCorrelationIDAsBytes()"><!-- --></A><H3>
getJMSCorrelationIDAsBytes</H3>
<PRE>
public byte[] <B>getJMSCorrelationIDAsBytes</B>()
                                  throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the correlation ID as an array of bytes for the message.
  
 <P>The use of a <CODE>byte[]</CODE> value for 
 <CODE>JMSCorrelationID</CODE> is non-portable.<DD><DL>
<DT><B>Returns:</B><DD>the correlation ID of a message as an array of bytes<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the correlation
                         ID due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSCorrelationID(java.lang.String)"><CODE>setJMSCorrelationID(String)</CODE></A>, 
<A HREF="../../javax/jms/Message.html#getJMSCorrelationID()"><CODE>getJMSCorrelationID()</CODE></A>, 
<A HREF="../../javax/jms/Message.html#setJMSCorrelationIDAsBytes(byte[])"><CODE>setJMSCorrelationIDAsBytes(byte[])</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setJMSCorrelationIDAsBytes(byte[])"><!-- --></A><H3>
setJMSCorrelationIDAsBytes</H3>
<PRE>
public void <B>setJMSCorrelationIDAsBytes</B>(byte[]&nbsp;correlationID)
                                throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the correlation ID as an array of bytes for the message.
 
 <P>The array is copied before the method returns, so
 future modifications to the array will not alter this message header.
  
 <P>If a provider supports the native concept of correlation ID, a 
 JMS client may need to assign specific <CODE>JMSCorrelationID</CODE> 
 values to match those expected by native messaging clients. 
 JMS providers without native correlation ID values are not required to 
 support this method and its corresponding get method; their 
 implementation may throw a
 <CODE>java.lang.UnsupportedOperationException</CODE>. 

 <P>The use of a <CODE>byte[]</CODE> value for 
 <CODE>JMSCorrelationID</CODE> is non-portable.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>correlationID</CODE> - the correlation ID value as an array of bytes<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the correlation
                         ID due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSCorrelationID(java.lang.String)"><CODE>setJMSCorrelationID(String)</CODE></A>, 
<A HREF="../../javax/jms/Message.html#getJMSCorrelationID()"><CODE>getJMSCorrelationID()</CODE></A>, 
<A HREF="../../javax/jms/Message.html#getJMSCorrelationIDAsBytes()"><CODE>getJMSCorrelationIDAsBytes()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setJMSCorrelationID(java.lang.String)"><!-- --></A><H3>
setJMSCorrelationID</H3>
<PRE>
public void <B>setJMSCorrelationID</B>(java.lang.String&nbsp;correlationID)
                         throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Sets the correlation ID for the message.
  
 <P>A client can use the <CODE>JMSCorrelationID</CODE> header field to 
 link one message with another. A typical use is to link a response 
 message with its request message.
  
 <P><CODE>JMSCorrelationID</CODE> can hold one of the following:
    <UL>
      <LI>A provider-specific message ID
      <LI>An application-specific <CODE>String</CODE>
      <LI>A provider-native <CODE>byte[]</CODE> value
    </UL>
  
 <P>Since each message sent by a JMS provider is assigned a message ID
 value, it is convenient to link messages via message ID. All message ID
 values must start with the <CODE>'ID:'</CODE> prefix.
  
 <P>In some cases, an application (made up of several clients) needs to
 use an application-specific value for linking messages. For instance,
 an application may use <CODE>JMSCorrelationID</CODE> to hold a value 
 referencing some external information. Application-specified values 
 must not start with the <CODE>'ID:'</CODE> prefix; this is reserved for 
 provider-generated message ID values.
  
 <P>If a provider supports the native concept of correlation ID, a JMS
 client may need to assign specific <CODE>JMSCorrelationID</CODE> values 
 to match those expected by clients that do not use the JMS API. A 
 <CODE>byte[]</CODE> value is used for this
 purpose. JMS providers without native correlation ID values are not
 required to support <CODE>byte[]</CODE> values. The use of a 
 <CODE>byte[]</CODE> value for <CODE>JMSCorrelationID</CODE> is 
 non-portable.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>correlationID</CODE> - the message ID of a message being referred to<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to set the correlation
                         ID due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#getJMSCorrelationID()"><CODE>getJMSCorrelationID()</CODE></A>, 
<A HREF="../../javax/jms/Message.html#getJMSCorrelationIDAsBytes()"><CODE>getJMSCorrelationIDAsBytes()</CODE></A>, 
<A HREF="../../javax/jms/Message.html#setJMSCorrelationIDAsBytes(byte[])"><CODE>setJMSCorrelationIDAsBytes(byte[])</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getJMSCorrelationID()"><!-- --></A><H3>
getJMSCorrelationID</H3>
<PRE>
public java.lang.String <B>getJMSCorrelationID</B>()
                                     throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the correlation ID for the message.
  
 <P>This method is used to return correlation ID values that are 
 either provider-specific message IDs or application-specific 
 <CODE>String</CODE> values.<DD><DL>
<DT><B>Returns:</B><DD>the correlation ID of a message as a <CODE>String</CODE><DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the correlation
                         ID due to some internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSCorrelationID(java.lang.String)"><CODE>setJMSCorrelationID(String)</CODE></A>, 
<A HREF="../../javax/jms/Message.html#getJMSCorrelationIDAsBytes()"><CODE>getJMSCorrelationIDAsBytes()</CODE></A>, 
<A HREF="../../javax/jms/Message.html#setJMSCorrelationIDAsBytes(byte[])"><CODE>setJMSCorrelationIDAsBytes(byte[])</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getJMSReplyTo()"><!-- --></A><H3>
getJMSReplyTo</H3>
<PRE>
public <A HREF="../../javax/jms/Destination.html">Destination</A> <B>getJMSReplyTo</B>()
                          throws <A HREF="../../javax/jms/JMSException.html">JMSException</A></PRE>
<DL>
<DD>Gets the <CODE>Destination</CODE> object to which a reply to this 
 message should be sent.<DD><DL>
<DT><B>Returns:</B><DD><CODE>Destination</CODE> to which to send a response to this 
         message<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/jms/JMSException.html">JMSException</A></CODE> - if the JMS provider fails to get the  
                         <CODE>JMSReplyTo</CODE> destination due to some 
                         internal error.<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Message.html#setJMSReplyTo(javax.jms.Destination)"><CODE>setJMSReplyTo(Destination)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setJMSReplyTo(javax.jms.Destination)"><!-- --></A><H3>
setJMSReplyTo</H3>
<PRE>
public void <B>s

⌨️ 快捷键说明

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