org.apache.activemq.broker.region
Class BaseDestination

java.lang.Object
  extended by org.apache.activemq.broker.region.BaseDestination
All Implemented Interfaces:
Destination, Service, Task
Direct Known Subclasses:
Queue, Topic

public abstract class BaseDestination
extends Object
implements Destination

Version:
$Revision: 1.12 $

Field Summary
protected  Broker broker
           
protected  BrokerService brokerService
           
protected  DeadLetterStrategy deadLetterStrategy
           
protected  ActiveMQDestination destination
           
protected  DestinationStatistics destinationStatistics
           
static int MAX_BROWSE_PAGE_SIZE
           
static int MAX_PAGE_SIZE
          The maximum number of messages to page in to the destination from persistent storage
protected  MemoryUsage memoryUsage
           
protected  Broker regionBroker
           
protected  MessageStore store
           
protected  SystemUsage systemUsage
           
 
Fields inherited from interface org.apache.activemq.broker.region.Destination
DEFAULT_DEAD_LETTER_STRATEGY
 
Constructor Summary
BaseDestination(BrokerService brokerService, MessageStore store, ActiveMQDestination destination, DestinationStatistics parentStats)
           
 
Method Summary
 void addProducer(ConnectionContext context, ProducerInfo info)
           
 void dispose(ConnectionContext context)
           
 void fastProducer(ConnectionContext context, ProducerInfo producerInfo)
          Called to notify a producer is too fast
 ActiveMQDestination getActiveMQDestination()
           
 DeadLetterStrategy getDeadLetterStrategy()
           
protected  long getDestinationSequenceId()
           
 DestinationStatistics getDestinationStatistics()
           
 int getMaxAuditDepth()
           
 int getMaxBrowsePageSize()
           
 int getMaxPageSize()
           
 int getMaxProducersToAudit()
           
 MemoryUsage getMemoryUsage()
           
 MessageStore getMessageStore()
           
 int getMinimumMessageSize()
           
 String getName()
           
 void initialize()
          initialize the destination
 boolean isActive()
           
 boolean isAdvisdoryForFastProducers()
           
 boolean isAdvisoryForConsumed()
           
 boolean isAdvisoryForDelivery()
           
 boolean isAdvisoryForDiscardingMessages()
           
 boolean isAdvisoryForSlowConsumers()
           
 boolean isAdvisoryWhenFull()
           
 boolean isEnableAudit()
           
 void isFull(ConnectionContext context, Usage usage)
          Called when a Usage reaches a limit
 boolean isLazyDispatch()
           
 boolean isProducerFlowControl()
           
 boolean isSendAdvisoryIfNoConsumers()
           
 boolean isUseCache()
           
 void messageConsumed(ConnectionContext context, MessageReference messageReference)
          called when message is consumed
 void messageDelivered(ConnectionContext context, MessageReference messageReference)
          Called when message is delivered to the broker
 void messageDiscarded(ConnectionContext context, MessageReference messageReference)
          Called when a message is discarded - e.g.
protected  void onMessageWithNoConsumers(ConnectionContext context, Message message)
          Provides a hook to allow messages with no consumer to be processed in some way - such as to send to a dead letter queue or something..
 void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
          called on Queues in slave mode to allow dispatch to follow subscription choice of master
 void removeProducer(ConnectionContext context, ProducerInfo info)
           
 void setAdvisdoryForFastProducers(boolean advisdoryForFastProducers)
           
 void setAdvisoryForConsumed(boolean advisoryForConsumed)
           
 void setAdvisoryForDelivery(boolean advisoryForDelivery)
           
 void setAdvisoryForDiscardingMessages(boolean advisoryForDiscardingMessages)
           
 void setAdvisoryForSlowConsumers(boolean advisoryForSlowConsumers)
           
 void setAdvisoryWhenFull(boolean advisoryWhenFull)
           
 void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy)
          set the dead letter strategy
 void setEnableAudit(boolean enableAudit)
           
 void setLazyDispatch(boolean lazyDispatch)
          set the lazy dispatch - default is false
 void setMaxAuditDepth(int maxAuditDepth)
           
 void setMaxBrowsePageSize(int maxPageSize)
           
 void setMaxPageSize(int maxPageSize)
           
 void setMaxProducersToAudit(int maxProducersToAudit)
           
 void setMinimumMessageSize(int minimumMessageSize)
           
 void setProducerFlowControl(boolean producerFlowControl)
           
 void setSendAdvisoryIfNoConsumers(boolean sendAdvisoryIfNoConsumers)
           
 void setUseCache(boolean useCache)
           
 void slowConsumer(ConnectionContext context, Subscription subs)
          Called when there is a slow consumer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.broker.region.Destination
