KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > common > datagram > IMessageDatagram


1 package com.ubermq.jms.common.datagram;
2
3 import com.ubermq.kernel.IDatagram;
4 import java.util.Collection JavaDoc;
5
6 /**
7  * The message datagram is the primary means of moving data around a JMS
8  * system. A message datagram has some standard properties, which are
9  * indexed numerically, and supports custom properties that may have arbitrary
10  * names.
11  * <P>
12  * Note that the format of how this information is stored is implementation
13  * specific.
14  */

15 public interface IMessageDatagram extends IDatagram
16 {
17     /**
18      * The timestamp property stores the result of <code>System.currentTimeMillis()</code>
19      * when the message was created. Represented as a Long.
20      */

21     public static final int STDPROP_TIMESTAMP = 1; // long
22

23     /**
24      * An Integer property, TTL indicates message time-to-live. It is typically interpreted
25      * as a number of milliseconds that the message is valid. This property
26      * can be useful to message servers that can expire messages if overflow
27      * conditions exist. Represented as an Integer.
28      */

29     public static final int STDPROP_TTL = 3; // integer
30

31     /**
32      * An Integer property indicating the priority of this message relative
33      * to others. The priority range is not defined by UberMQ, but higher numbers
34      * indicate higher priority. JMS restricts priority values to 1 to 9.
35      */

36     public static final int STDPROP_PRIORITY = 4; // int
37

38     /**
39      * An Integer property containing the Message delivery mode, as defined
40      * by JMS.
41      */

42     public static final int STDPROP_DELIVERYMODE = 5; // int
43

44     /**
45      * A <code>byte[]</code> containing the Message body.
46      */

47     public static final int STDPROP_BODY = 6; // byte[]
48

49     /**
50      * A Boolean property containing the JMSRedelivered flag. Please see
51      * the JMS specification for details on the meaning of this flag.
52      */

53     public static final int STDPROP_REDELIVERY = 7; // boolean
54

55     /**
56      * A String property containing the name of the topic that replies
57      * to this message should be sent to.
58      */

59     public static final int STDPROP_REPLYTO = 8; // String
60

61     /**
62      * An opaque <code>byte[]</code> that is application-defined that
63      * provides some context information to recipients of this message.
64      */

65     public static final int STDPROP_CORRELATIONID = 9; // byte[]
66

67     /**
68      * An Integer property containing the sub-type of the message.
69      */

70     public static final int STDPROP_MSGTYPE = 10; // int
71

72     /**
73      * Removes all custom properties.
74      */

75     public void clearProperties();
76
77     /**
78      * Sets a standard property, one of the STDPROP_xxx constants.
79      * @param property the property index
80      * @param value the value of the property. Should be the object type
81      * associated with the property index.
82      */

83     public void setStandardProperty(int property, Object JavaDoc value);
84
85     /**
86      * Gets the value of a standard property, one of the STDPROP_xxx constants.
87      * @param property the property index
88      * @return the value
89      */

90     public Object JavaDoc getStandardProperty(int property);
91
92     /**
93      * Sets a custom (named) property.
94      * @param property the name of the property
95      * @param value the value of the property
96      */

97     public void setCustomProperty(String JavaDoc property, Object JavaDoc value);
98
99     /**
100      * Gets the value of a custom (named) property.
101      * @param property the name of the property
102      * @return the value.
103      */

104     public Object JavaDoc getCustomProperty(String JavaDoc property);
105
106     /**
107      * Gets a Collection containing the names of all custom properties.
108      * @return the names of all custom properties, as String objects.
109      */

110     public Collection JavaDoc getCustomPropertyNames();
111
112     /**
113      * Prepares a message datagram for sending, and specifies the
114      * options available to a JMS client at send-time.
115      * @param deliveryMode the JMS delivery mode to use
116      * @param pri the JMS priority to send the message at.
117      * @param ttl the TTL to use
118      */

119     public void prepareToSend(int deliveryMode, int pri, long ttl);
120
121     /**
122      * Gets the name of the topic that the message was sent to,
123      * or should be sent to.
124      * @return a topic name
125      */

126     public String JavaDoc getTopicName();
127
128     /**
129      * Sets the name of the topic to send the message to.
130      * @param a topic name
131      */

132     public void setTopicName(String JavaDoc sz);
133
134     /**
135      * Gets the original unique identifier for this message
136      * when it arrived at the subscriber. This is used for acknowledgement
137      * and identification.
138      * @return the original message ID, constant for the life of the datagram.
139      */

140     public MessageId getIncomingMessageId();
141
142     /**
143      * Gets a unique identifier for this message. This ID can change
144      * over time if the Message datagram is reused for multiple publish()
145      * calls, or if clients call the setSenderID and setSequence methods.
146      * @return a message ID
147      */

148     public MessageId getMessageId();
149
150     /**
151      * Gets the unique identifier for the sender of this message. The sender ID
152      * should be unique throughout the messaging space. A message ID is defined
153      * as a <code>{senderID, sequence}</code> tuple.
154      * @return a sender ID
155      */

156     public long getSenderId();
157
158     /**
159      * Sets the sender identifier that should be attached to this message.
160      * @param senderId a sender ID
161      */

162     public void setSenderId(long senderId);
163
164     /**
165      * Gets the sequence number associated with this message. The sequence number
166      * is defined by the sender. Clients will expect the sequence number to
167      * monotonically increase and not skip any values. The starting point is not
168      * used.
169      */

170     public int getSequence();
171
172     /**
173      * Sets the sequence number associated with this message.
174      */

175     public void setSequence(int sequence);
176
177 }
178
Popular Tags