org.apache.activemq.broker.region
Class Topic

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

public class Topic
extends BaseDestination
implements Task

The Topic is a destination that sends a copy of a message to every active Subscription registered.


Field Summary
protected  java.util.concurrent.CopyOnWriteArrayList<Subscription> consumers
           
protected static org.slf4j.Logger LOG
           
 
Fields inherited from class org.apache.activemq.broker.region.BaseDestination
blockedProducerWarningInterval, broker, brokerService, cursorMemoryHighWaterMark, deadLetterStrategy, DEFAULT_INACTIVE_TIMEOUT_BEFORE_GC, destination, destinationStatistics, EXPIRE_MESSAGE_PERIOD, expireMessagesPeriod, MAX_AUDIT_DEPTH, MAX_BROWSE_PAGE_SIZE, MAX_PAGE_SIZE, MAX_PRODUCERS_TO_AUDIT, memoryUsage, regionBroker, scheduler, store, storeUsageHighWaterMark, systemUsage, warnOnProducerFlowControl
 
Fields inherited from interface org.apache.activemq.broker.region.Destination
DEFAULT_BLOCKED_PRODUCER_WARNING_INTERVAL, DEFAULT_DEAD_LETTER_STRATEGY
 
Constructor Summary
Topic(BrokerService brokerService, ActiveMQDestination destination, TopicMessageStore store, DestinationStatistics parentStats, TaskRunnerFactory taskFactory)
           
 
Method Summary
 void acknowledge(ConnectionContext context, Subscription sub, MessageAck ack, MessageReference node)
           
 void activate(ConnectionContext context, DurableTopicSubscription subscription)
           
 void addSubscription(ConnectionContext context, Subscription sub)
           
 Message[] browse()
           
 void deactivate(ConnectionContext context, DurableTopicSubscription sub)
           
 void deleteSubscription(ConnectionContext context, SubscriptionKey key)
           
protected  void dispatch(ConnectionContext context, Message message)
           
 void gc()
           
 java.util.List<Subscription> getConsumers()
           
 DispatchPolicy getDispatchPolicy()
           
protected  org.slf4j.Logger getLog()
           
 SubscriptionRecoveryPolicy getSubscriptionRecoveryPolicy()
           
 void initialize()
          initialize the destination
protected  boolean isOptimizeStorage()
           
 boolean iterate()
           
 Message loadMessage(MessageId messageId)
           
 boolean lock(MessageReference node, LockOwner sub)
           
 void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference)
          Inform the Destination a message has expired
protected  void recoverRetroactiveMessages(ConnectionContext context, Subscription subscription)
           
 void removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId)
           
 void send(ProducerBrokerExchange producerExchange, Message message)
           
 void setDispatchPolicy(DispatchPolicy dispatchPolicy)
           
 void setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy subscriptionRecoveryPolicy)
           
 void start()
           
 void stop()
           
 java.lang.String toString()
           
 void wakeup()
          optionally called by a Subscriber - to inform the Destination its ready for more messages
 
Methods inherited from class org.apache.activemq.broker.region.BaseDestination
addProducer, canGC, createConnectionContext, dispose, fastProducer, getActiveMQDestination, getBlockedProducerWarningInterval, getCursorMemoryHighWaterMark, getDeadLetterStrategy, getDestinationSequenceId, getDestinationStatistics, getExpireMessagesPeriod, getInactiveTimoutBeforeGC, getMaxAuditDepth, getMaxBrowsePageSize, getMaxExpirePageSize, getMaxPageSize, getMaxProducersToAudit, getMemoryUsage, getMessageStore, getMinimumMessageSize, getName, getOptimizeMessageStoreInFlightLimit, getSlowConsumerStrategy, getStoreUsageHighWaterMark, hasRegularConsumers, isActive, isAdvisdoryForFastProducers, isAdvisoryForConsumed, isAdvisoryForDelivery, isAdvisoryForDiscardingMessages, isAdvisoryForSlowConsumers, isAdvisoryWhenFull, isAlwaysRetroactive, isDisposed, isDoOptimzeMessageStorage, isEnableAudit, isFull, isGcIfInactive, isGcWithNetworkConsumers, isLazyDispatch, isPrioritizedMessages, isProducerFlowControl, isReduceMemoryFootprint, isSendAdvisoryIfNoConsumers, isUseCache, markForGC, messageConsumed, messageDelivered, messageDiscarded, onMessageWithNoConsumers, processDispatchNotification, removeProducer, setAdvisdoryForFastProducers, setAdvisoryForConsumed, setAdvisoryForDelivery, setAdvisoryForDiscardingMessages, setAdvisoryForSlowConsumers, setAdvisoryWhenFull, setAlwaysRetroactive, setBlockedProducerWarningInterval, setCursorMemoryHighWaterMark, setDeadLetterStrategy, setDoOptimzeMessageStorage, setEnableAudit, setExpireMessagesPeriod, setGcIfInactive, setGcWithNetworkConsumers, setInactiveTimoutBeforeGC, setLazyDispatch, setMaxAuditDepth, setMaxBrowsePageSize, setMaxExpirePageSize, setMaxPageSize, setMaxProducersToAudit, setMinimumMessageSize, setOptimizeMessageStoreInFlightLimit, setPrioritizedMessages, setProducerFlowControl, setReduceMemoryFootprint, setSendAdvisoryIfNoConsumers, setSlowConsumerStrategy, setStoreUsageHighWaterMark, setUseCache, slowConsumer, waitForSpace, waitForSpace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final org.slf4j.Logger LOG