acknowledge, addSubscription, browse, gc, getConsumers, messageExpired, removeSubscription, send, wakeup
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 
Methods inherited from interface org.apache.activemq.thread.Task
iterate
 

Field Detail

MAX_PAGE_SIZE

public static final int MAX_PAGE_SIZE
The maximum number of messages to page in to the destination from persistent storage

See Also:
Constant Field Values

MAX_BROWSE_PAGE_SIZE

public static final int MAX_BROWSE_PAGE_SIZE
See Also:
Constant Field Values

destination

protected final ActiveMQDestination destination

broker

protected final Broker broker

store

protected final MessageStore store

systemUsage

protected SystemUsage systemUsage

memoryUsage

protected MemoryUsage memoryUsage

destinationStatistics

protected final DestinationStatistics destinationStatistics

brokerService

protected final BrokerService brokerService

regionBroker

protected final Broker regionBroker

deadLetterStrategy

protected DeadLetterStrategy deadLetterStrategy
Constructor Detail

BaseDestination

public BaseDestination(BrokerService brokerService,
                       MessageStore store,
                       ActiveMQDestination destination,
                       DestinationStatistics parentStats)
                throws Exception
Parameters:
broker -
store -
destination -
parentStats -
Throws:
Exception
Method Detail

initialize

public void initialize()
                throws Exception
initialize the destination

Throws:
Exception

isProducerFlowControl

public boolean isProducerFlowControl()
Specified by:
isProducerFlowControl in interface Destination
Returns:
the producerFlowControl

setProducerFlowControl

public void setProducerFlowControl(boolean producerFlowControl)
Specified by:
setProducerFlowControl in interface Destination
Parameters:
producerFlowControl - the producerFlowControl to set

getMaxProducersToAudit

public int getMaxProducersToAudit()
Specified by:
getMaxProducersToAudit in interface Destination
Returns:
the maxProducersToAudit

setMaxProducersToAudit

public void setMaxProducersToAudit(int maxProducersToAudit)
Specified by:
setMaxProducersToAudit in interface Destination
Parameters:
maxProducersToAudit - the maxProducersToAudit to set

getMaxAuditDepth

public int getMaxAuditDepth()
Specified by:
getMaxAuditDepth in interface Destination
Returns:
the maxAuditDepth

setMaxAuditDepth

public void setMaxAuditDepth(int maxAuditDepth)
Specified by:
setMaxAuditDepth in interface Destination
Parameters:
maxAuditDepth - the maxAuditDepth to set

isEnableAudit

public boolean isEnableAudit()
Specified by:
isEnableAudit in interface Destination
Returns:
the enableAudit

setEnableAudit

public void setEnableAudit(boolean enableAudit)
Specified by:
setEnableAudit in interface Destination
Parameters:
enableAudit - the enableAudit to set

addProducer

public void addProducer(ConnectionContext context,
                        ProducerInfo info)
                 throws Exception
Specified by:
addProducer in interface Destination
Throws:
Exception

removeProducer

public void removeProducer(ConnectionContext context,
                           ProducerInfo info)
                    throws Exception
Specified by:
removeProducer in interface Destination
Throws:
Exception

getMemoryUsage

public final MemoryUsage getMemoryUsage()
Specified by:
getMemoryUsage in interface Destination

getDestinationStatistics

public DestinationStatistics getDestinationStatistics()
Specified by:
getDestinationStatistics in interface Destination

getActiveMQDestination

public ActiveMQDestination getActiveMQDestination()
Specified by:
getActiveMQDestination in interface Destination

getName

public final String getName()
Specified by:
getName in interface Destination

getMessageStore

public final MessageStore getMessageStore()
Specified by:
getMessageStore in interface Destination

isActive

public final boolean isActive()
Specified by:
isActive in interface Destination

getMaxPageSize

public int getMaxPageSize()
Specified by:
getMaxPageSize in interface Destination

setMaxPageSize

public void setMaxPageSize(int maxPageSize)
Specified by:
setMaxPageSize in interface Destination

getMaxBrowsePageSize

public int getMaxBrowsePageSize()
Specified by:
getMaxBrowsePageSize in interface Destination

setMaxBrowsePageSize

public void setMaxBrowsePageSize(int maxPageSize)
Specified by:
setMaxBrowsePageSize in interface Destination

isUseCache

public boolean isUseCache()
Specified by:
isUseCache in interface Destination

setUseCache

public void setUseCache(boolean useCache)
Specified by:
setUseCache in interface Destination

getMinimumMessageSize

public int getMinimumMessageSize()
Specified by:
getMinimumMessageSize in interface Destination

setMinimumMessageSize

public void setMinimumMessageSize(int minimumMessageSize)
Specified by:
setMinimumMessageSize in interface Destination

isLazyDispatch

public boolean isLazyDispatch()
Specified by:
isLazyDispatch in interface Destination
Returns:
true if lazyDispatch is enabled

