ConstantPendingMessageLimitStrategy pendingMessageLimitStrategy = new ConstantPendingMessageLimitStrategy();
pendingMessageLimitStrategy.setLimit(pendingMessageLimit);
entry.setPendingMessageLimitStrategy(pendingMessageLimitStrategy);
// to keep the limit in check and up to date rather than just the first few, evict some
OldestMessageEvictionStrategy messageEvictionStrategy = new OldestMessageEvictionStrategy();
messageEvictionStrategy.setEvictExpiredMessagesHighWatermark(100);
entry.setMessageEvictionStrategy(messageEvictionStrategy);
// let evicted messaged disappear
entry.setDeadLetterStrategy(null);
policyEntries.add(entry);