Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  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   package org.apache.activemq.broker.region;
   18   
   19   import java.util.Map;
   20   import java.util.Set;
   21   
   22   import org.apache.activemq.Service;
   23   import org.apache.activemq.broker.ConnectionContext;
   24   import org.apache.activemq.broker.ConsumerBrokerExchange;
   25   import org.apache.activemq.broker.ProducerBrokerExchange;
   26   import org.apache.activemq.command.ActiveMQDestination;
   27   import org.apache.activemq.command.ConsumerInfo;
   28   import org.apache.activemq.command.Message;
   29   import org.apache.activemq.command.MessageAck;
   30   import org.apache.activemq.command.MessageDispatchNotification;
   31   import org.apache.activemq.command.MessagePull;
   32   import org.apache.activemq.command.ProducerInfo;
   33   import org.apache.activemq.command.RemoveSubscriptionInfo;
   34   import org.apache.activemq.command.Response;
   35   
   36   /**
   37    * A Region is used to implement the different QOS options available to 
   38    * a broker.  A Broker is composed of multiple message processing Regions that
   39    * provide different QOS options.
   40    * 
   41    * @version $Revision$
   42    */
   43   public interface Region extends Service {
   44   
   45       /**
   46        * Used to create a destination.  Usually, this method is invoked as a side-effect of sending
   47        * a message to a destination that does not exist yet.
   48        * 
   49        * @param context
   50        * @param destination the destination to create.
   51        * @return TODO
   52        * @throws Exception TODO
   53        */
   54       Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception;
   55       
   56       /**
   57        * Used to destroy a destination.  
   58        * This should try to quiesce use of the destination up to the timeout allotted time before removing the destination.
   59        * This will remove all persistent messages associated with the destination.
   60        * 
   61        * @param context the environment the operation is being executed under.
   62        * @param destination what is being removed from the broker.
   63        * @param timeout the max amount of time to wait for the destination to quiesce
   64        * @throws Exception TODO
   65        */
   66       void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception;
   67   
   68       /**
   69        * Returns a copy of the current destinations available in the region
   70        * 
   71        * @return a copy of the regions currently active at the time of the call with the key the destination and the value the Destination.
   72        */
   73       Map<ActiveMQDestination, Destination> getDestinationMap();
   74       
   75   
   76       /**
   77        * Adds a consumer.
   78        * @param context the environment the operation is being executed under.
   79        * @return TODO
   80        * @throws Exception TODO
   81        */
   82       Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception;
   83   
   84       /**
   85        * Removes a consumer.
   86        * @param context the environment the operation is being executed under.
   87        * @throws Exception TODO
   88        */
   89       void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception;
   90       
   91       /**
   92        * Adds a Producer.
   93        * @param context the environment the operation is being executed under.
   94        * @throws Exception TODO
   95        */
   96       void addProducer(ConnectionContext context, ProducerInfo info) throws Exception;
   97   
   98       /**
   99        * Removes a Producer.
  100        * @param context the environment the operation is being executed under.
  101        * @throws Exception TODO
  102        */
  103       void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception;
  104   
  105   
  106       /**
  107        * Deletes a durable subscription.
  108        * @param context the environment the operation is being executed under.
  109        * @param info TODO
  110        * @throws Exception TODO
  111        */
  112       void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception;
  113       
  114       /**
  115        * Send a message to the broker to using the specified destination.  The destination specified
  116        * in the message does not need to match the destination the message is sent to.  This is 
  117        * handy in case the message is being sent to a dead letter destination.
  118        * @param producerExchange the environment the operation is being executed under.
  119        * @param message 
  120        * @throws Exception TODO
  121        */
  122       void send(ProducerBrokerExchange producerExchange, Message message) throws Exception;
  123       
  124       /**
  125        * Used to acknowledge the receipt of a message by a client.
  126        * @param consumerExchange the environment the operation is being executed under.
  127        * @throws Exception TODO
  128        */
  129       void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception;
  130       
  131       /**
  132        * Allows a consumer to pull a message from a queue
  133        */
  134       Response messagePull(ConnectionContext context, MessagePull pull) throws Exception;
  135   
  136       /**
  137        * Process a notification of a dispatch - used by a Slave Broker
  138        * @param messageDispatchNotification
  139        * @throws Exception TODO
  140        */
  141       void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception;
  142   
  143       void gc();
  144   
  145       /**
  146        * Provide an exact or wildcard lookup of destinations in the region
  147        * 
  148        * @return a set of matching destination objects.
  149        */
  150       Set <Destination>getDestinations(ActiveMQDestination destination);
  151       
  152   }

Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » [javadoc | source]