consumers

protected final java.util.concurrent.CopyOnWriteArrayList<Subscription> consumers
Constructor Detail

Topic

public Topic(BrokerService brokerService,
             ActiveMQDestination destination,
             TopicMessageStore store,
             DestinationStatistics parentStats,
             TaskRunnerFactory taskFactory)
      throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: BaseDestination
initialize the destination

Overrides:
initialize in class BaseDestination
Throws:
java.lang.Exception

getConsumers

public java.util.List<Subscription> getConsumers()
Specified by:
getConsumers in interface Destination
Specified by:
getConsumers in class BaseDestination

lock

public boolean lock(MessageReference node,
                    LockOwner sub)

addSubscription

public void addSubscription(ConnectionContext context,
                            Subscription sub)
                     throws java.lang.Exception
Specified by:
addSubscription in interface Destination
Overrides:
addSubscription in class BaseDestination
Throws:
java.lang.Exception

removeSubscription

public void removeSubscription(ConnectionContext context,
                               Subscription sub,
                               long lastDeliveredSequenceId)
                        throws java.lang.Exception
Specified by:
removeSubscription in interface Destination
Overrides:
removeSubscription in class BaseDestination
Throws:
java.lang.Exception

deleteSubscription

public void deleteSubscription(ConnectionContext context,
                               SubscriptionKey key)
                        throws java.lang.Exception
Throws:
java.lang.Exception

activate

public void activate(ConnectionContext context,
                     DurableTopicSubscription subscription)
              throws java.lang.Exception
Throws:
java.lang.Exception

deactivate

public void deactivate(ConnectionContext context,
                       DurableTopicSubscription sub)
                throws java.lang.Exception
Throws:
java.lang.Exception

recoverRetroactiveMessages

protected void recoverRetroactiveMessages(ConnectionContext context,
                                          Subscription subscription)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

send

public void send(ProducerBrokerExchange producerExchange,
                 Message message)
          throws java.lang.Exception
Specified by:
send in interface Destination
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

acknowledge

public void acknowledge(ConnectionContext context,
                        Subscription sub,
                        MessageAck ack,
                        MessageReference node)
                 throws java.io.IOException
Specified by:
acknowledge in interface Destination
Throws:
java.io.IOException

gc

public void gc()
Specified by:
gc in interface Destination

loadMessage

public Message loadMessage(MessageId messageId)
                    throws java.io.IOException
Throws:
java.io.IOException

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

browse

public Message[] browse()
Specified by:
browse in interface Destination

iterate

public boolean iterate()
Specified by:
iterate in interface Task

getDispatchPolicy

public DispatchPolicy getDispatchPolicy()

setDispatchPolicy

public void setDispatchPolicy(DispatchPolicy dispatchPolicy)

getSubscriptionRecoveryPolicy

public SubscriptionRecoveryPolicy getSubscriptionRecoveryPolicy()

setSubscriptionRecoveryPolicy

public void setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy subscriptionRecoveryPolicy)

wakeup

public final void wakeup()
Description copied from interface: Destination
optionally called by a Subscriber - to inform the Destination its ready for more messages

Specified by:
wakeup in interface Destination

dispatch

protected void dispatch(ConnectionContext context,
                        Message message)
                 throws java.lang.Exception
Throws:
java.lang.Exception

messageExpired

public void messageExpired(ConnectionContext context,
                           Subscription subs,
                           MessageReference reference)
Description copied from interface: Destination
Inform the Destination a message has expired

Specified by:
messageExpired in interface Destination

getLog

protected org.slf4j.Logger getLog()
Specified by:
getLog in class BaseDestination

isOptimizeStorage

protected boolean isOptimizeStorage()


Copyright © 2005-2015. All Rights Reserved.