MessageStore xref

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.2 $
    33   */
    34  public interface MessageStore extends Service {
    35
    36      /***
    37       * Adds a message to the message store
    38       */
    39      public MessageIdentity addMessage(ActiveMQMessage message) throws JMSException;
    40
    41      /***
    42       * Looks up a message using either the String messageID or
    43       * the messageNumber. Implementations are encouraged to fill in the missing
    44       * key if its easy to do so.
    45       *
    46       * @param identity which contains either the messageID or the messageNumber
    47       * @return the message or null if it does not exist
    48       */
    49      public ActiveMQMessage getMessage(MessageIdentity identity) throws JMSException;
    50
    51      public void removeMessage(MessageIdentity identity, MessageAck ack) throws JMSException;
    52
    53      /***
    54       * Recover any messages to be delivered onto the dispatch queue.
    55       * <p/>
    56       * Only called when this store is used for durable queues.
    57       *
    58       * @param container
    59       */
    60      public void recover(QueueMessageContainer container) throws JMSException;
    61  }