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.io.IOException;
   20   import java.util.List;
   21   
   22   import org.apache.activemq.Service;
   23   import org.apache.activemq.broker.ConnectionContext;
   24   import org.apache.activemq.broker.ProducerBrokerExchange;
   25   import org.apache.activemq.broker.region.policy.DeadLetterStrategy;
   26   import org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy;
   27   import org.apache.activemq.command.ActiveMQDestination;
   28   import org.apache.activemq.command.ConsumerInfo;
   29   import org.apache.activemq.command.Message;
   30   import org.apache.activemq.command.MessageAck;
   31   import org.apache.activemq.command.MessageDispatchNotification;
   32   import org.apache.activemq.command.ProducerInfo;
   33   import org.apache.activemq.store.MessageStore;
   34   import org.apache.activemq.thread.Task;
   35   import org.apache.activemq.usage.MemoryUsage;
   36   import org.apache.activemq.usage.Usage;
   37   
   38   /**
   39    * @version $Revision: 1.12 $
   40    */
   41   public interface Destination extends Service, Task {
   42   
   43       public static final DeadLetterStrategy DEFAULT_DEAD_LETTER_STRATEGY = new SharedDeadLetterStrategy();
   44       public static final long DEFAULT_BLOCKED_PRODUCER_WARNING_INTERVAL = 30000;
   45   
   46       void addSubscription(ConnectionContext context, Subscription sub) throws Exception;
   47   
   48       void removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId) throws Exception;
   49   
   50       void addProducer(ConnectionContext context, ProducerInfo info) throws Exception;
   51   
   52       void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception;
   53   
   54       void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception;
   55   
   56       void acknowledge(ConnectionContext context, Subscription sub, final MessageAck ack, final MessageReference node) throws IOException;
   57   
   58       void gc();
   59   
   60       ActiveMQDestination getActiveMQDestination();
   61   
   62       MemoryUsage getMemoryUsage();
   63   
   64       void dispose(ConnectionContext context) throws IOException;
   65   
   66       DestinationStatistics getDestinationStatistics();
   67   
   68       DeadLetterStrategy getDeadLetterStrategy();
   69   
   70       Message[] browse();
   71   
   72       String getName();
   73   
   74       MessageStore getMessageStore();
   75   
   76       boolean isProducerFlowControl();
   77   
   78       void setProducerFlowControl(boolean value);
   79   
   80       /**
   81        * Set's the interval at which warnings about producers being blocked by
   82        * resource usage will be triggered. Values of 0 or less will disable
   83        * warnings
   84        * 
   85        * @param blockedProducerWarningInterval the interval at which warning about
   86        *            blocked producers will be triggered.
   87        */
   88       public void setBlockedProducerWarningInterval(long blockedProducerWarningInterval);
   89   
   90       /**
   91        * 
   92        * @return the interval at which warning about blocked producers will be
   93        *         triggered.
   94        */
   95       public long getBlockedProducerWarningInterval();
   96   
   97       int getMaxProducersToAudit();
   98   
   99       void setMaxProducersToAudit(int maxProducersToAudit);
  100   
  101       int getMaxAuditDepth();
  102   
  103       void setMaxAuditDepth(int maxAuditDepth);
  104   
  105       boolean isEnableAudit();
  106   
  107       void setEnableAudit(boolean enableAudit);
  108   
  109       boolean isActive();
  110   
  111       int getMaxPageSize();
  112   
  113       public void setMaxPageSize(int maxPageSize);
  114   
  115       public int getMaxBrowsePageSize();
  116   
  117       public void setMaxBrowsePageSize(int maxPageSize);
  118   
  119       public boolean isUseCache();
  120   
  121       public void setUseCache(boolean useCache);
  122   
  123       public int getMinimumMessageSize();
  124   
  125       public void setMinimumMessageSize(int minimumMessageSize);
  126   
  127       public int getCursorMemoryHighWaterMark();
  128   
  129       public void setCursorMemoryHighWaterMark(int cursorMemoryHighWaterMark);
  130   
  131       /**
  132        * optionally called by a Subscriber - to inform the Destination its ready
  133        * for more messages
  134        */
  135       public void wakeup();
  136   
  137       /**
  138        * @return true if lazyDispatch is enabled
  139        */
  140       public boolean isLazyDispatch();
  141   
  142       /**
  143        * set the lazy dispatch - default is false
  144        * 
  145        * @param value
  146        */
  147       public void setLazyDispatch(boolean value);
  148   
  149       /**
  150        * Inform the Destination a message has expired
  151        * 
  152        * @param context
  153        * @param subs
  154        * @param node
  155        */
  156       void messageExpired(ConnectionContext context, Subscription subs, MessageReference node);
  157   
  158       /**
  159        * called when message is consumed
  160        * 
  161        * @param context
  162        * @param messageReference
  163        */
  164       void messageConsumed(ConnectionContext context, MessageReference messageReference);
  165   
  166       /**
  167        * Called when message is delivered to the broker
  168        * 
  169        * @param context
  170        * @param messageReference
  171        */
  172       void messageDelivered(ConnectionContext context, MessageReference messageReference);
  173   
  174       /**
  175        * Called when a message is discarded - e.g. running low on memory This will
  176        * happen only if the policy is enabled - e.g. non durable topics
  177        * 
  178        * @param context
  179        * @param messageReference
  180        */
  181       void messageDiscarded(ConnectionContext context, MessageReference messageReference);
  182   
  183       /**
  184        * Called when there is a slow consumer
  185        * 
  186        * @param context
  187        * @param subs
  188        */
  189       void slowConsumer(ConnectionContext context, Subscription subs);
  190   
  191       /**
  192        * Called to notify a producer is too fast
  193        * 
  194        * @param context
  195        * @param producerInfo
  196        */
  197       void fastProducer(ConnectionContext context, ProducerInfo producerInfo);
  198   
  199       /**
  200        * Called when a Usage reaches a limit
  201        * 
  202        * @param context
  203        * @param usage
  204        */
  205       void isFull(ConnectionContext context, Usage usage);
  206   
  207       List<Subscription> getConsumers();
  208   
  209       /**
  210        * called on Queues in slave mode to allow dispatch to follow subscription
  211        * choice of master
  212        * 
  213        * @param messageDispatchNotification
  214        * @throws Exception
  215        */
  216       void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception;
  217   }

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