001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. 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 */ 017package org.apache.activemq.broker.region.policy; 018 019import org.apache.activemq.broker.Broker; 020import org.apache.activemq.broker.ConnectionContext; 021import org.apache.activemq.broker.region.Destination; 022import org.apache.activemq.broker.region.Subscription; 023 024/** 025 * Interface for a strategy for dealing with slow consumers 026 */ 027public interface SlowConsumerStrategy { 028 029 /** 030 * Slow consumer event. 031 * 032 * @param context 033 * Connection context of the subscription. 034 * @param subs 035 * The subscription object for the slow consumer. 036 */ 037 void slowConsumer(ConnectionContext context, Subscription subs); 038 039 /** 040 * Sets the Broker instance which can provide a Scheduler among other things. 041 * 042 * @param broker 043 * The running Broker. 044 */ 045 void setBrokerService(Broker broker); 046 047 /** 048 * For Strategies that need to examine assigned destination for slow consumers 049 * periodically the destination is assigned here. 050 * 051 * If the strategy doesn't is event driven it can just ignore assigned destination. 052 * 053 * @param destination 054 * A destination to add to a watch list. 055 */ 056 void addDestination(Destination destination); 057 058}