setLazyDispatch

public void setLazyDispatch(boolean lazyDispatch)
Description copied from interface: Destination
set the lazy dispatch - default is false

Specified by:
setLazyDispatch in interface Destination

getDestinationSequenceId

protected long getDestinationSequenceId()

isAdvisoryForSlowConsumers

public boolean isAdvisoryForSlowConsumers()
Returns:
the advisoryForSlowConsumers

setAdvisoryForSlowConsumers

public void setAdvisoryForSlowConsumers(boolean advisoryForSlowConsumers)
Parameters:
advisoryForSlowConsumers - the advisoryForSlowConsumers to set

isAdvisoryForDiscardingMessages

public boolean isAdvisoryForDiscardingMessages()
Returns:
the advisoryForDiscardingMessages

setAdvisoryForDiscardingMessages

public void setAdvisoryForDiscardingMessages(boolean advisoryForDiscardingMessages)
Parameters:
advisoryForDiscardingMessages - the advisoryForDiscardingMessages to set

isAdvisoryWhenFull

public boolean isAdvisoryWhenFull()
Returns:
the advisoryWhenFull

setAdvisoryWhenFull

public void setAdvisoryWhenFull(boolean advisoryWhenFull)
Parameters:
advisoryWhenFull - the advisoryWhenFull to set

isAdvisoryForDelivery

public boolean isAdvisoryForDelivery()
Returns:
the advisoryForDelivery

setAdvisoryForDelivery

public void setAdvisoryForDelivery(boolean advisoryForDelivery)
Parameters:
advisoryForDelivery - the advisoryForDelivery to set

isAdvisoryForConsumed

public boolean isAdvisoryForConsumed()
Returns:
the advisoryForConsumed

setAdvisoryForConsumed

public void setAdvisoryForConsumed(boolean advisoryForConsumed)
Parameters:
advisoryForConsumed - the advisoryForConsumed to set

isAdvisdoryForFastProducers

public boolean isAdvisdoryForFastProducers()
Returns:
the advisdoryForFastProducers

setAdvisdoryForFastProducers

public void setAdvisdoryForFastProducers(boolean advisdoryForFastProducers)
Parameters:
advisdoryForFastProducers - the advisdoryForFastProducers to set

isSendAdvisoryIfNoConsumers

public boolean isSendAdvisoryIfNoConsumers()

setSendAdvisoryIfNoConsumers

public void setSendAdvisoryIfNoConsumers(boolean sendAdvisoryIfNoConsumers)

getDeadLetterStrategy

public DeadLetterStrategy getDeadLetterStrategy()
Specified by:
getDeadLetterStrategy in interface Destination
Returns:
the dead letter strategy

setDeadLetterStrategy

public void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy)
set the dead letter strategy

Parameters:
deadLetterStrategy -

messageConsumed

public void messageConsumed(ConnectionContext context,
                            MessageReference messageReference)
called when message is consumed

Specified by:
messageConsumed in interface Destination
Parameters:
context -
messageReference -

messageDelivered

public void messageDelivered(ConnectionContext context,
                             MessageReference messageReference)
Called when message is delivered to the broker

Specified by:
messageDelivered in interface Destination
Parameters:
context -
messageReference -

messageDiscarded

public void messageDiscarded(ConnectionContext context,
                             MessageReference messageReference)
Called when a message is discarded - e.g. running low on memory This will happen only if the policy is enabled - e.g. non durable topics

Specified by:
messageDiscarded in interface Destination
Parameters:
context -
messageReference -

slowConsumer

public void slowConsumer(ConnectionContext context,
                         Subscription subs)
Called when there is a slow consumer

Specified by:
slowConsumer in interface Destination
Parameters:
context -
subs -

fastProducer

public void fastProducer(ConnectionContext context,
                         ProducerInfo producerInfo)
Called to notify a producer is too fast

Specified by:
fastProducer in interface Destination
Parameters:
context -
producerInfo -

isFull

public void isFull(ConnectionContext context,
                   Usage usage)
Called when a Usage reaches a limit

Specified by:
isFull in interface Destination
Parameters:
context -
usage -

dispose

public void dispose(ConnectionContext context)
             throws IOException
Specified by:
dispose in interface Destination
Throws:
IOException

onMessageWithNoConsumers

protected void onMessageWithNoConsumers(ConnectionContext context,
                                        Message message)
                                 throws Exception
Provides a hook to allow messages with no consumer to be processed in some way - such as to send to a dead letter queue or something..

Throws:
Exception

processDispatchNotification

public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
                                 throws Exception
Description copied from interface: Destination
called on Queues in slave mode to allow dispatch to follow subscription choice of master

Specified by:
processDispatchNotification in interface Destination
Throws:
Exception


Copyright © 2009. All Rights Reserved.