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  package org.codehaus.activemq.store;
    19
    20  import org.codehaus.activemq.message.ActiveMQMessage;
    21  import org.codehaus.activemq.message.MessageAck;
    22  import org.codehaus.activemq.service.MessageIdentity;
    23  import org.codehaus.activemq.service.QueueMessageContainer;
    24  import org.codehaus.activemq.service.Service;
    25
    26  import javax.jms.JMSException;
    27
    28  /***
    29   * Represents a message store which is used by the persistent {@link org.codehaus.activemq.service.MessageContainer}
    30   * implementations
    31   *
    32   * @version $Revision: 1.1 $
    33   */
    34  public interface MessageStore extends Service {
    35
    36      public MessageIdentity addMessage(ActiveMQMessage message) throws JMSException;
    37
    38      /***
    39       * Looks up a message using either the String messageID or
    40       * the messageNumber. Implementations are encouraged to fill in the missing
    41       * key if its easy to do so.
    42       *
    43       * @param identity which contains either the messageID or the messageNumber
    44       * @return the message or null if it does not exist
    45       */
    46      public ActiveMQMessage getMessage(MessageIdentity identity) throws JMSException;
    47
    48      public void removeMessage(MessageIdentity identity, MessageAck ack) throws JMSException;
    49
    50      /***
    51       * Recover any messages to be delivered onto the dispatch queue.
    52       * <p/>
    53       * Only called when this store is used for durable queues.
    54       *
    55       * @param container
    56       */
    57      public void recover(QueueMessageContainer container) throws JMSException;
    58  }