Class Topic
- java.lang.Object
-
- org.apache.activemq.broker.region.BaseDestination
-
- org.apache.activemq.broker.region.Topic
-
- All Implemented Interfaces:
Destination
,org.apache.activemq.command.Message.MessageDestination
,org.apache.activemq.Service
,org.apache.activemq.thread.Task
- Direct Known Subclasses:
TempTopic
public class Topic extends BaseDestination implements org.apache.activemq.thread.Task
The Topic is a destination that sends a copy of a message to every active Subscription registered.
-
-
Field Summary
Fields Modifier and Type Field Description protected 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, DUPLICATE_FROM_STORE_MSG_PREFIX, EXPIRE_MESSAGE_PERIOD, expireMessagesPeriod, lastBlockedProducerWarnTime, MAX_AUDIT_DEPTH, MAX_BROWSE_PAGE_SIZE, MAX_PAGE_SIZE, MAX_PRODUCERS_TO_AUDIT, memoryUsage, regionBroker, scheduler, started, store, storeUsageHighWaterMark, systemUsage
-
Fields inherited from interface org.apache.activemq.broker.region.Destination
DEFAULT_BLOCKED_PRODUCER_WARNING_INTERVAL, DEFAULT_DEAD_LETTER_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description Topic(BrokerService brokerService, org.apache.activemq.command.ActiveMQDestination destination, TopicMessageStore store, DestinationStatistics parentStats, org.apache.activemq.thread.TaskRunnerFactory taskFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge(ConnectionContext context, Subscription sub, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node)
void
activate(ConnectionContext context, DurableTopicSubscription subscription)
void
addSubscription(ConnectionContext context, Subscription sub)
org.apache.activemq.command.Message[]
browse()
void
clearPendingMessages(int pendingAdditionsCount)
force a reread of the store - after transaction recovery completionvoid
deactivate(ConnectionContext context, DurableTopicSubscription sub, List<org.apache.activemq.broker.region.MessageReference> dispatched)
void
deleteSubscription(ConnectionContext context, SubscriptionKey key)
protected void
dispatch(ConnectionContext context, org.apache.activemq.command.Message message)
void
doBrowse(List<org.apache.activemq.command.Message> browseList, int max)
void
gc()
List<Subscription>
getConsumers()
DispatchPolicy
getDispatchPolicy()
Map<SubscriptionKey,DurableTopicSubscription>
getDurableTopicSubs()
protected org.slf4j.Logger
getLog()
SubscriptionRecoveryPolicy
getSubscriptionRecoveryPolicy()
void
initialize()
initialize the destinationprotected boolean
isOptimizeStorage()
boolean
iterate()
org.apache.activemq.command.Message
loadMessage(org.apache.activemq.command.MessageId messageId)
boolean
lock(org.apache.activemq.broker.region.MessageReference node, LockOwner sub)
void
messageExpired(ConnectionContext context, Subscription subs, org.apache.activemq.broker.region.MessageReference reference)
Inform the Destination a message has expiredvoid
recoverRetroactiveMessages(ConnectionContext context, Subscription subscription)
void
removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId)
void
send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message)
void
setDispatchPolicy(DispatchPolicy dispatchPolicy)
void
setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy recoveryPolicy)
void
start()
void
stop()
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, convertToNonRangedAck, createConnectionContext, dispose, duplicateFromStore, fastProducer, getActiveMQDestination, getBlockedProducerWarningInterval, getCursorMemoryHighWaterMark, getDeadLetterStrategy, getDestinationSequenceId, getDestinationStatistics, getExpireMessagesPeriod, getInactiveTimeoutBeforeGC, getMaxAuditDepth, getMaxBrowsePageSize, getMaxExpirePageSize, getMaxPageSize, getMaxProducersToAudit, getMemoryUsage, getMessageStore, getMinimumMessageSize, getName, getOptimizeMessageStoreInFlightLimit, getSlowConsumerStrategy, getStoreUsageHighWaterMark, getSystemUsage, getTempUsage, hasRegularConsumers, isActive, isAdvisoryForConsumed, isAdvisoryForDelivery, isAdvisoryForDiscardingMessages, isAdvisoryForFastProducers, isAdvisoryForSlowConsumers, isAdvisoryWhenFull, isAlwaysRetroactive, isDisposed, isDLQ, isDoOptimzeMessageStorage, isEnableAudit, isFlowControlLogRequired, isFull, isGcIfInactive, isGcWithNetworkConsumers, isIncludeBodyForAdvisory, isLazyDispatch, isPersistJMSRedelivered, isPrioritizedMessages, isProducerFlowControl, isReduceMemoryFootprint, isSendAdvisoryIfNoConsumers, isSendDuplicateFromStoreToDLQ, isUseCache, markForGC, messageConsumed, messageDelivered, messageDiscarded, onMessageWithNoConsumers, processDispatchNotification, removeProducer, setAdvisoryForConsumed, setAdvisoryForDelivery, setAdvisoryForDiscardingMessages, setAdvisoryForFastProducers, setAdvisoryForSlowConsumers, setAdvisoryWhenFull, setAlwaysRetroactive, setBlockedProducerWarningInterval, setCursorMemoryHighWaterMark, setDeadLetterStrategy, setDoOptimzeMessageStorage, setEnableAudit, setExpireMessagesPeriod, setGcIfInactive, setGcWithNetworkConsumers, setInactiveTimeoutBeforeGC, setIncludeBodyForAdvisory, setLazyDispatch, setMaxAuditDepth, setMaxBrowsePageSize, setMaxExpirePageSize, setMaxPageSize, setMaxProducersToAudit, setMemoryUsage, setMinimumMessageSize, setOptimizeMessageStoreInFlightLimit, setPersistJMSRedelivered, setPrioritizedMessages, setProducerFlowControl, setReduceMemoryFootprint, setSendAdvisoryIfNoConsumers, setSendDuplicateFromStoreToDLQ, setSlowConsumerStrategy, setStoreUsageHighWaterMark, setUseCache, slowConsumer, waitForSpace, waitForSpace
-
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
consumers
protected final CopyOnWriteArrayList<Subscription> consumers
-
-
Constructor Detail
-
Topic
public Topic(BrokerService brokerService, org.apache.activemq.command.ActiveMQDestination destination, TopicMessageStore store, DestinationStatistics parentStats, org.apache.activemq.thread.TaskRunnerFactory taskFactory) throws Exception
- Throws:
Exception
-
-
Method Detail
-
initialize
public void initialize() throws Exception
Description copied from class:BaseDestination
initialize the destination- Overrides:
initialize
in classBaseDestination
- Throws:
Exception
-
getConsumers
public List<Subscription> getConsumers()
- Specified by:
getConsumers
in interfaceDestination
- Specified by:
getConsumers
in classBaseDestination
-
lock
public boolean lock(org.apache.activemq.broker.region.MessageReference node, LockOwner sub)
-
addSubscription
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception
- Specified by:
addSubscription
in interfaceDestination
- Overrides:
addSubscription
in classBaseDestination
- Throws:
Exception
-
removeSubscription
public void removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId) throws Exception
- Specified by:
removeSubscription
in interfaceDestination
- Overrides:
removeSubscription
in classBaseDestination
- Throws:
Exception
-
deleteSubscription
public void deleteSubscription(ConnectionContext context, SubscriptionKey key) throws Exception
- Throws:
Exception
-
activate
public void activate(ConnectionContext context, DurableTopicSubscription subscription) throws Exception
- Throws:
Exception
-
deactivate
public void deactivate(ConnectionContext context, DurableTopicSubscription sub, List<org.apache.activemq.broker.region.MessageReference> dispatched) throws Exception
- Throws:
Exception
-
recoverRetroactiveMessages
public void recoverRetroactiveMessages(ConnectionContext context, Subscription subscription) throws Exception
- Throws:
Exception
-
send
public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message) throws Exception
- Specified by:
send
in interfaceDestination
- Throws:
Exception
-
acknowledge
public void acknowledge(ConnectionContext context, Subscription sub, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node) throws IOException
- Specified by:
acknowledge
in interfaceDestination
- Throws:
IOException
-
gc
public void gc()
- Specified by:
gc
in interfaceDestination
-
loadMessage
public org.apache.activemq.command.Message loadMessage(org.apache.activemq.command.MessageId messageId) throws IOException
- Throws:
IOException
-
start
public void start() throws Exception
- Specified by:
start
in interfaceorg.apache.activemq.Service
- Throws:
Exception
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceorg.apache.activemq.Service
- Throws:
Exception
-
browse
public org.apache.activemq.command.Message[] browse()
- Specified by:
browse
in interfaceDestination
-
doBrowse
public void doBrowse(List<org.apache.activemq.command.Message> browseList, int max)
-
iterate
public boolean iterate()
- Specified by:
iterate
in interfaceorg.apache.activemq.thread.Task
-
getDispatchPolicy
public DispatchPolicy getDispatchPolicy()
-
setDispatchPolicy
public void setDispatchPolicy(DispatchPolicy dispatchPolicy)
-
getSubscriptionRecoveryPolicy
public SubscriptionRecoveryPolicy getSubscriptionRecoveryPolicy()
-
setSubscriptionRecoveryPolicy
public void setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy recoveryPolicy)
-
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 interfaceDestination
-
dispatch
protected void dispatch(ConnectionContext context, org.apache.activemq.command.Message message) throws Exception
- Throws:
Exception
-
messageExpired
public void messageExpired(ConnectionContext context, Subscription subs, org.apache.activemq.broker.region.MessageReference reference)
Description copied from interface:Destination
Inform the Destination a message has expired- Specified by:
messageExpired
in interfaceDestination
-
getLog
protected org.slf4j.Logger getLog()
- Specified by:
getLog
in classBaseDestination
-
isOptimizeStorage
protected boolean isOptimizeStorage()
-
clearPendingMessages
public void clearPendingMessages(int pendingAdditionsCount)
force a reread of the store - after transaction recovery completion- Specified by:
clearPendingMessages
in interfaceDestination
- Parameters:
pendingAdditionsCount
-
-
getDurableTopicSubs
public Map<SubscriptionKey,DurableTopicSubscription> getDurableTopicSubs()
-
-