org.apache.activemq.broker.region.policy.UniquePropertyMessageEvictionStrategy

Here are the examples of the java api class org.apache.activemq.broker.region.policy.UniquePropertyMessageEvictionStrategy taken from open source projects.

1. UniquePropertyMessageEvictionStrategyTest#createBroker()

View license
@Override
protected BrokerService createBroker() throws Exception {
    BrokerService broker = super.createBroker();
    final List<PolicyEntry> policyEntries = new ArrayList<>();
    final PolicyEntry entry = new PolicyEntry();
    entry.setTopic(">");
    entry.setAdvisoryForDiscardingMessages(true);
    entry.setTopicPrefetch(1);
    ConstantPendingMessageLimitStrategy pendingMessageLimitStrategy = new ConstantPendingMessageLimitStrategy();
    pendingMessageLimitStrategy.setLimit(10);
    entry.setPendingMessageLimitStrategy(pendingMessageLimitStrategy);
    UniquePropertyMessageEvictionStrategy messageEvictionStrategy = new UniquePropertyMessageEvictionStrategy();
    messageEvictionStrategy.setPropertyName("sequenceI");
    entry.setMessageEvictionStrategy(messageEvictionStrategy);
    // let evicted messages disappear
    entry.setDeadLetterStrategy(null);
    policyEntries.add(entry);
    final PolicyMap policyMap = new PolicyMap();
    policyMap.setPolicyEntries(policyEntries);
    broker.setDestinationPolicy(policyMap);
    return broker;
}