001 /** 002 * 003 * Copyright 2004 Protique Ltd 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * 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 **/ 018 package org.activemq.store; 019 020 import javax.jms.JMSException; 021 022 import org.activemq.message.ActiveMQMessage; 023 import org.activemq.message.MessageAck; 024 import org.activemq.service.MessageIdentity; 025 import org.activemq.service.Service; 026 027 /** 028 * Represents a message store which is used by the persistent {@link org.activemq.service.MessageContainer} 029 * implementations 030 * 031 * @version $Revision: 1.1.1.1 $ 032 */ 033 public interface MessageStore extends Service { 034 035 /** 036 * Adds a message to the message store 037 */ 038 public void addMessage(ActiveMQMessage message) throws JMSException; 039 040 /** 041 * Looks up a message using either the String messageID or 042 * the messageNumber. Implementations are encouraged to fill in the missing 043 * key if its easy to do so. 044 * 045 * @param identity which contains either the messageID or the messageNumber 046 * @return the message or null if it does not exist 047 */ 048 public ActiveMQMessage getMessage(MessageIdentity identity) throws JMSException; 049 050 /** 051 * Removes a message from the message store. 052 * 053 * @param ack the ack request that cause the message to be removed. It conatins 054 * the identity which contains the messageID of the message that needs to be removed. 055 */ 056 public void removeMessage(MessageAck ack) throws JMSException; 057 058 /** 059 * Removes all the messages from the message store. 060 */ 061 public void removeAllMessages() throws JMSException; 062 063 /** 064 * Recover any messages to be delivered. 065 * 066 * @param container 067 */ 068 public void recover(RecoveryListener container) throws JMSException; 069 070 }