001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.activemq.broker.region;
018    
019    import java.io.IOException;
020    
021    import org.apache.activemq.command.ConsumerId;
022    import org.apache.activemq.command.Message;
023    import org.apache.activemq.command.MessageId;
024    
025    /**
026     * Keeps track of a message that is flowing through the Broker.  This 
027     * object may hold a hard reference to the message or only hold the
028     * id of the message if the message has been persisted on in a MessageStore.
029     * 
030     * @version $Revision: 1.15 $
031     */
032    public interface MessageReference {
033        
034        MessageId getMessageId();
035        Message getMessageHardRef();
036        Message getMessage() throws IOException;
037        boolean isPersistent();
038        
039        Destination getRegionDestination();
040        
041        int getRedeliveryCounter();
042        void incrementRedeliveryCounter();
043        
044        int getReferenceCount();
045        
046        int incrementReferenceCount();
047        int decrementReferenceCount();
048        ConsumerId getTargetConsumerId();
049        int getSize();
050        long getExpiration();
051        String getGroupID();
052        int getGroupSequence();
053        
054        /**
055         * Returns true if this message is expired
056         */
057        boolean isExpired();
058    
059        /**
060         * Returns true if this message is dropped.
061         */
062        boolean isDropped();
063        
064        /**
065         * @return true if the message is an advisory
066         */
067        boolean isAdvisory();
068        
069    }