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.service; 019 020 import org.activemq.message.ActiveMQMessage; 021 import org.activemq.message.MessageAck; 022 023 import javax.jms.JMSException; 024 025 /** 026 * A MessageContainer holds the messages for a particular destination 027 * 028 * @version $Revision: 1.1.1.1 $ 029 */ 030 public interface MessageContainer extends Service { 031 032 /** 033 * @return the adminstration interface of the container. 034 */ 035 public MessageContainerAdmin getMessageContainerAdmin(); 036 037 /** 038 * @return the destinationName of the Container 039 */ 040 public String getDestinationName(); 041 042 /** 043 * Add an ActiveMQMessage to the message container 044 * 045 * @param msg 046 * @throws JMSException 047 */ 048 public void addMessage(ActiveMQMessage msg) throws JMSException; 049 050 /** 051 * Delete a message - if no 052 * 053 * @param messageIdentity 054 * @param ack 055 * @throws JMSException 056 */ 057 public void delete(MessageIdentity messageIdentity, MessageAck ack) throws JMSException; 058 059 /** 060 * Return the ActiveMQMessage that matches the Id 061 * 062 * @param messageIdentity 063 * @return the message or null 064 * @throws JMSException 065 */ 066 public ActiveMQMessage getMessage(MessageIdentity messageIdentity) throws JMSException; 067 068 /** 069 * Register that a consumer will be interested in this message 070 * 071 * @param messageIdentity 072 * @throws javax.jms.JMSException 073 */ 074 public void registerMessageInterest(MessageIdentity messageIdentity) throws JMSException; 075 076 /** 077 * A message consumer calls this when it's no longer interested in a message 078 * so that we know when we can delete (or archive) it 079 * 080 * @param ack 081 * @throws JMSException 082 */ 083 public void unregisterMessageInterest(MessageIdentity ack) throws JMSException; 084 085 /** 086 * Returns whether or not this container contains the given message identity which 087 * provides an optimisation over getMessage() where the message does not need to be loaded. 088 * 089 * @param messageIdentity 090 * @return true if the container contains the given message 091 */ 092 public boolean containsMessage(MessageIdentity messageIdentity) throws JMSException; 093 094 /** 095 * returns true if this container is a dead letter queue 096 * @return 097 */ 098 public boolean isDeadLetterQueue(); 099 100 }