Interface MessageEvictionStrategy
- All Known Implementing Classes:
MessageEvictionStrategySupport, OldestMessageEvictionStrategy, OldestMessageWithLowestPriorityEvictionStrategy, UniquePropertyMessageEvictionStrategy
public interface MessageEvictionStrategy
A strategy for evicting messages from slow consumers.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.activemq.broker.region.MessageReference[]evictMessages(LinkedList messages) Find the message reference in the given list with oldest messages at the front and newer messages at the endintREturns the high water mark on which we will eagerly evict expired messages from RAMbooleanReturns whether the eager expired-message scan is enabled.
-
Method Details
-
evictMessages
org.apache.activemq.broker.region.MessageReference[] evictMessages(LinkedList messages) throws IOException Find the message reference in the given list with oldest messages at the front and newer messages at the end- Returns:
- the message that has been evicted.
- Throws:
IOException- if an exception occurs such as reading a message content (but should not ever happen as usually all the messages will be in RAM when this method is called).
-
getEvictExpiredMessagesHighWatermark
int getEvictExpiredMessagesHighWatermark()REturns the high water mark on which we will eagerly evict expired messages from RAM -
isExpiryCheckEnabled
boolean isExpiryCheckEnabled()Returns whether the eager expired-message scan is enabled.When
false, the O(n) scan insideTopicSubscription.add(MessageReference)is skipped entirely. Set tofalsewhen messages carry no TTL, or when the scan cost outweighs the benefit of eagerly evicting expired messages from slow-consumer buffers.See
MessageEvictionStrategySupportfor the default implementation that returnstrue.- Returns:
trueif the expiry scan is enabled (default),falseif skipped
-