[Ubermq-commits] jms/src/com/ubermq/jms/server/datagram IMessageDatagram.java,1.5,1.6
Brought to you by:
jimmyp
From: <ji...@us...> - 2002-09-19 03:57:41
|
Update of /cvsroot/ubermq/jms/src/com/ubermq/jms/server/datagram In directory usw-pr-cvs1:/tmp/cvs-serv20014/src/com/ubermq/jms/server/datagram Modified Files: IMessageDatagram.java Log Message: bug fix for acknowledge() of messages that have been resent plus a durable subscriber boundary case Index: IMessageDatagram.java =================================================================== RCS file: /cvsroot/ubermq/jms/src/com/ubermq/jms/server/datagram/IMessageDatagram.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IMessageDatagram.java 18 Sep 2002 21:06:28 -0000 1.5 --- IMessageDatagram.java 19 Sep 2002 03:57:38 -0000 1.6 *************** *** 1,201 **** ! package com.ubermq.jms.server.datagram; ! ! import com.ubermq.kernel.IDatagram; ! import java.util.Collection; ! ! /** ! * The message datagram is the primary means of moving data around a JMS ! * system. A message datagram has some standard properties, which are ! * indexed numerically, and supports custom properties that may have arbitrary ! * names. ! * <P> ! * Note that the format of how this information is stored is implementation ! * specific. ! */ ! public interface IMessageDatagram extends IDatagram ! { ! /** ! * The timestamp property stores the result of <code>System.currentTimeMillis()</code> ! * when the message was created. Represented as a Long. ! */ ! public static final int STDPROP_TIMESTAMP = 1; // long ! ! /** ! * A Long property, TTL indicates message time-to-live. It is typically interpreted ! * as a number of milliseconds that the message is valid. This property ! * can be useful to message servers that can expire messages if overflow ! * conditions exist. Represented as a Long. ! */ ! public static final int STDPROP_TTL = 3; // long ! ! /** ! * An Integer property indicating the priority of this message relative ! * to others. The priority range is not defined by UberMQ, but higher numbers ! * indicate higher priority. JMS restricts priority values to 1 to 9. ! */ ! public static final int STDPROP_PRIORITY = 4; // int ! ! /** ! * An Integer property containing the Message delivery mode, as defined ! * by JMS. ! */ ! public static final int STDPROP_DELIVERYMODE = 5; // int ! ! /** ! * A <code>byte[]</code> containing the Message body. ! */ ! public static final int STDPROP_BODY = 6; // byte[] ! ! /** ! * An integer property containing the JMSRedelivered flag. Please see ! * the JMS specification for details on the meaning of this flag. ! * Nonzero values indicate true, zero indicates false. ! */ ! public static final int STDPROP_REDELIVERY = 7; // int ! ! /** ! * A String property containing the name of the topic that replies ! * to this message should be sent to. ! */ ! public static final int STDPROP_REPLYTO = 8; // String ! ! /** ! * An opaque <code>byte[]</code> that is application-defined that ! * provides some context information to recipients of this message. ! */ ! public static final int STDPROP_CORRELATIONID = 9; // byte[] ! ! /** ! * An Integer property containing the sub-type of the message. ! */ ! public static final int STDPROP_MSGTYPE = 10; // int ! ! /** ! * Removes all custom properties. ! */ ! public void clearProperties(); ! ! /** ! * Sets a standard property, one of the STDPROP_xxx constants. ! * @param property the property index ! * @param value the value of the property. Should be the object type ! * associated with the property index. ! */ ! public void setStandardProperty(int property, Object value); ! ! /** ! * Gets the value of a standard property, one of the STDPROP_xxx constants. ! * @param property the property index ! * @return the value ! */ ! public Object getStandardProperty(int property); ! ! /** ! * Sets a custom (named) property. ! * @param property the name of the property ! * @param value the value of the property ! */ ! public void setCustomProperty(String property, Object value); ! ! /** ! * Gets the value of a custom (named) property. ! * @param property the name of the property ! * @return the value. ! */ ! public Object getCustomProperty(String property); ! ! /** ! * Gets a Collection containing the names of all custom properties. ! * @return the names of all custom properties, as String objects. ! */ ! public Collection getCustomPropertyNames(); ! ! /** ! * Prepares a message datagram for sending, and specifies the ! * options available to a JMS client at send-time. ! * @param deliveryMode the JMS delivery mode to use ! * @param pri the JMS priority to send the message at. ! * @param ttl the TTL to use ! */ ! public void prepareToSend(int deliveryMode, int pri, long ttl); ! ! /** ! * Gets the name of the topic that the message was sent to, ! * or should be sent to. ! * @return a topic name ! */ ! public String getTopicName(); ! ! /** ! * Sets the name of the topic to send the message to. ! * @param a topic name ! */ ! public void setTopicName(String sz); ! ! /** ! * Gets a unique identifier for this message. ! * @return a message ID ! */ ! public MessageId getMessageId(); ! ! /** ! * Gets the unique identifier for the sender of this message. The sender ID ! * should be unique throughout the messaging space. A message ID is defined ! * as a <code>{senderID, sequence}</code> tuple. ! * @return a sender ID ! */ ! public long getSenderId(); ! ! /** ! * Sets the sender identifier that should be attached to this message. ! * @param senderId a sender ID ! */ ! public void setSenderId(long senderId); ! ! /** ! * Gets the sequence number associated with this message. The sequence number ! * is defined by the sender. Clients will expect the sequence number to ! * monotonically increase and not skip any values. The starting point is not ! * used. ! */ ! public int getSequence(); ! ! /** ! * Sets the sequence number associated with this message. ! */ ! public void setSequence(int sequence); ! ! /** ! * Represents a message ID, defined ! * as a <code>{senderID, sequence}</code> tuple. ! */ ! public final static class MessageId ! { ! long senderId; ! int sequence; ! ! /** ! * Construct a message ID. ! * @param s the sender ID ! * @param se the sequence number ! */ ! public MessageId(long s, int se) {senderId = s; sequence = se;} ! public boolean equals(Object o) ! { ! return (senderId == ((MessageId)o).senderId && ! sequence == ((MessageId)o).sequence); ! } ! public String toString() { ! return new StringBuffer().append(senderId).append(".").append(sequence).toString(); ! } ! public long getSenderId() {return senderId;} ! public int getSequence() {return sequence;} ! public int hashCode() { ! int result = 17; ! result = 37*result + (int)(senderId ^ (senderId >>> 32)); ! result = 37*result + sequence; ! return result; ! } ! } ! ! } --- 1,211 ---- ! package com.ubermq.jms.server.datagram; ! ! import com.ubermq.kernel.IDatagram; ! import java.util.Collection; ! ! /** ! * The message datagram is the primary means of moving data around a JMS ! * system. A message datagram has some standard properties, which are ! * indexed numerically, and supports custom properties that may have arbitrary ! * names. ! * <P> ! * Note that the format of how this information is stored is implementation ! * specific. ! */ ! public interface IMessageDatagram extends IDatagram ! { ! /** ! * The timestamp property stores the result of <code>System.currentTimeMillis()</code> ! * when the message was created. Represented as a Long. ! */ ! public static final int STDPROP_TIMESTAMP = 1; // long ! ! /** ! * A Long property, TTL indicates message time-to-live. It is typically interpreted ! * as a number of milliseconds that the message is valid. This property ! * can be useful to message servers that can expire messages if overflow ! * conditions exist. Represented as a Long. ! */ ! public static final int STDPROP_TTL = 3; // long ! ! /** ! * An Integer property indicating the priority of this message relative ! * to others. The priority range is not defined by UberMQ, but higher numbers ! * indicate higher priority. JMS restricts priority values to 1 to 9. ! */ ! public static final int STDPROP_PRIORITY = 4; // int ! ! /** ! * An Integer property containing the Message delivery mode, as defined ! * by JMS. ! */ ! public static final int STDPROP_DELIVERYMODE = 5; // int ! ! /** ! * A <code>byte[]</code> containing the Message body. ! */ ! public static final int STDPROP_BODY = 6; // byte[] ! ! /** ! * An integer property containing the JMSRedelivered flag. Please see ! * the JMS specification for details on the meaning of this flag. ! * Nonzero values indicate true, zero indicates false. ! */ ! public static final int STDPROP_REDELIVERY = 7; // int ! ! /** ! * A String property containing the name of the topic that replies ! * to this message should be sent to. ! */ ! public static final int STDPROP_REPLYTO = 8; // String ! ! /** ! * An opaque <code>byte[]</code> that is application-defined that ! * provides some context information to recipients of this message. ! */ ! public static final int STDPROP_CORRELATIONID = 9; // byte[] ! ! /** ! * An Integer property containing the sub-type of the message. ! */ ! public static final int STDPROP_MSGTYPE = 10; // int ! ! /** ! * Removes all custom properties. ! */ ! public void clearProperties(); ! ! /** ! * Sets a standard property, one of the STDPROP_xxx constants. ! * @param property the property index ! * @param value the value of the property. Should be the object type ! * associated with the property index. ! */ ! public void setStandardProperty(int property, Object value); ! ! /** ! * Gets the value of a standard property, one of the STDPROP_xxx constants. ! * @param property the property index ! * @return the value ! */ ! public Object getStandardProperty(int property); ! ! /** ! * Sets a custom (named) property. ! * @param property the name of the property ! * @param value the value of the property ! */ ! public void setCustomProperty(String property, Object value); ! ! /** ! * Gets the value of a custom (named) property. ! * @param property the name of the property ! * @return the value. ! */ ! public Object getCustomProperty(String property); ! ! /** ! * Gets a Collection containing the names of all custom properties. ! * @return the names of all custom properties, as String objects. ! */ ! public Collection getCustomPropertyNames(); ! ! /** ! * Prepares a message datagram for sending, and specifies the ! * options available to a JMS client at send-time. ! * @param deliveryMode the JMS delivery mode to use ! * @param pri the JMS priority to send the message at. ! * @param ttl the TTL to use ! */ ! public void prepareToSend(int deliveryMode, int pri, long ttl); ! ! /** ! * Gets the name of the topic that the message was sent to, ! * or should be sent to. ! * @return a topic name ! */ ! public String getTopicName(); ! ! /** ! * Sets the name of the topic to send the message to. ! * @param a topic name ! */ ! public void setTopicName(String sz); ! ! /** ! * Gets the original unique identifier for this message ! * when it arrived at the subscriber. This is used for acknowledgement ! * and identification. ! * @return the original message ID, constant for the life of the datagram. ! */ ! public MessageId getIncomingMessageId(); ! ! /** ! * Gets a unique identifier for this message. This ID can change ! * over time if the Message datagram is reused for multiple publish() ! * calls, or if clients call the setSenderID and setSequence methods. ! * @return a message ID ! */ ! public MessageId getMessageId(); ! ! /** ! * Gets the unique identifier for the sender of this message. The sender ID ! * should be unique throughout the messaging space. A message ID is defined ! * as a <code>{senderID, sequence}</code> tuple. ! * @return a sender ID ! */ ! public long getSenderId(); ! ! /** ! * Sets the sender identifier that should be attached to this message. ! * @param senderId a sender ID ! */ ! public void setSenderId(long senderId); ! ! /** ! * Gets the sequence number associated with this message. The sequence number ! * is defined by the sender. Clients will expect the sequence number to ! * monotonically increase and not skip any values. The starting point is not ! * used. ! */ ! public int getSequence(); ! ! /** ! * Sets the sequence number associated with this message. ! */ ! public void setSequence(int sequence); ! ! /** ! * Represents a message ID, defined ! * as a <code>{senderID, sequence}</code> tuple. ! */ ! public final static class MessageId ! { ! long senderId; ! int sequence; ! ! /** ! * Construct a message ID. ! * @param s the sender ID ! * @param se the sequence number ! */ ! public MessageId(long s, int se) {senderId = s; sequence = se;} ! public boolean equals(Object o) ! { ! return (senderId == ((MessageId)o).senderId && ! sequence == ((MessageId)o).sequence); ! } ! public String toString() { ! return new StringBuffer().append(senderId).append(".").append(sequence).toString(); ! } ! public long getSenderId() {return senderId;} ! public int getSequence() {return sequence;} ! public int hashCode() { ! int result = 17; ! result = 37*result + (int)(senderId ^ (senderId >>> 32)); ! result = 37*result + sequence; ! return result; ! } ! } ! ! } |