001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker.region.policy;
018
019import org.apache.activemq.ActiveMQPrefetchPolicy;
020import org.apache.activemq.broker.Broker;
021import org.apache.activemq.broker.region.BaseDestination;
022import org.apache.activemq.broker.region.Destination;
023import org.apache.activemq.broker.region.DurableTopicSubscription;
024import org.apache.activemq.broker.region.Queue;
025import org.apache.activemq.broker.region.QueueBrowserSubscription;
026import org.apache.activemq.broker.region.QueueSubscription;
027import org.apache.activemq.broker.region.Subscription;
028import org.apache.activemq.broker.region.Topic;
029import org.apache.activemq.broker.region.TopicSubscription;
030import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
031import org.apache.activemq.broker.region.group.GroupFactoryFinder;
032import org.apache.activemq.broker.region.group.MessageGroupMapFactory;
033import org.apache.activemq.filter.DestinationMapEntry;
034import org.apache.activemq.network.NetworkBridgeFilterFactory;
035import org.apache.activemq.usage.SystemUsage;
036import org.slf4j.Logger;
037import org.slf4j.LoggerFactory;
038
039/**
040 * Represents an entry in a {@link PolicyMap} for assigning policies to a
041 * specific destination or a hierarchical wildcard area of destinations.
042 *
043 * @org.apache.xbean.XBean
044 *
045 */
046public class PolicyEntry extends DestinationMapEntry {
047
048    private static final Logger LOG = LoggerFactory.getLogger(PolicyEntry.class);
049    private DispatchPolicy dispatchPolicy;
050    private SubscriptionRecoveryPolicy subscriptionRecoveryPolicy;
051    private boolean sendAdvisoryIfNoConsumers;
052    private DeadLetterStrategy deadLetterStrategy = Destination.DEFAULT_DEAD_LETTER_STRATEGY;
053    private PendingMessageLimitStrategy pendingMessageLimitStrategy;
054    private MessageEvictionStrategy messageEvictionStrategy;
055    private long memoryLimit;
056    private String messageGroupMapFactoryType = "cached";
057    private MessageGroupMapFactory messageGroupMapFactory;
058    private PendingQueueMessageStoragePolicy pendingQueuePolicy;
059    private PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy;
060    private PendingSubscriberMessageStoragePolicy pendingSubscriberPolicy;
061    private int maxProducersToAudit=BaseDestination.MAX_PRODUCERS_TO_AUDIT;
062    private int maxAuditDepth=BaseDestination.MAX_AUDIT_DEPTH;
063    private int maxQueueAuditDepth=BaseDestination.MAX_AUDIT_DEPTH;
064    private boolean enableAudit=true;
065    private boolean producerFlowControl = true;
066    private boolean alwaysRetroactive = false;
067    private long blockedProducerWarningInterval = Destination.DEFAULT_BLOCKED_PRODUCER_WARNING_INTERVAL;
068    private boolean optimizedDispatch=false;
069    private int maxPageSize=BaseDestination.MAX_PAGE_SIZE;
070    private int maxBrowsePageSize=BaseDestination.MAX_BROWSE_PAGE_SIZE;
071    private boolean useCache=true;
072    private long minimumMessageSize=1024;
073    private boolean useConsumerPriority=true;
074    private boolean strictOrderDispatch=false;
075    private boolean lazyDispatch=false;
076    private int timeBeforeDispatchStarts = 0;
077    private int consumersBeforeDispatchStarts = 0;
078    private boolean advisoryForSlowConsumers;
079    private boolean advisoryForFastProducers;
080    private boolean advisoryForDiscardingMessages;
081    private boolean advisoryWhenFull;
082    private boolean advisoryForDelivery;
083    private boolean advisoryForConsumed;
084    private long expireMessagesPeriod = BaseDestination.EXPIRE_MESSAGE_PERIOD;
085    private int maxExpirePageSize = BaseDestination.MAX_BROWSE_PAGE_SIZE;
086    private int queuePrefetch=ActiveMQPrefetchPolicy.DEFAULT_QUEUE_PREFETCH;
087    private int queueBrowserPrefetch=ActiveMQPrefetchPolicy.DEFAULT_QUEUE_BROWSER_PREFETCH;
088    private int topicPrefetch=ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH;
089    private int durableTopicPrefetch=ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH;
090    private boolean usePrefetchExtension = true;
091    private int cursorMemoryHighWaterMark = 70;
092    private int storeUsageHighWaterMark = 100;
093    private SlowConsumerStrategy slowConsumerStrategy;
094    private boolean prioritizedMessages;
095    private boolean allConsumersExclusiveByDefault;
096    private boolean gcInactiveDestinations;
097    private boolean gcWithNetworkConsumers;
098    private long inactiveTimeoutBeforeGC = BaseDestination.DEFAULT_INACTIVE_TIMEOUT_BEFORE_GC;
099    private boolean reduceMemoryFootprint;
100    private NetworkBridgeFilterFactory networkBridgeFilterFactory;
101    private boolean doOptimzeMessageStorage = true;
102    /*
103     * percentage of in-flight messages above which optimize message store is disabled
104     */
105    private int optimizeMessageStoreInFlightLimit = 10;
106    private boolean persistJMSRedelivered = false;
107
108
109    public void configure(Broker broker,Queue queue) {
110        baseConfiguration(broker,queue);
111        if (dispatchPolicy != null) {
112            queue.setDispatchPolicy(dispatchPolicy);
113        }
114        queue.setDeadLetterStrategy(getDeadLetterStrategy());
115        queue.setMessageGroupMapFactory(getMessageGroupMapFactory());
116        if (memoryLimit > 0) {
117            queue.getMemoryUsage().setLimit(memoryLimit);
118        }
119        if (pendingQueuePolicy != null) {
120            PendingMessageCursor messages = pendingQueuePolicy.getQueuePendingMessageCursor(broker,queue);
121            queue.setMessages(messages);
122        }
123
124        queue.setUseConsumerPriority(isUseConsumerPriority());
125        queue.setStrictOrderDispatch(isStrictOrderDispatch());
126        queue.setOptimizedDispatch(isOptimizedDispatch());
127        queue.setLazyDispatch(isLazyDispatch());
128        queue.setTimeBeforeDispatchStarts(getTimeBeforeDispatchStarts());
129        queue.setConsumersBeforeDispatchStarts(getConsumersBeforeDispatchStarts());
130        queue.setAllConsumersExclusiveByDefault(isAllConsumersExclusiveByDefault());
131        queue.setPersistJMSRedelivered(isPersistJMSRedelivered());
132    }
133
134    public void update(Queue queue) {
135        baseUpdate(queue);
136        if (memoryLimit > 0) {
137            queue.getMemoryUsage().setLimit(memoryLimit);
138        }
139        queue.setUseConsumerPriority(isUseConsumerPriority());
140        queue.setStrictOrderDispatch(isStrictOrderDispatch());
141        queue.setOptimizedDispatch(isOptimizedDispatch());
142        queue.setLazyDispatch(isLazyDispatch());
143        queue.setTimeBeforeDispatchStarts(getTimeBeforeDispatchStarts());
144        queue.setConsumersBeforeDispatchStarts(getConsumersBeforeDispatchStarts());
145        queue.setAllConsumersExclusiveByDefault(isAllConsumersExclusiveByDefault());
146        queue.setPersistJMSRedelivered(isPersistJMSRedelivered());
147    }
148
149    public void configure(Broker broker,Topic topic) {
150        baseConfiguration(broker,topic);
151        if (dispatchPolicy != null) {
152            topic.setDispatchPolicy(dispatchPolicy);
153        }
154        topic.setDeadLetterStrategy(getDeadLetterStrategy());
155        if (subscriptionRecoveryPolicy != null) {
156            SubscriptionRecoveryPolicy srp = subscriptionRecoveryPolicy.copy();
157            srp.setBroker(broker);
158            topic.setSubscriptionRecoveryPolicy(srp);
159        }
160        if (memoryLimit > 0) {
161            topic.getMemoryUsage().setLimit(memoryLimit);
162        }
163        topic.setLazyDispatch(isLazyDispatch());
164    }
165
166    public void update(Topic topic) {
167        baseUpdate(topic);
168        if (memoryLimit > 0) {
169            topic.getMemoryUsage().setLimit(memoryLimit);
170        }
171        topic.setLazyDispatch(isLazyDispatch());
172    }
173
174    // attributes that can change on the fly
175    public void baseUpdate(BaseDestination destination) {
176        destination.setProducerFlowControl(isProducerFlowControl());
177        destination.setAlwaysRetroactive(isAlwaysRetroactive());
178        destination.setBlockedProducerWarningInterval(getBlockedProducerWarningInterval());
179
180        destination.setMaxPageSize(getMaxPageSize());
181        destination.setMaxBrowsePageSize(getMaxBrowsePageSize());
182
183        destination.setMinimumMessageSize((int) getMinimumMessageSize());
184        destination.setMaxExpirePageSize(getMaxExpirePageSize());
185        destination.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
186        destination.setStoreUsageHighWaterMark(getStoreUsageHighWaterMark());
187
188        destination.setGcIfInactive(isGcInactiveDestinations());
189        destination.setGcWithNetworkConsumers(isGcWithNetworkConsumers());
190        destination.setInactiveTimeoutBeforeGC(getInactiveTimeoutBeforeGC());
191        destination.setReduceMemoryFootprint(isReduceMemoryFootprint());
192        destination.setDoOptimzeMessageStorage(isDoOptimzeMessageStorage());
193        destination.setOptimizeMessageStoreInFlightLimit(getOptimizeMessageStoreInFlightLimit());
194
195        destination.setAdvisoryForConsumed(isAdvisoryForConsumed());
196        destination.setAdvisoryForDelivery(isAdvisoryForDelivery());
197        destination.setAdvisoryForDiscardingMessages(isAdvisoryForDiscardingMessages());
198        destination.setAdvisoryForSlowConsumers(isAdvisoryForSlowConsumers());
199        destination.setAdvisoryForFastProducers(isAdvisoryForFastProducers());
200        destination.setAdvisoryWhenFull(isAdvisoryWhenFull());
201        destination.setSendAdvisoryIfNoConsumers(isSendAdvisoryIfNoConsumers());
202    }
203
204    public void baseConfiguration(Broker broker, BaseDestination destination) {
205        baseUpdate(destination);
206        destination.setEnableAudit(isEnableAudit());
207        destination.setMaxAuditDepth(getMaxQueueAuditDepth());
208        destination.setMaxProducersToAudit(getMaxProducersToAudit());
209        destination.setUseCache(isUseCache());
210        destination.setExpireMessagesPeriod(getExpireMessagesPeriod());
211        SlowConsumerStrategy scs = getSlowConsumerStrategy();
212        if (scs != null) {
213            scs.setBrokerService(broker);
214            scs.addDestination(destination);
215        }
216        destination.setSlowConsumerStrategy(scs);
217        destination.setPrioritizedMessages(isPrioritizedMessages());
218    }
219
220    public void configure(Broker broker, SystemUsage memoryManager, TopicSubscription subscription) {
221        configurePrefetch(subscription);
222        subscription.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
223        if (pendingMessageLimitStrategy != null) {
224            int value = pendingMessageLimitStrategy.getMaximumPendingMessageLimit(subscription);
225            int consumerLimit = subscription.getInfo().getMaximumPendingMessageLimit();
226            if (consumerLimit > 0) {
227                if (value < 0 || consumerLimit < value) {
228                    value = consumerLimit;
229                }
230            }
231            if (value >= 0) {
232                LOG.debug("Setting the maximumPendingMessages size to: {} for consumer: {}", value, subscription.getInfo().getConsumerId());
233                subscription.setMaximumPendingMessages(value);
234            }
235        }
236        if (messageEvictionStrategy != null) {
237            subscription.setMessageEvictionStrategy(messageEvictionStrategy);
238        }
239        if (pendingSubscriberPolicy != null) {
240            String name = subscription.getContext().getClientId() + "_" + subscription.getConsumerInfo().getConsumerId();
241            int maxBatchSize = subscription.getConsumerInfo().getPrefetchSize();
242            subscription.setMatched(pendingSubscriberPolicy.getSubscriberPendingMessageCursor(broker,name, maxBatchSize,subscription));
243        }
244        if (enableAudit) {
245            subscription.setEnableAudit(enableAudit);
246            subscription.setMaxProducersToAudit(maxProducersToAudit);
247            subscription.setMaxAuditDepth(maxAuditDepth);
248        }
249    }
250
251    public void configure(Broker broker, SystemUsage memoryManager, DurableTopicSubscription sub) {
252        String clientId = sub.getSubscriptionKey().getClientId();
253        String subName = sub.getSubscriptionKey().getSubscriptionName();
254        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
255        configurePrefetch(sub);
256        if (pendingDurableSubscriberPolicy != null) {
257            PendingMessageCursor cursor = pendingDurableSubscriberPolicy.getSubscriberPendingMessageCursor(broker,clientId, subName,sub.getPrefetchSize(),sub);
258            cursor.setSystemUsage(memoryManager);
259            sub.setPending(cursor);
260        }
261        int auditDepth = getMaxAuditDepth();
262        if (auditDepth == BaseDestination.MAX_AUDIT_DEPTH && this.isPrioritizedMessages()) {
263            sub.setMaxAuditDepth(auditDepth * 10);
264        } else {
265            sub.setMaxAuditDepth(auditDepth);
266        }
267        sub.setMaxProducersToAudit(getMaxProducersToAudit());
268        sub.setUsePrefetchExtension(isUsePrefetchExtension());
269    }
270
271    public void configure(Broker broker, SystemUsage memoryManager, QueueBrowserSubscription sub) {
272        configurePrefetch(sub);
273        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
274        sub.setUsePrefetchExtension(isUsePrefetchExtension());
275
276        // TODO
277        // We currently need an infinite audit because of the way that browser dispatch
278        // is done.  We should refactor the browsers to better handle message dispatch so
279        // we can remove this and perform a more efficient dispatch.
280        sub.setMaxProducersToAudit(Integer.MAX_VALUE);
281        sub.setMaxAuditDepth(Short.MAX_VALUE);
282
283        // part solution - dispatching to browsers needs to be restricted
284        sub.setMaxMessages(getMaxBrowsePageSize());
285    }
286
287    public void configure(Broker broker, SystemUsage memoryManager, QueueSubscription sub) {
288        configurePrefetch(sub);
289        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
290        sub.setUsePrefetchExtension(isUsePrefetchExtension());
291        sub.setMaxProducersToAudit(getMaxProducersToAudit());
292    }
293
294    public void configurePrefetch(Subscription subscription) {
295
296        final int currentPrefetch = subscription.getConsumerInfo().getPrefetchSize();
297        if (subscription instanceof QueueBrowserSubscription) {
298            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_QUEUE_BROWSER_PREFETCH) {
299                ((QueueBrowserSubscription) subscription).setPrefetchSize(getQueueBrowserPrefetch());
300            }
301        } else if (subscription instanceof QueueSubscription) {
302            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_QUEUE_PREFETCH) {
303                ((QueueSubscription) subscription).setPrefetchSize(getQueuePrefetch());
304            }
305        } else if (subscription instanceof DurableTopicSubscription) {
306            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH ||
307                    subscription.getConsumerInfo().getPrefetchSize() == ActiveMQPrefetchPolicy.DEFAULT_OPTIMIZE_DURABLE_TOPIC_PREFETCH) {
308                ((DurableTopicSubscription)subscription).setPrefetchSize(getDurableTopicPrefetch());
309            }
310        } else if (subscription instanceof TopicSubscription) {
311            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH) {
312                ((TopicSubscription) subscription).setPrefetchSize(getTopicPrefetch());
313            }
314        }
315        if (currentPrefetch != 0 && subscription.getPrefetchSize() == 0) {
316            // tell the sub so that it can issue a pull request
317            subscription.updateConsumerPrefetch(0);
318        }
319    }
320
321    // Properties
322    // -------------------------------------------------------------------------
323    public DispatchPolicy getDispatchPolicy() {
324        return dispatchPolicy;
325    }
326
327    public void setDispatchPolicy(DispatchPolicy policy) {
328        this.dispatchPolicy = policy;
329    }
330
331    public SubscriptionRecoveryPolicy getSubscriptionRecoveryPolicy() {
332        return subscriptionRecoveryPolicy;
333    }
334
335    public void setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy subscriptionRecoveryPolicy) {
336        this.subscriptionRecoveryPolicy = subscriptionRecoveryPolicy;
337    }
338
339    public boolean isSendAdvisoryIfNoConsumers() {
340        return sendAdvisoryIfNoConsumers;
341    }
342
343    /**
344     * Sends an advisory message if a non-persistent message is sent and there
345     * are no active consumers
346     */
347    public void setSendAdvisoryIfNoConsumers(boolean sendAdvisoryIfNoConsumers) {
348        this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
349    }
350
351    public DeadLetterStrategy getDeadLetterStrategy() {
352        return deadLetterStrategy;
353    }
354
355    /**
356     * Sets the policy used to determine which dead letter queue destination
357     * should be used
358     */
359    public void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy) {
360        this.deadLetterStrategy = deadLetterStrategy;
361    }
362
363    public PendingMessageLimitStrategy getPendingMessageLimitStrategy() {
364        return pendingMessageLimitStrategy;
365    }
366
367    /**
368     * Sets the strategy to calculate the maximum number of messages that are
369     * allowed to be pending on consumers (in addition to their prefetch sizes).
370     * Once the limit is reached, non-durable topics can then start discarding
371     * old messages. This allows us to keep dispatching messages to slow
372     * consumers while not blocking fast consumers and discarding the messages
373     * oldest first.
374     */
375    public void setPendingMessageLimitStrategy(PendingMessageLimitStrategy pendingMessageLimitStrategy) {
376        this.pendingMessageLimitStrategy = pendingMessageLimitStrategy;
377    }
378
379    public MessageEvictionStrategy getMessageEvictionStrategy() {
380        return messageEvictionStrategy;
381    }
382
383    /**
384     * Sets the eviction strategy used to decide which message to evict when the
385     * slow consumer needs to discard messages
386     */
387    public void setMessageEvictionStrategy(MessageEvictionStrategy messageEvictionStrategy) {
388        this.messageEvictionStrategy = messageEvictionStrategy;
389    }
390
391    public long getMemoryLimit() {
392        return memoryLimit;
393    }
394
395    /**
396     * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used
397     * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor"
398     */
399    public void setMemoryLimit(long memoryLimit) {
400        this.memoryLimit = memoryLimit;
401    }
402
403    public MessageGroupMapFactory getMessageGroupMapFactory() {
404        if (messageGroupMapFactory == null) {
405            try {
406            messageGroupMapFactory = GroupFactoryFinder.createMessageGroupMapFactory(getMessageGroupMapFactoryType());
407            }catch(Exception e){
408                LOG.error("Failed to create message group Factory ",e);
409            }
410        }
411        return messageGroupMapFactory;
412    }
413
414    /**
415     * Sets the factory used to create new instances of {MessageGroupMap} used
416     * to implement the <a
417     * href="http://activemq.apache.org/message-groups.html">Message Groups</a>
418     * functionality.
419     */
420    public void setMessageGroupMapFactory(MessageGroupMapFactory messageGroupMapFactory) {
421        this.messageGroupMapFactory = messageGroupMapFactory;
422    }
423
424
425    public String getMessageGroupMapFactoryType() {
426        return messageGroupMapFactoryType;
427    }
428
429    public void setMessageGroupMapFactoryType(String messageGroupMapFactoryType) {
430        this.messageGroupMapFactoryType = messageGroupMapFactoryType;
431    }
432
433
434    /**
435     * @return the pendingDurableSubscriberPolicy
436     */
437    public PendingDurableSubscriberMessageStoragePolicy getPendingDurableSubscriberPolicy() {
438        return this.pendingDurableSubscriberPolicy;
439    }
440
441    /**
442     * @param pendingDurableSubscriberPolicy the pendingDurableSubscriberPolicy
443     *                to set
444     */
445    public void setPendingDurableSubscriberPolicy(PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy) {
446        this.pendingDurableSubscriberPolicy = pendingDurableSubscriberPolicy;
447    }
448
449    /**
450     * @return the pendingQueuePolicy
451     */
452    public PendingQueueMessageStoragePolicy getPendingQueuePolicy() {
453        return this.pendingQueuePolicy;
454    }
455
456    /**
457     * @param pendingQueuePolicy the pendingQueuePolicy to set
458     */
459    public void setPendingQueuePolicy(PendingQueueMessageStoragePolicy pendingQueuePolicy) {
460        this.pendingQueuePolicy = pendingQueuePolicy;
461    }
462
463    /**
464     * @return the pendingSubscriberPolicy
465     */
466    public PendingSubscriberMessageStoragePolicy getPendingSubscriberPolicy() {
467        return this.pendingSubscriberPolicy;
468    }
469
470    /**
471     * @param pendingSubscriberPolicy the pendingSubscriberPolicy to set
472     */
473    public void setPendingSubscriberPolicy(PendingSubscriberMessageStoragePolicy pendingSubscriberPolicy) {
474        this.pendingSubscriberPolicy = pendingSubscriberPolicy;
475    }
476
477    /**
478     * @return true if producer flow control enabled
479     */
480    public boolean isProducerFlowControl() {
481        return producerFlowControl;
482    }
483
484    /**
485     * @param producerFlowControl
486     */
487    public void setProducerFlowControl(boolean producerFlowControl) {
488        this.producerFlowControl = producerFlowControl;
489    }
490
491    /**
492     * @return true if topic is always retroactive
493     */
494    public boolean isAlwaysRetroactive() {
495        return alwaysRetroactive;
496    }
497
498    /**
499     * @param alwaysRetroactive
500     */
501    public void setAlwaysRetroactive(boolean alwaysRetroactive) {
502        this.alwaysRetroactive = alwaysRetroactive;
503    }
504
505
506    /**
507     * Set's the interval at which warnings about producers being blocked by
508     * resource usage will be triggered. Values of 0 or less will disable
509     * warnings
510     *
511     * @param blockedProducerWarningInterval the interval at which warning about
512     *            blocked producers will be triggered.
513     */
514    public void setBlockedProducerWarningInterval(long blockedProducerWarningInterval) {
515        this.blockedProducerWarningInterval = blockedProducerWarningInterval;
516    }
517
518    /**
519     *
520     * @return the interval at which warning about blocked producers will be
521     *         triggered.
522     */
523    public long getBlockedProducerWarningInterval() {
524        return blockedProducerWarningInterval;
525    }
526
527    /**
528     * @return the maxProducersToAudit
529     */
530    public int getMaxProducersToAudit() {
531        return maxProducersToAudit;
532    }
533
534    /**
535     * @param maxProducersToAudit the maxProducersToAudit to set
536     */
537    public void setMaxProducersToAudit(int maxProducersToAudit) {
538        this.maxProducersToAudit = maxProducersToAudit;
539    }
540
541    /**
542     * @return the maxAuditDepth
543     */
544    public int getMaxAuditDepth() {
545        return maxAuditDepth;
546    }
547
548    /**
549     * @param maxAuditDepth the maxAuditDepth to set
550     */
551    public void setMaxAuditDepth(int maxAuditDepth) {
552        this.maxAuditDepth = maxAuditDepth;
553    }
554
555    /**
556     * @return the enableAudit
557     */
558    public boolean isEnableAudit() {
559        return enableAudit;
560    }
561
562    /**
563     * @param enableAudit the enableAudit to set
564     */
565    public void setEnableAudit(boolean enableAudit) {
566        this.enableAudit = enableAudit;
567    }
568
569    public int getMaxQueueAuditDepth() {
570        return maxQueueAuditDepth;
571    }
572
573    public void setMaxQueueAuditDepth(int maxQueueAuditDepth) {
574        this.maxQueueAuditDepth = maxQueueAuditDepth;
575    }
576
577    public boolean isOptimizedDispatch() {
578        return optimizedDispatch;
579    }
580
581    public void setOptimizedDispatch(boolean optimizedDispatch) {
582        this.optimizedDispatch = optimizedDispatch;
583    }
584
585    public int getMaxPageSize() {
586        return maxPageSize;
587    }
588
589    public void setMaxPageSize(int maxPageSize) {
590        this.maxPageSize = maxPageSize;
591    }
592
593    public int getMaxBrowsePageSize() {
594        return maxBrowsePageSize;
595    }
596
597    public void setMaxBrowsePageSize(int maxPageSize) {
598        this.maxBrowsePageSize = maxPageSize;
599    }
600
601    public boolean isUseCache() {
602        return useCache;
603    }
604
605    public void setUseCache(boolean useCache) {
606        this.useCache = useCache;
607    }
608
609    public long getMinimumMessageSize() {
610        return minimumMessageSize;
611    }
612
613    public void setMinimumMessageSize(long minimumMessageSize) {
614        this.minimumMessageSize = minimumMessageSize;
615    }
616
617    public boolean isUseConsumerPriority() {
618        return useConsumerPriority;
619    }
620
621    public void setUseConsumerPriority(boolean useConsumerPriority) {
622        this.useConsumerPriority = useConsumerPriority;
623    }
624
625    public boolean isStrictOrderDispatch() {
626        return strictOrderDispatch;
627    }
628
629    public void setStrictOrderDispatch(boolean strictOrderDispatch) {
630        this.strictOrderDispatch = strictOrderDispatch;
631    }
632
633    public boolean isLazyDispatch() {
634        return lazyDispatch;
635    }
636
637    public void setLazyDispatch(boolean lazyDispatch) {
638        this.lazyDispatch = lazyDispatch;
639    }
640
641    public int getTimeBeforeDispatchStarts() {
642        return timeBeforeDispatchStarts;
643    }
644
645    public void setTimeBeforeDispatchStarts(int timeBeforeDispatchStarts) {
646        this.timeBeforeDispatchStarts = timeBeforeDispatchStarts;
647    }
648
649    public int getConsumersBeforeDispatchStarts() {
650        return consumersBeforeDispatchStarts;
651    }
652
653    public void setConsumersBeforeDispatchStarts(int consumersBeforeDispatchStarts) {
654        this.consumersBeforeDispatchStarts = consumersBeforeDispatchStarts;
655    }
656
657    /**
658     * @return the advisoryForSlowConsumers
659     */
660    public boolean isAdvisoryForSlowConsumers() {
661        return advisoryForSlowConsumers;
662    }
663
664    /**
665     * @param advisoryForSlowConsumers the advisoryForSlowConsumers to set
666     */
667    public void setAdvisoryForSlowConsumers(boolean advisoryForSlowConsumers) {
668        this.advisoryForSlowConsumers = advisoryForSlowConsumers;
669    }
670
671    /**
672     * @return the advisoryForDiscardingMessages
673     */
674    public boolean isAdvisoryForDiscardingMessages() {
675        return advisoryForDiscardingMessages;
676    }
677
678    /**
679     * @param advisoryForDiscardingMessages the advisoryForDiscardingMessages to set
680     */
681    public void setAdvisoryForDiscardingMessages(
682            boolean advisoryForDiscardingMessages) {
683        this.advisoryForDiscardingMessages = advisoryForDiscardingMessages;
684    }
685
686    /**
687     * @return the advisoryWhenFull
688     */
689    public boolean isAdvisoryWhenFull() {
690        return advisoryWhenFull;
691    }
692
693    /**
694     * @param advisoryWhenFull the advisoryWhenFull to set
695     */
696    public void setAdvisoryWhenFull(boolean advisoryWhenFull) {
697        this.advisoryWhenFull = advisoryWhenFull;
698    }
699
700    /**
701     * @return the advisoryForDelivery
702     */
703    public boolean isAdvisoryForDelivery() {
704        return advisoryForDelivery;
705    }
706
707    /**
708     * @param advisoryForDelivery the advisoryForDelivery to set
709     */
710    public void setAdvisoryForDelivery(boolean advisoryForDelivery) {
711        this.advisoryForDelivery = advisoryForDelivery;
712    }
713
714    /**
715     * @return the advisoryForConsumed
716     */
717    public boolean isAdvisoryForConsumed() {
718        return advisoryForConsumed;
719    }
720
721    /**
722     * @param advisoryForConsumed the advisoryForConsumed to set
723     */
724    public void setAdvisoryForConsumed(boolean advisoryForConsumed) {
725        this.advisoryForConsumed = advisoryForConsumed;
726    }
727
728    /**
729     * @return the advisdoryForFastProducers
730     */
731    public boolean isAdvisoryForFastProducers() {
732        return advisoryForFastProducers;
733    }
734
735    /**
736     * @param advisoryForFastProducers the advisdoryForFastProducers to set
737     */
738    public void setAdvisoryForFastProducers(boolean advisoryForFastProducers) {
739        this.advisoryForFastProducers = advisoryForFastProducers;
740    }
741
742    public void setMaxExpirePageSize(int maxExpirePageSize) {
743        this.maxExpirePageSize = maxExpirePageSize;
744    }
745
746    public int getMaxExpirePageSize() {
747        return maxExpirePageSize;
748    }
749
750    public void setExpireMessagesPeriod(long expireMessagesPeriod) {
751        this.expireMessagesPeriod = expireMessagesPeriod;
752    }
753
754    public long getExpireMessagesPeriod() {
755        return expireMessagesPeriod;
756    }
757
758    /**
759     * Get the queuePrefetch
760     * @return the queuePrefetch
761     */
762    public int getQueuePrefetch() {
763        return this.queuePrefetch;
764    }
765
766    /**
767     * Set the queuePrefetch
768     * @param queuePrefetch the queuePrefetch to set
769     */
770    public void setQueuePrefetch(int queuePrefetch) {
771        this.queuePrefetch = queuePrefetch;
772    }
773
774    /**
775     * Get the queueBrowserPrefetch
776     * @return the queueBrowserPrefetch
777     */
778    public int getQueueBrowserPrefetch() {
779        return this.queueBrowserPrefetch;
780    }
781
782    /**
783     * Set the queueBrowserPrefetch
784     * @param queueBrowserPrefetch the queueBrowserPrefetch to set
785     */
786    public void setQueueBrowserPrefetch(int queueBrowserPrefetch) {
787        this.queueBrowserPrefetch = queueBrowserPrefetch;
788    }
789
790    /**
791     * Get the topicPrefetch
792     * @return the topicPrefetch
793     */
794    public int getTopicPrefetch() {
795        return this.topicPrefetch;
796    }
797
798    /**
799     * Set the topicPrefetch
800     * @param topicPrefetch the topicPrefetch to set
801     */
802    public void setTopicPrefetch(int topicPrefetch) {
803        this.topicPrefetch = topicPrefetch;
804    }
805
806    /**
807     * Get the durableTopicPrefetch
808     * @return the durableTopicPrefetch
809     */
810    public int getDurableTopicPrefetch() {
811        return this.durableTopicPrefetch;
812    }
813
814    /**
815     * Set the durableTopicPrefetch
816     * @param durableTopicPrefetch the durableTopicPrefetch to set
817     */
818    public void setDurableTopicPrefetch(int durableTopicPrefetch) {
819        this.durableTopicPrefetch = durableTopicPrefetch;
820    }
821
822    public boolean isUsePrefetchExtension() {
823        return this.usePrefetchExtension;
824    }
825
826    public void setUsePrefetchExtension(boolean usePrefetchExtension) {
827        this.usePrefetchExtension = usePrefetchExtension;
828    }
829
830    public int getCursorMemoryHighWaterMark() {
831        return this.cursorMemoryHighWaterMark;
832    }
833
834    public void setCursorMemoryHighWaterMark(int cursorMemoryHighWaterMark) {
835        this.cursorMemoryHighWaterMark = cursorMemoryHighWaterMark;
836    }
837
838    public void setStoreUsageHighWaterMark(int storeUsageHighWaterMark) {
839        this.storeUsageHighWaterMark = storeUsageHighWaterMark;
840    }
841
842    public int getStoreUsageHighWaterMark() {
843        return storeUsageHighWaterMark;
844    }
845
846    public void setSlowConsumerStrategy(SlowConsumerStrategy slowConsumerStrategy) {
847        this.slowConsumerStrategy = slowConsumerStrategy;
848    }
849
850    public SlowConsumerStrategy getSlowConsumerStrategy() {
851        return this.slowConsumerStrategy;
852    }
853
854
855    public boolean isPrioritizedMessages() {
856        return this.prioritizedMessages;
857    }
858
859    public void setPrioritizedMessages(boolean prioritizedMessages) {
860        this.prioritizedMessages = prioritizedMessages;
861    }
862
863    public void setAllConsumersExclusiveByDefault(boolean allConsumersExclusiveByDefault) {
864        this.allConsumersExclusiveByDefault = allConsumersExclusiveByDefault;
865    }
866
867    public boolean isAllConsumersExclusiveByDefault() {
868        return allConsumersExclusiveByDefault;
869    }
870
871    public boolean isGcInactiveDestinations() {
872        return this.gcInactiveDestinations;
873    }
874
875    public void setGcInactiveDestinations(boolean gcInactiveDestinations) {
876        this.gcInactiveDestinations = gcInactiveDestinations;
877    }
878
879    /**
880     * @return the amount of time spent inactive before GC of the destination kicks in.
881     *
882     * @deprecated use getInactiveTimeoutBeforeGC instead.
883     */
884    @Deprecated
885    public long getInactiveTimoutBeforeGC() {
886        return getInactiveTimeoutBeforeGC();
887    }
888
889    /**
890     * Sets the amount of time a destination is inactive before it is marked for GC
891     *
892     * @param inactiveTimoutBeforeGC
893     *        time in milliseconds to configure as the inactive timeout.
894     *
895     * @deprecated use getInactiveTimeoutBeforeGC instead.
896     */
897    @Deprecated
898    public void setInactiveTimoutBeforeGC(long inactiveTimoutBeforeGC) {
899        setInactiveTimeoutBeforeGC(inactiveTimoutBeforeGC);
900    }
901
902    /**
903     * @return the amount of time spent inactive before GC of the destination kicks in.
904     */
905    public long getInactiveTimeoutBeforeGC() {
906        return this.inactiveTimeoutBeforeGC;
907    }
908
909    /**
910     * Sets the amount of time a destination is inactive before it is marked for GC
911     *
912     * @param inactiveTimoutBeforeGC
913     *        time in milliseconds to configure as the inactive timeout.
914     */
915    public void setInactiveTimeoutBeforeGC(long inactiveTimeoutBeforeGC) {
916        this.inactiveTimeoutBeforeGC = inactiveTimeoutBeforeGC;
917    }
918
919    public void setGcWithNetworkConsumers(boolean gcWithNetworkConsumers) {
920        this.gcWithNetworkConsumers = gcWithNetworkConsumers;
921    }
922
923    public boolean isGcWithNetworkConsumers() {
924        return gcWithNetworkConsumers;
925    }
926
927    public boolean isReduceMemoryFootprint() {
928        return reduceMemoryFootprint;
929    }
930
931    public void setReduceMemoryFootprint(boolean reduceMemoryFootprint) {
932        this.reduceMemoryFootprint = reduceMemoryFootprint;
933    }
934
935    public void setNetworkBridgeFilterFactory(NetworkBridgeFilterFactory networkBridgeFilterFactory) {
936        this.networkBridgeFilterFactory = networkBridgeFilterFactory;
937    }
938
939    public NetworkBridgeFilterFactory getNetworkBridgeFilterFactory() {
940        return networkBridgeFilterFactory;
941    }
942
943    public boolean isDoOptimzeMessageStorage() {
944        return doOptimzeMessageStorage;
945    }
946
947    public void setDoOptimzeMessageStorage(boolean doOptimzeMessageStorage) {
948        this.doOptimzeMessageStorage = doOptimzeMessageStorage;
949    }
950
951    public int getOptimizeMessageStoreInFlightLimit() {
952        return optimizeMessageStoreInFlightLimit;
953    }
954
955    public void setOptimizeMessageStoreInFlightLimit(int optimizeMessageStoreInFlightLimit) {
956        this.optimizeMessageStoreInFlightLimit = optimizeMessageStoreInFlightLimit;
957    }
958
959    public void setPersistJMSRedelivered(boolean val) {
960        this.persistJMSRedelivered = val;
961    }
962
963    public boolean isPersistJMSRedelivered() {
964        return persistJMSRedelivered;
965    }
966
967    @Override
968    public String toString() {
969        return "PolicyEntry [" + destination + "]";
970    }
971}