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.service;
    19
    20  import org.codehaus.activemq.message.ActiveMQMessage;
    21  import org.codehaus.activemq.message.MessageAck;
    22
    23  import javax.jms.JMSException;
    24
    25  /***
    26   * A MessageContainer holds the messages for a particular destination
    27   *
    28   * @version $Revision: 1.11 $
    29   */
    30  public interface MessageContainer extends Service {
    31
    32
    33      /***
    34       * @return the destinationName of the Container
    35       */
    36      public String getDestinationName();
    37
    38      /***
    39       * Add an ActiveMQMessage to the message container
    40       *
    41       * @param msg
    42       * @throws JMSException
    43       */
    44      public MessageIdentity addMessage(ActiveMQMessage msg) throws JMSException;
    45
    46      /***
    47       * Delete a message - if no
    48       *
    49       * @param messageIdentity
    50       * @param ack
    51       * @throws JMSException
    52       */
    53      public void delete(MessageIdentity messageIdentity, MessageAck ack) throws JMSException;
    54
    55      /***
    56       * Return the ActiveMQMessage that matches the Id
    57       *
    58       * @param messageIdentity
    59       * @return the message or null
    60       * @throws JMSException
    61       */
    62      public ActiveMQMessage getMessage(MessageIdentity messageIdentity) throws JMSException;
    63
    64      /***
    65       * Register that a consumer will be interested in this message
    66       *
    67       * @param messageIdentity
    68       * @throws javax.jms.JMSException
    69       */
    70      public void registerMessageInterest(MessageIdentity messageIdentity) throws JMSException;
    71
    72      /***
    73       * A message consumer calls this when it's no longer interested in a message
    74       * so that we know when we can delete (or archive) it
    75       *
    76       * @param messageIdentity
    77       * @param ack
    78       * @throws JMSException
    79       */
    80      public void unregisterMessageInterest(MessageIdentity messageIdentity, MessageAck ack) throws JMSException;
    81
    82      /***
    83       * Returns whether or not this container contains the given message identity which
    84       * provides an optimisation over getMessage() where the message does not need to be loaded.
    85       *
    86       * @param messageIdentity
    87       * @return true if the container contains the given message
    88       */
    89      public boolean containsMessage(MessageIdentity messageIdentity) throws JMSException;
    90  }