Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/message/Packet.java


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.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 short getId();
40  
41      /**
42       * Set the unique id for this Packet
43       *
44       * @param newId
45       */
46  
47      public void setId(short 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       *
77       * @return an aproximation of the current memory used by this instance
78       */
79      public int getMemoryUsage();
80  
81      /**
82       * Set a hint about how mujch memory this packet is consuming
83       *
84       * @param newMemoryUsage
85       */
86      public void setMemoryUsage(int newMemoryUsage);
87  
88      /**
89       * Increment reference count for bounded memory collections
90       *
91       * @return the incremented reference value
92       * @see org.activemq.io.util.MemoryBoundedQueue
93       */
94      public int incrementMemoryReferenceCount();
95  
96  
97      /**
98       * Decrement reference count for bounded memory collections
99       *
100      * @return the decremented reference value
101      * @see org.activemq.io.util.MemoryBoundedQueue
102      */
103     public int decrementMemoryReferenceCount();
104 
105     /**
106      * @return the current reference count for bounded memory collections
107      * @see org.activemq.io.util.MemoryBoundedQueue
108      */
109     public int getMemoryUsageReferenceCount();
110 
111     /**
112      * As the packet passes through the broker add the broker to the visited list
113      *
114      * @param brokerName the name of the broker
115      */
116     public void addBrokerVisited(String brokerName);
117     
118     /**
119      * clear list of brokers visited
120      */
121     public void clearBrokersVisited();
122 
123 
124     /**
125      * test to see if the named broker has already seen this packet
126      *
127      * @param brokerName the name of the broker
128      * @return true if the packet has visited the broker
129      */
130     public boolean hasVisited(String brokerName);
131 
132     /**
133      * @return Returns the brokersVisited.
134      */
135     public String getBrokersVisitedAsString();
136 
137     /**
138      * Unspecified Packet type
139      */
140     public static final int NOT_SET = 0;
141 
142     /**
143      * ActiveMQMessage object
144      */
145     public static final int ACTIVEMQ_MESSAGE = 6;
146 
147     /**
148      * ActiveMQTextMessage object
149      */
150 
151     public static final int ACTIVEMQ_TEXT_MESSAGE = 7;
152 
153     /**
154      * ActiveMQObjectMessage object
155      */
156 
157     public static final int ACTIVEMQ_OBJECT_MESSAGE = 8;
158 
159     /**
160      * ActiveMQBytesMessage
161      */
162 
163     public static final int ACTIVEMQ_BYTES_MESSAGE = 9;
164 
165     /**
166      * ActiveMQStreamMessage object
167      */
168 
169     public static final int ACTIVEMQ_STREAM_MESSAGE = 10;
170 
171     /**
172      * ActiveMQMapMessage object
173      */
174 
175     public static final int ACTIVEMQ_MAP_MESSAGE = 11;
176 
177     /**
178      * Message acknowledge
179      */
180     public static final int ACTIVEMQ_MSG_ACK = 15;
181 
182     /**
183      * Recipt message
184      */
185 
186     public static final int RECEIPT_INFO = 16;
187 
188     /**
189      * Consumer Infomation
190      */
191 
192     public static final int CONSUMER_INFO = 17;
193 
194     /**
195      * Producer Info
196      */
197 
198     public static final int PRODUCER_INFO = 18;
199 
200     /**
201      * Transaction info
202      */
203 
204     public static final int TRANSACTION_INFO = 19;
205 
206     /**
207      * XA Transaction info
208      */
209 
210     public static final int XA_TRANSACTION_INFO = 20;
211 
212     /**
213      * Broker infomation message
214      */
215 
216     public static final int ACTIVEMQ_BROKER_INFO = 21;
217 
218     /**
219      * Connection info message
220      */
221 
222     public static final int ACTIVEMQ_CONNECTION_INFO = 22;
223 
224 
225     /**
226      * Session Info message
227      */
228     public static final int SESSION_INFO = 23;
229 
230     /**
231      * Durable Unsubscribe message
232      */
233 
234     public static final int DURABLE_UNSUBSCRIBE = 24;
235 
236 
237     /**
238      * A receipt with an Object reponse.
239      */
240     public static final int RESPONSE_RECEIPT_INFO = 25;
241 
242 
243     /**
244      * A receipt with an Integer reponse.
245      */
246     public static final int INT_RESPONSE_RECEIPT_INFO = 26;
247 
248     /**
249      * Infomation about the Capacity for more Messages for either Connection/Broker
250      */
251     public static final int CAPACITY_INFO = 27;
252 
253     /**
254      * Request infomation  about the current capacity
255      */
256     public static final int CAPACITY_INFO_REQUEST = 28;
257     
258     /**
259      * Infomation about the wire format expected
260      */
261     public static final int WIRE_FORMAT_INFO = 29;
262 
263     /**
264      * Keep-alive message
265      */
266     public static final int KEEP_ALIVE = 30;
267     
268     /**
269      * A command to the Broker Admin
270      */
271     public static final int BROKER_ADMIN_COMMAND = 31;
272     
273     /**
274      * transmit cached values for the wire format
275      */
276     public static final int CACHED_VALUE_COMMAND = 32;
277 
278     /**
279      * transmit cached values for the wire format
280      */
281     public static final int CLEANUP_CONNECTION_INFO = 33;
282 }