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       *
    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.codehaus.activemq.message.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.codehaus.activemq.message.util.MemoryBoundedQueue
    102      */
    103     public int decrementMemoryReferenceCount();
    104
    105     /***
    106      * @return the current reference count for bounded memory collections
    107      * @see org.codehaus.activemq.message.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     /***
    120      * test to see if the named broker has already seen this packet
    121      *
    122      * @param brokerName the name of the broker
    123      * @return true if the packet has visited the broker
    124      */
    125     public boolean hasVisited(String brokerName);
    126
    127     /***
    128      * @return Returns the brokersVisited.
    129      */
    130     public String getBrokersVisitedAsString();
    131
    132
    133     /***
    134      * ActiveMQMessage object
    135      */
    136     public static final int ACTIVEMQ_MESSAGE = 6;
    137
    138     /***
    139      * ActiveMQTextMessage object
    140      */
    141
    142     public static final int ACTIVEMQ_TEXT_MESSAGE = 7;
    143
    144     /***
    145      * ActiveMQObjectMessage object
    146      */
    147
    148     public static final int ACTIVEMQ_OBJECT_MESSAGE = 8;
    149
    150     /***
    151      * ActiveMQBytesMessage
    152      */
    153
    154     public static final int ACTIVEMQ_BYTES_MESSAGE = 9;
    155
    156     /***
    157      * ActiveMQStreamMessage object
    158      */
    159
    160     public static final int ACTIVEMQ_STREAM_MESSAGE = 10;
    161
    162     /***
    163      * ActiveMQMapMessage object
    164      */
    165
    166     public static final int ACTIVEMQ_MAP_MESSAGE = 11;
    167
    168     /***
    169      * Message acknowledge
    170      */
    171     public static final int ACTIVEMQ_MSG_ACK = 15;
    172
    173     /***
    174      * Recipt message
    175      */
    176
    177     public static final int RECEIPT_INFO = 16;
    178
    179     /***
    180      * Consumer Infomation
    181      */
    182
    183     public static final int CONSUMER_INFO = 17;
    184
    185     /***
    186      * Producer Info
    187      */
    188
    189     public static final int PRODUCER_INFO = 18;
    190
    191     /***
    192      * Transaction info
    193      */
    194
    195     public static final int TRANSACTION_INFO = 19;
    196
    197     /***
    198      * XA Transaction info
    199      */
    200
    201     public static final int XA_TRANSACTION_INFO = 20;
    202
    203     /***
    204      * Broker infomation message
    205      */
    206
    207     public static final int ACTIVEMQ_BROKER_INFO = 21;
    208
    209     /***
    210      * Connection info message
    211      */
    212
    213     public static final int ACTIVEMQ_CONNECTION_INFO = 22;
    214
    215
    216     /***
    217      * Session Info message
    218      */
    219     public static final int SESSION_INFO = 23;
    220
    221     /***
    222      * Durable Unsubscribe message
    223      */
    224
    225     public static final int DURABLE_UNSUBSCRIBE = 24;
    226
    227
    228     /***
    229      * A receipt with an Object reponse.
    230      */
    231     public static final int RESPONSE_RECEIPT_INFO = 25;
    232
    233
    234     /***
    235      * A receipt with an Integer reponse.
    236      */
    237     public static final int INT_RESPONSE_RECEIPT_INFO = 26;
    238
    239     /***
    240      * Infomation about the Capacity for more Messages for either Connection/Broker
    241      */
    242     public static final int CAPACITY_INFO = 27;
    243
    244     /***
    245      * Request infomation  about the current capacity
    246      */
    247     public static final int CAPACITY_INFO_REQUEST = 28;
    248
    249     /***
    250      * Infomation about the wire format expected
    251      */
    252     public static final int WIRE_FORMAT_INFO = 29;
    253
    254
    255 }