Method from org.apache.activemq.broker.region.BaseDestination Detail: |
public void addProducer(ConnectionContext context,
ProducerInfo info) throws Exception {
destinationStatistics.getProducers().increment();
}
|
public void dispose(ConnectionContext context) throws IOException {
if (this.store != null) {
this.store.removeAllMessages(context);
this.store.dispose(context);
}
this.destinationStatistics.setParent(null);
this.memoryUsage.stop();
}
|
public void fastProducer(ConnectionContext context,
ProducerInfo producerInfo) {
if (advisdoryForFastProducers) {
broker.fastProducer(context, producerInfo);
}
}
Called to notify a producer is too fast |
public ActiveMQDestination getActiveMQDestination() {
return destination;
}
|
public long getBlockedProducerWarningInterval() {
return blockedProducerWarningInterval;
}
|
public int getCursorMemoryHighWaterMark() {
return this.cursorMemoryHighWaterMark;
}
|
public DeadLetterStrategy getDeadLetterStrategy() {
return deadLetterStrategy;
}
|
protected long getDestinationSequenceId() {
return regionBroker.getBrokerSequenceId();
}
|
public DestinationStatistics getDestinationStatistics() {
return destinationStatistics;
}
|
public long getExpireMessagesPeriod() {
return expireMessagesPeriod;
}
|
public int getMaxAuditDepth() {
return maxAuditDepth;
}
|
public int getMaxBrowsePageSize() {
return this.maxBrowsePageSize;
}
|
public int getMaxExpirePageSize() {
return this.maxExpirePageSize;
}
|
public int getMaxPageSize() {
return maxPageSize;
}
|
public int getMaxProducersToAudit() {
return maxProducersToAudit;
}
|
public final MemoryUsage getMemoryUsage() {
return memoryUsage;
}
|
public final MessageStore getMessageStore() {
return store;
}
|
public int getMinimumMessageSize() {
return minimumMessageSize;
}
|
public final String getName() {
return getActiveMQDestination().getPhysicalName();
}
|
public void initialize() throws Exception {
// Let the store know what usage manager we are using so that he can
// flush messages to disk when usage gets high.
if (store != null) {
store.setMemoryUsage(this.memoryUsage);
}
}
initialize the destination |
public final boolean isActive() {
return destinationStatistics.getConsumers().getCount() != 0 || destinationStatistics.getProducers().getCount() != 0;
}
|
public boolean isAdvisdoryForFastProducers() {
return advisdoryForFastProducers;
}
|
public boolean isAdvisoryForConsumed() {
return advisoryForConsumed;
}
|
public boolean isAdvisoryForDelivery() {
return advisoryForDelivery;
}
|
public boolean isAdvisoryForDiscardingMessages() {
return advisoryForDiscardingMessages;
}
|
public boolean isAdvisoryForSlowConsumers() {
return advisoryForSlowConsumers;
}
|
public boolean isAdvisoryWhenFull() {
return advisoryWhenFull;
}
|
public boolean isEnableAudit() {
return enableAudit;
}
|
public void isFull(ConnectionContext context,
Usage usage) {
if (advisoryWhenFull) {
broker.isFull(context, this, usage);
}
}
Called when a Usage reaches a limit |
public boolean isLazyDispatch() {
return lazyDispatch;
}
|
public boolean isProducerFlowControl() {
return producerFlowControl;
}
|
public boolean isSendAdvisoryIfNoConsumers() {
return sendAdvisoryIfNoConsumers;
}
|
public boolean isUseCache() {
return useCache;
}
|
public void messageConsumed(ConnectionContext context,
MessageReference messageReference) {
if (advisoryForConsumed) {
broker.messageConsumed(context, messageReference);
}
}
called when message is consumed |
public void messageDelivered(ConnectionContext context,
MessageReference messageReference) {
if (advisoryForDelivery) {
broker.messageDelivered(context, messageReference);
}
}
Called when message is delivered to the broker |
public void messageDiscarded(ConnectionContext context,
MessageReference messageReference) {
if (advisoryForDiscardingMessages) {
broker.messageDiscarded(context, 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 |
protected void onMessageWithNoConsumers(ConnectionContext context,
Message msg) throws Exception {
if (!msg.isPersistent()) {
if (isSendAdvisoryIfNoConsumers()) {
// allow messages with no consumers to be dispatched to a dead
// letter queue
if (destination.isQueue() || !AdvisorySupport.isAdvisoryTopic(destination)) {
Message message = msg.copy();
// The original destination and transaction id do not get
// filled when the message is first sent,
// it is only populated if the message is routed to another
// destination like the DLQ
if (message.getOriginalDestination() != null) {
message.setOriginalDestination(message.getDestination());
}
if (message.getOriginalTransactionId() != null) {
message.setOriginalTransactionId(message.getTransactionId());
}
ActiveMQTopic advisoryTopic;
if (destination.isQueue()) {
advisoryTopic = AdvisorySupport.getNoQueueConsumersAdvisoryTopic(destination);
} else {
advisoryTopic = AdvisorySupport.getNoTopicConsumersAdvisoryTopic(destination);
}
message.setDestination(advisoryTopic);
message.setTransactionId(null);
// Disable flow control for this since since we don't want
// to block.
boolean originalFlowControl = context.isProducerFlowControl();
try {
context.setProducerFlowControl(false);
ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
producerExchange.setMutable(false);
producerExchange.setConnectionContext(context);
producerExchange.setProducerState(new ProducerState(new ProducerInfo()));
context.getBroker().send(producerExchange, message);
} finally {
context.setProducerFlowControl(originalFlowControl);
}
}
}
}
}
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.. |
public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception {
}
|
public void removeProducer(ConnectionContext context,
ProducerInfo info) throws Exception {
destinationStatistics.getProducers().decrement();
}
|
public void setAdvisdoryForFastProducers(boolean advisdoryForFastProducers) {
this.advisdoryForFastProducers = advisdoryForFastProducers;
}
|
public void setAdvisoryForConsumed(boolean advisoryForConsumed) {
this.advisoryForConsumed = advisoryForConsumed;
}
|
public void setAdvisoryForDelivery(boolean advisoryForDelivery) {
this.advisoryForDelivery = advisoryForDelivery;
}
|
public void setAdvisoryForDiscardingMessages(boolean advisoryForDiscardingMessages) {
this.advisoryForDiscardingMessages = advisoryForDiscardingMessages;
}
|
public void setAdvisoryForSlowConsumers(boolean advisoryForSlowConsumers) {
this.advisoryForSlowConsumers = advisoryForSlowConsumers;
}
|
public void setAdvisoryWhenFull(boolean advisoryWhenFull) {
this.advisoryWhenFull = advisoryWhenFull;
}
|
public void setBlockedProducerWarningInterval(long blockedProducerWarningInterval) {
this.blockedProducerWarningInterval = blockedProducerWarningInterval;
}
Set's the interval at which warnings about producers being blocked by
resource usage will be triggered. Values of 0 or less will disable
warnings |
public void setCursorMemoryHighWaterMark(int cursorMemoryHighWaterMark) {
this.cursorMemoryHighWaterMark = cursorMemoryHighWaterMark;
}
|
public void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy) {
this.deadLetterStrategy = deadLetterStrategy;
}
set the dead letter strategy |
public void setEnableAudit(boolean enableAudit) {
this.enableAudit = enableAudit;
}
|
public void setExpireMessagesPeriod(long expireMessagesPeriod) {
this.expireMessagesPeriod = expireMessagesPeriod;
}
|
public void setLazyDispatch(boolean lazyDispatch) {
this.lazyDispatch = lazyDispatch;
}
|
public void setMaxAuditDepth(int maxAuditDepth) {
this.maxAuditDepth = maxAuditDepth;
}
|
public void setMaxBrowsePageSize(int maxPageSize) {
this.maxBrowsePageSize = maxPageSize;
}
|
public void setMaxExpirePageSize(int maxPageSize) {
this.maxExpirePageSize = maxPageSize;
}
|
public void setMaxPageSize(int maxPageSize) {
this.maxPageSize = maxPageSize;
}
|
public void setMaxProducersToAudit(int maxProducersToAudit) {
this.maxProducersToAudit = maxProducersToAudit;
}
|
public void setMinimumMessageSize(int minimumMessageSize) {
this.minimumMessageSize = minimumMessageSize;
}
|
public void setProducerFlowControl(boolean producerFlowControl) {
this.producerFlowControl = producerFlowControl;
}
|
public void setSendAdvisoryIfNoConsumers(boolean sendAdvisoryIfNoConsumers) {
this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
}
|
public void setUseCache(boolean useCache) {
this.useCache = useCache;
}
|
public void slowConsumer(ConnectionContext context,
Subscription subs) {
if (advisoryForSlowConsumers) {
broker.slowConsumer(context, this, subs);
}
}
Called when there is a slow consumer |