📄 message.html
字号:
<TD><CODE><B><A HREF="../../javax/jms/Message.html#setShortProperty(java.lang.String, short)">setShortProperty</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, short value)</CODE><BR> Sets a <CODE>short</CODE> property value with the specified name into the message.</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/Message.html#setStringProperty(java.lang.String, java.lang.String)">setStringProperty</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, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> value)</CODE><BR> Sets a <CODE>String</CODE> property value with the specified name into the message.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="DEFAULT_DELIVERY_MODE"><!-- --></A><H3>DEFAULT_DELIVERY_MODE</H3><PRE>public static final int <B>DEFAULT_DELIVERY_MODE</B></PRE><DL><DD>The message producer's default delivery mode is <CODE>PERSISTENT</CODE>.<P><DL><DT><B>See Also:</B><DD><A HREF="../../javax/jms/DeliveryMode.html#PERSISTENT"><CODE>DeliveryMode.PERSISTENT</CODE></A>, <A HREF="../../constant-values.html#javax.jms.Message.DEFAULT_DELIVERY_MODE">Constant Field Values</A></DL></DL><HR><A NAME="DEFAULT_PRIORITY"><!-- --></A><H3>DEFAULT_PRIORITY</H3><PRE>public static final int <B>DEFAULT_PRIORITY</B></PRE><DL><DD>The message producer's default priority is 4.<P><DL><DT><B>See Also:</B><DD><A HREF="../../constant-values.html#javax.jms.Message.DEFAULT_PRIORITY">Constant Field Values</A></DL></DL><HR><A NAME="DEFAULT_TIME_TO_LIVE"><!-- --></A><H3>DEFAULT_TIME_TO_LIVE</H3><PRE>public static final long <B>DEFAULT_TIME_TO_LIVE</B></PRE><DL><DD>The message producer's default time to live is unlimited; the message never expires.<P><DL><DT><B>See Also:</B><DD><A HREF="../../constant-values.html#javax.jms.Message.DEFAULT_TIME_TO_LIVE">Constant Field Values</A></DL></DL><!-- ========= 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="getJMSMessageID()"><!-- --></A><H3>getJMSMessageID</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getJMSMessageID</B>() throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.<P><DD><DL><DT><B>Returns:</B><DD>the message ID<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 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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> id) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.<P><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" title="class in javax.jms">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" title="class in javax.jms">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 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.<P><DD><DL><DT><B>Returns:</B><DD>the message timestamp<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 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 timestamp) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.<P><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" title="class in javax.jms">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" title="class in javax.jms">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.<P><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" title="class in javax.jms">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[] correlationID) throws <A HREF="../../javax/jms/JMSException.html" title="class in javax.jms">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.<P><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" title="class in javax.jms">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>setJ
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -