View Javadoc

1   /*** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  
19  package org.codehaus.activemq.message;
20  
21  /***
22   * Denotes an object that can be serialized/deserailized using a PacketReader or PacketWriter
23   */
24  
25  public interface Packet {
26  
27      /***
28       * Return the type of Packet
29       *
30       * @return integer representation of the type of Packet
31       */
32  
33      public int getPacketType();
34  
35      /***
36       * @return the unique id for this Packet
37       */
38  
39      public String getId();
40  
41      /***
42       * Set the unique id for this Packet
43       *
44       * @param newId
45       */
46  
47      public void setId(String newId);
48  
49      /***
50       * @return true if a Recipt is required
51       */
52      public boolean isReceiptRequired();
53  
54      /***
55       * @return true if this is a Receipt
56       */
57      public boolean isReceipt();
58  
59      /***
60       * Set if a Recipt if required on receiving this Packet
61       *
62       * @param value
63       */
64  
65      public void setReceiptRequired(boolean value);
66  
67      /***
68       * Retrieve if a JMS Message type or not
69       *
70       * @return true if it is a JMS Message
71       */
72      public boolean isJMSMessage();
73      
74      /***
75       * Get a hint about how much memory this Packet is consuming
76       * @return an aproximation of the current memory used by this instance
77       */
78      public int getMemoryUsage();
79      
80      /***
81       * Set a hint about how mujch memory this packet is consuming
82       * @param newMemoryUsage
83       */
84      public void setMemoryUsage(int newMemoryUsage);
85      
86      /***
87       * Increment reference count for bounded memory collections
88       * @return the incremented reference value
89       * @see org.codehaus.activemq.message.util.MemoryBoundedQueue
90       */
91      public int incrementMemoryReferenceCount();
92      
93      
94      /***
95       * Decrement reference count for bounded memory collections
96       * @return the decremented reference value
97       * @see org.codehaus.activemq.message.util.MemoryBoundedQueue
98       */
99      public int decrementMemoryReferenceCount();
100     
101     /***
102      * @return the current reference count for bounded memory collections
103      * @see org.codehaus.activemq.message.util.MemoryBoundedQueue
104      */
105     public int getMemoryUsageReferenceCount();
106 
107     /***
108      * ActiveMQMessage object
109      */
110     public static final int ACTIVEMQ_MESSAGE = 6;
111 
112     /***
113      * ActiveMQTextMessage object
114      */
115 
116     public static final int ACTIVEMQ_TEXT_MESSAGE = 7;
117 
118     /***
119      * ActiveMQObjectMessage object
120      */
121 
122     public static final int ACTIVEMQ_OBJECT_MESSAGE = 8;
123 
124     /***
125      * ActiveMQBytesMessage
126      */
127 
128     public static final int ACTIVEMQ_BYTES_MESSAGE = 9;
129 
130     /***
131      * ActiveMQStreamMessage object
132      */
133 
134     public static final int ACTIVEMQ_STREAM_MESSAGE = 10;
135 
136     /***
137      * ActiveMQMapMessage object
138      */
139 
140     public static final int ACTIVEMQ_MAP_MESSAGE = 11;
141 
142     /***
143      * Message acknowledge
144      */
145     public static final int ACTIVEMQ_MSG_ACK = 15;
146 
147     /***
148      * Recipt message
149      */
150 
151     public static final int RECEIPT_INFO = 16;
152 
153     /***
154      * Consumer Infomation
155      */
156 
157     public static final int CONSUMER_INFO = 17;
158 
159     /***
160      * Producer Info
161      */
162 
163     public static final int PRODUCER_INFO = 18;
164 
165     /***
166      * Transaction info
167      */
168 
169     public static final int TRANSACTION_INFO = 19;
170 
171     /***
172      * XA Transaction info
173      */
174 
175     public static final int XA_TRANSACTION_INFO = 20;
176 
177     /***
178      * Broker infomation message
179      */
180 
181     public static final int ACTIVEMQ_BROKER_INFO = 21;
182 
183     /***
184      * Connection info message
185      */
186 
187     public static final int ACTIVEMQ_CONNECTION_INFO = 22;
188 
189 
190     /***
191      * Session Info message
192      */
193     public static final int SESSION_INFO = 23;
194 
195     /***
196      * Durable Unsubscribe message
197      */
198 
199     public static final int DURABLE_UNSUBSCRIBE = 24;
200 
201 
202     /***
203      * A receipt with an Object reponse.
204      */
205     public static final int RESPONSE_RECEIPT_INFO = 25;
206 
207 
208     /***
209      * A receipt with an Integer reponse.
210      */
211     public static final int INT_RESPONSE_RECEIPT_INFO = 26;
212     
213     /***
214      * Infomation about the Capacity for more Messages for either Connection/Broker
215      */
216     public static final int CAPACITY_INFO = 27;
217     
218     /***
219      * Request infomation  about the current capacity
220      */
221     public static final int CAPACITY_INFO_REQUEST = 28;
222 
223 
224 }