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.setUsePrefetchExtension(isUsePrefetchExtension());
223        subscription.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
224        if (pendingMessageLimitStrategy != null) {
225            int value = pendingMessageLimitStrategy.getMaximumPendingMessageLimit(subscription);
226            int consumerLimit = subscription.getInfo().getMaximumPendingMessageLimit();
227            if (consumerLimit > 0) {
228                if (value < 0 || consumerLimit < value) {
229                    value = consumerLimit;
230                }
231            }
232            if (value >= 0) {
233                LOG.debug("Setting the maximumPendingMessages size to: {} for consumer: {}", value, subscription.getInfo().getConsumerId());
234                subscription.setMaximumPendingMessages(value);
235            }
236        }
237        if (messageEvictionStrategy != null) {
238            subscription.setMessageEvictionStrategy(messageEvictionStrategy);
239        }
240        if (pendingSubscriberPolicy != null) {
241            String name = subscription.getContext().getClientId() + "_" + subscription.getConsumerInfo().getConsumerId();
242            int maxBatchSize = subscription.getConsumerInfo().getPrefetchSize();
243            subscription.setMatched(pendingSubscriberPolicy.getSubscriberPendingMessageCursor(broker,name, maxBatchSize,subscription));
244        }
245        if (enableAudit) {
246            subscription.setEnableAudit(enableAudit);
247            subscription.setMaxProducersToAudit(maxProducersToAudit);
248            subscription.setMaxAuditDepth(maxAuditDepth);
249        }
250    }
251
252    public void configure(Broker broker, SystemUsage memoryManager, DurableTopicSubscription sub) {
253        String clientId = sub.getSubscriptionKey().getClientId();
254        String subName = sub.getSubscriptionKey().getSubscriptionName();
255        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
256        configurePrefetch(sub);
257        if (pendingDurableSubscriberPolicy != null) {
258            PendingMessageCursor cursor = pendingDurableSubscriberPolicy.getSubscriberPendingMessageCursor(broker,clientId, subName,sub.getPrefetchSize(),sub);
259            cursor.setSystemUsage(memoryManager);
260            sub.setPending(cursor);
261        }
262        int auditDepth = getMaxAuditDepth();
263        if (auditDepth == BaseDestination.MAX_AUDIT_DEPTH && this.isPrioritizedMessages()) {
264            sub.setMaxAuditDepth(auditDepth * 10);
265        } else {
266            sub.setMaxAuditDepth(auditDepth);
267        }
268        sub.setMaxProducersToAudit(getMaxProducersToAudit());
269        sub.setUsePrefetchExtension(isUsePrefetchExtension());
270    }
271
272    public void configure(Broker broker, SystemUsage memoryManager, QueueBrowserSubscription sub) {
273        configurePrefetch(sub);
274        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
275        sub.setUsePrefetchExtension(isUsePrefetchExtension());
276
277        // TODO
278        // We currently need an infinite audit because of the way that browser dispatch
279        // is done.  We should refactor the browsers to better handle message dispatch so
280        // we can remove this and perform a more efficient dispatch.
281        sub.setMaxProducersToAudit(Integer.MAX_VALUE);
282        sub.setMaxAuditDepth(Short.MAX_VALUE);
283
284        // part solution - dispatching to browsers needs to be restricted
285        sub.setMaxMessages(getMaxBrowsePageSize());
286    }
287
288    public void configure(Broker broker, SystemUsage memoryManager, QueueSubscription sub) {
289        configurePrefetch(sub);
290        sub.setCursorMemoryHighWaterMark(getCursorMemoryHighWaterMark());
291        sub.setUsePrefetchExtension(isUsePrefetchExtension());
292        sub.setMaxProducersToAudit(getMaxProducersToAudit());
293    }
294
295    public void configurePrefetch(Subscription subscription) {
296
297        final int currentPrefetch = subscription.getConsumerInfo().getPrefetchSize();
298        if (subscription instanceof QueueBrowserSubscription) {
299            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_QUEUE_BROWSER_PREFETCH) {
300                ((QueueBrowserSubscription) subscription).setPrefetchSize(getQueueBrowserPrefetch());
301            }
302        } else if (subscription instanceof QueueSubscription) {
303            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_QUEUE_PREFETCH) {
304                ((QueueSubscription) subscription).setPrefetchSize(getQueuePrefetch());
305            }
306        } else if (subscription instanceof DurableTopicSubscription) {
307            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH ||
308                    subscription.getConsumerInfo().getPrefetchSize() == ActiveMQPrefetchPolicy.DEFAULT_OPTIMIZE_DURABLE_TOPIC_PREFETCH) {
309                ((DurableTopicSubscription)subscription).setPrefetchSize(getDurableTopicPrefetch());
310            }
311        } else if (subscription instanceof TopicSubscription) {
312            if (currentPrefetch == ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH) {
313                ((TopicSubscription) subscription).setPrefetchSize(getTopicPrefetch());
314            }
315        }
316        if (currentPrefetch != 0 && subscription.getPrefetchSize() == 0) {
317            // tell the sub so that it can issue a pull request
318            subscription.updateConsumerPrefetch(0);
319        }
320    }
321
322    // Properties
323    // -------------------------------------------------------------------------
324    public DispatchPolicy getDispatchPolicy() {
325        return dispatchPolicy;
326    }
327
328    public void setDispatchPolicy(DispatchPolicy policy) {
329        this.dispatchPolicy = policy;
330    }
331
332    public SubscriptionRecoveryPolicy getSubscriptionRecoveryPolicy() {
333        return subscriptionRecoveryPolicy;
334    }
335
336    public void setSubscriptionRecoveryPolicy(SubscriptionRecoveryPolicy subscriptionRecoveryPolicy) {
337        this.subscriptionRecoveryPolicy = subscriptionRecoveryPolicy;
338    }
339
340    public boolean isSendAdvisoryIfNoConsumers() {
341        return sendAdvisoryIfNoConsumers;
342    }
343
344    /**
345     * Sends an advisory message if a non-persistent message is sent and there
346     * are no active consumers
347     */
348    public void setSendAdvisoryIfNoConsumers(boolean sendAdvisoryIfNoConsumers) {
349        this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
350    }
351
352    public DeadLetterStrategy getDeadLetterStrategy() {
353        return deadLetterStrategy;
354    }
355
356    /**
357     * Sets the policy used to determine which dead letter queue destination
358     * should be used
359     */
360    public void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy) {
361        this.deadLetterStrategy = deadLetterStrategy;
362    }
363
364    public PendingMessageLimitStrategy getPendingMessageLimitStrategy() {
365        return pendingMessageLimitStrategy;
366    }
367
368    /**
369     * Sets the strategy to calculate the maximum number of messages that are
370     * allowed to be pending on consumers (in addition to their prefetch sizes).
371     * Once the limit is reached, non-durable topics can then start discarding
372     * old messages. This allows us to keep dispatching messages to slow
373     * consumers while not blocking fast consumers and discarding the messages
374     * oldest first.
375     */
376    public void setPendingMessageLimitStrategy(PendingMessageLimitStrategy pendingMessageLimitStrategy) {
377        this.pendingMessageLimitStrategy = pendingMessageLimitStrategy;
378    }
379
380    public MessageEvictionStrategy getMessageEvictionStrategy() {
381        return messageEvictionStrategy;
382    }
383
384    /**
385     * Sets the eviction strategy used to decide which message to evict when the
386     * slow consumer needs to discard messages
387     */
388    public void setMessageEvictionStrategy(MessageEvictionStrategy messageEvictionStrategy) {
389        this.messageEvictionStrategy = messageEvictionStrategy;
390    }
391
392    public long getMemoryLimit() {
393        return memoryLimit;
394    }
395
396    /**
397     * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used
398     * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor"
399     */
400    public void setMemoryLimit(long memoryLimit) {
401        this.memoryLimit = memoryLimit;
402    }
403
404    public MessageGroupMapFactory getMessageGroupMapFactory() {
405        if (messageGroupMapFactory == null) {
406            try {
407            messageGroupMapFactory = GroupFactoryFinder.createMessageGroupMapFactory(getMessageGroupMapFactoryType());
408            }catch(Exception e){
409                LOG.error("Failed to create message group Factory ",e);
410            }
411        }
412        return messageGroupMapFactory;
413    }
414
415    /**
416     * Sets the factory used to create new instances of {MessageGroupMap} used
417     * to implement the <a
418     * href="http://activemq.apache.org/message-groups.html">Message Groups</a>
419     * functionality.
420     */
421    public void setMessageGroupMapFactory(MessageGroupMapFactory messageGroupMapFactory) {
422        this.messageGroupMapFactory = messageGroupMapFactory;
423    }
424
425
426    public String getMessageGroupMapFactoryType() {
427        return messageGroupMapFactoryType;
428    }
429
430    public void setMessageGroupMapFactoryType(String messageGroupMapFactoryType) {
431        this.messageGroupMapFactoryType = messageGroupMapFactoryType;
432    }
433
434
435    /**
436     * @return the pendingDurableSubscriberPolicy
437     */
438    public PendingDurableSubscriberMessageStoragePolicy getPendingDurableSubscriberPolicy() {
439        return this.pendingDurableSubscriberPolicy;
440    }
441
442    /**
443     * @param pendingDurableSubscriberPolicy the pendingDurableSubscriberPolicy
444     *                to set
445     */
446    public void setPendingDurableSubscriberPolicy(PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy) {
447        this.pendingDurableSubscriberPolicy = pendingDurableSubscriberPolicy;
448    }
449
450    /**
451     * @return the pendingQueuePolicy
452     */
453    public PendingQueueMessageStoragePolicy getPendingQueuePolicy() {
454        return this.pendingQueuePolicy;
455    }
456
457    /**
458     * @param pendingQueuePolicy the pendingQueuePolicy to set
459     */
460    public void setPendingQueuePolicy(PendingQueueMessageStoragePolicy pendingQueuePolicy) {
461        this.pendingQueuePolicy = pendingQueuePolicy;
462    }
463
464    /**
465     * @return the pendingSubscriberPolicy
466     */
467    public PendingSubscriberMessageStoragePolicy getPendingSubscriberPolicy() {
468        return this.pendingSubscriberPolicy;
469    }
470
471    /**
472     * @param pendingSubscriberPolicy the pendingSubscriberPolicy to set
473     */
474    public void setPendingSubscriberPolicy(PendingSubscriberMessageStoragePolicy pendingSubscriberPolicy) {
475        this.pendingSubscriberPolicy = pendingSubscriberPolicy;
476    }
477
478    /**
479     * @return true if producer flow control enabled
480     */
481    public boolean isProducerFlowControl() {
482        return producerFlowControl;
483    }
484
485    /**
486     * @param producerFlowControl
487     */
488    public void setProducerFlowControl(boolean producerFlowControl) {
489        this.producerFlowControl = producerFlowControl;
490    }
491
492    /**
493     * @return true if topic is always retroactive
494     */
495    public boolean isAlwaysRetroactive() {
496        return alwaysRetroactive;
497    }
498
499    /**
500     * @param alwaysRetroactive
501     */
502    public void setAlwaysRetroactive(boolean alwaysRetroactive) {
503        this.alwaysRetroactive = alwaysRetroactive;
504    }
505
506
507    /**
508     * Set's the interval at which warnings about producers being blocked by
509     * resource usage will be triggered. Values of 0 or less will disable
510     * warnings
511     *
512     * @param blockedProducerWarningInterval the interval at which warning about
513     *            blocked producers will be triggered.
514     */
515    public void setBlockedProducerWarningInterval(long blockedProducerWarningInterval) {
516        this.blockedProducerWarningInterval = blockedProducerWarningInterval;
517    }
518
519    /**
520     *
521     * @return the interval at which warning about blocked producers will be
522     *         triggered.
523     */
524    public long getBlockedProducerWarningInterval() {
525        return blockedProducerWarningInterval;
526    }
527
528    /**
529     * @return the maxProducersToAudit
530     */
531    public int getMaxProducersToAudit() {
532        return maxProducersToAudit;
533    }
534
535    /**
536     * @param maxProducersToAudit the maxProducersToAudit to set
537     */
538    public void setMaxProducersToAudit(int maxProducersToAudit) {
539        this.maxProducersToAudit = maxProducersToAudit;
540    }
541
542    /**
543     * @return the maxAuditDepth
544     */
545    public int getMaxAuditDepth() {
546        return maxAuditDepth;
547    }
548
549    /**
550     * @param maxAuditDepth the maxAuditDepth to set
551     */
552    public void setMaxAuditDepth(int maxAuditDepth) {
553        this.maxAuditDepth = maxAuditDepth;
554    }
555
556    /**
557     * @return the enableAudit
558     */
559    public boolean isEnableAudit() {
560        return enableAudit;
561    }
562
563    /**
564     * @param enableAudit the enableAudit to set
565     */
566    public void setEnableAudit(boolean enableAudit) {
567        this.enableAudit = enableAudit;
568    }
569
570    public int getMaxQueueAuditDepth() {
571        return maxQueueAuditDepth;
572    }
573
574    public void setMaxQueueAuditDepth(int maxQueueAuditDepth) {
575        this.maxQueueAuditDepth = maxQueueAuditDepth;
576    }
577
578    public boolean isOptimizedDispatch() {
579        return optimizedDispatch;
580    }
581
582    public void setOptimizedDispatch(boolean optimizedDispatch) {
583        this.optimizedDispatch = optimizedDispatch;
584    }
585
586    public int getMaxPageSize() {
587        return maxPageSize;
588    }
589
590    public void setMaxPageSize(int maxPageSize) {
591        this.maxPageSize = maxPageSize;
592    }
593
594    public int getMaxBrowsePageSize() {
595        return maxBrowsePageSize;
596    }
597
598    public void setMaxBrowsePageSize(int maxPageSize) {
599        this.maxBrowsePageSize = maxPageSize;
600    }
601
602    public boolean isUseCache() {
603        return useCache;
604    }
605
606    public void setUseCache(boolean useCache) {
607        this.useCache = useCache;
608    }
609
610    public long getMinimumMessageSize() {
611        return minimumMessageSize;
612    }
613
614    public void setMinimumMessageSize(long minimumMessageSize) {
615        this.minimumMessageSize = minimumMessageSize;
616    }
617
618    public boolean isUseConsumerPriority() {
619        return useConsumerPriority;
620    }
621
622    public void setUseConsumerPriority(boolean useConsumerPriority) {
623        this.useConsumerPriority = useConsumerPriority;
624    }
625
626    public boolean isStrictOrderDispatch() {
627        return strictOrderDispatch;
628    }
629
630    public void setStrictOrderDispatch(boolean strictOrderDispatch) {
631        this.strictOrderDispatch = strictOrderDispatch;
632    }
633
634    public boolean isLazyDispatch() {
635        return lazyDispatch;
636    }
637
638    public void setLazyDispatch(boolean lazyDispatch) {
639        this.lazyDispatch = lazyDispatch;
640    }
641
642    public int getTimeBeforeDispatchStarts() {
643        return timeBeforeDispatchStarts;
644    }
645
646    public void setTimeBeforeDispatchStarts(int timeBeforeDispatchStarts) {
647        this.timeBeforeDispatchStarts = timeBeforeDispatchStarts;
648    }
649
650    public int getConsumersBeforeDispatchStarts() {
651        return consumersBeforeDispatchStarts;
652    }
653
654    public void setConsumersBeforeDispatchStarts(int consumersBeforeDispatchStarts) {
655        this.consumersBeforeDispatchStarts = consumersBeforeDispatchStarts;
656    }
657
658    /**
659     * @return the advisoryForSlowConsumers
660     */
661    public boolean isAdvisoryForSlowConsumers() {
662        return advisoryForSlowConsumers;
663    }
664
665    /**
666     * @param advisoryForSlowConsumers the advisoryForSlowConsumers to set
667     */
668    public void setAdvisoryForSlowConsumers(boolean advisoryForSlowConsumers) {
669        this.advisoryForSlowConsumers = advisoryForSlowConsumers;
670    }
671
672    /**
673     * @return the advisoryForDiscardingMessages
674     */
675    public boolean isAdvisoryForDiscardingMessages() {
676        return advisoryForDiscardingMessages;
677    }
678
679    /**
680     * @param advisoryForDiscardingMessages the advisoryForDiscardingMessages to set
681     */
682    public void setAdvisoryForDiscardingMessages(
683            boolean advisoryForDiscardingMessages) {
684        this.advisoryForDiscardingMessages = advisoryForDiscardingMessages;
685    }
686
687    /**
688     * @return the advisoryWhenFull
689     */
690    public boolean isAdvisoryWhenFull() {
691        return advisoryWhenFull;
692    }
693
694    /**
695     * @param advisoryWhenFull the advisoryWhenFull to set
696     */
697    public void setAdvisoryWhenFull(boolean advisoryWhenFull) {
698        this.advisoryWhenFull = advisoryWhenFull;
699    }
700
701    /**
702     * @return the advisoryForDelivery
703     */
704    public boolean isAdvisoryForDelivery() {
705        return advisoryForDelivery;
706    }
707
708    /**
709     * @param advisoryForDelivery the advisoryForDelivery to set
710     */
711    public void setAdvisoryForDelivery(boolean advisoryForDelivery) {
712        this.advisoryForDelivery = advisoryForDelivery;
713    }
714
715    /**
716     * @return the advisoryForConsumed
717     */
718    public boolean isAdvisoryForConsumed() {
719        return advisoryForConsumed;
720    }
721
722    /**
723     * @param advisoryForConsumed the advisoryForConsumed to set
724     */
725    public void setAdvisoryForConsumed(boolean advisoryForConsumed) {
726        this.advisoryForConsumed = advisoryForConsumed;
727    }
728
729    /**
730     * @return the advisdoryForFastProducers
731     */
732    public boolean isAdvisoryForFastProducers() {
733        return advisoryForFastProducers;
734    }
735
736    /**
737     * @param advisoryForFastProducers the advisdoryForFastProducers to set
738     */
739    public void setAdvisoryForFastProducers(boolean advisoryForFastProducers) {
740        this.advisoryForFastProducers = advisoryForFastProducers;
741    }
742
743    public void setMaxExpirePageSize(int maxExpirePageSize) {
744        this.maxExpirePageSize = maxExpirePageSize;
745    }
746
747    public int getMaxExpirePageSize() {
748        return maxExpirePageSize;
749    }
750
751    public void setExpireMessagesPeriod(long expireMessagesPeriod) {
752        this.expireMessagesPeriod = expireMessagesPeriod;
753    }
754
755    public long getExpireMessagesPeriod() {
756        return expireMessagesPeriod;
757    }
758
759    /**
760     * Get the queuePrefetch
761     * @return the queuePrefetch
762     */
763    public int getQueuePrefetch() {
764        return this.queuePrefetch;
765    }
766
767    /**
768     * Set the queuePrefetch
769     * @param queuePrefetch the queuePrefetch to set
770     */
771    public void setQueuePrefetch(int queuePrefetch) {
772        this.queuePrefetch = queuePrefetch;
773    }
774
775    /**
776     * Get the queueBrowserPrefetch
777     * @return the queueBrowserPrefetch
778     */
779    public int getQueueBrowserPrefetch() {
780        return this.queueBrowserPrefetch;
781    }
782
783    /**
784     * Set the queueBrowserPrefetch
785     * @param queueBrowserPrefetch the queueBrowserPrefetch to set
786     */
787    public void setQueueBrowserPrefetch(int queueBrowserPrefetch) {
788        this.queueBrowserPrefetch = queueBrowserPrefetch;
789    }
790
791    /**
792     * Get the topicPrefetch
793     * @return the topicPrefetch
794     */
795    public int getTopicPrefetch() {
796        return this.topicPrefetch;
797    }
798
799    /**
800     * Set the topicPrefetch
801     * @param topicPrefetch the topicPrefetch to set
802     */
803    public void setTopicPrefetch(int topicPrefetch) {
804        this.topicPrefetch = topicPrefetch;
805    }
806
807    /**
808     * Get the durableTopicPrefetch
809     * @return the durableTopicPrefetch
810     */
811    public int getDurableTopicPrefetch() {
812        return this.durableTopicPrefetch;
813    }
814
815    /**
816     * Set the durableTopicPrefetch
817     * @param durableTopicPrefetch the durableTopicPrefetch to set
818     */
819    public void setDurableTopicPrefetch(int durableTopicPrefetch) {
820        this.durableTopicPrefetch = durableTopicPrefetch;
821    }
822
823    public boolean isUsePrefetchExtension() {
824        return this.usePrefetchExtension;
825    }
826
827    public void setUsePrefetchExtension(boolean usePrefetchExtension) {
828        this.usePrefetchExtension = usePrefetchExtension;
829    }
830
831    public int getCursorMemoryHighWaterMark() {
832        return this.cursorMemoryHighWaterMark;
833    }
834
835    public void setCursorMemoryHighWaterMark(int cursorMemoryHighWaterMark) {
836        this.cursorMemoryHighWaterMark = cursorMemoryHighWaterMark;
837    }
838
839    public void setStoreUsageHighWaterMark(int storeUsageHighWaterMark) {
840        this.storeUsageHighWaterMark = storeUsageHighWaterMark;
841    }
842
843    public int getStoreUsageHighWaterMark() {
844        return storeUsageHighWaterMark;
845    }
846
847    public void setSlowConsumerStrategy(SlowConsumerStrategy slowConsumerStrategy) {
848        this.slowConsumerStrategy = slowConsumerStrategy;
849    }
850
851    public SlowConsumerStrategy getSlowConsumerStrategy() {
852        return this.slowConsumerStrategy;
853    }
854
855
856    public boolean isPrioritizedMessages() {
857        return this.prioritizedMessages;
858    }
859
860    public void setPrioritizedMessages(boolean prioritizedMessages) {
861        this.prioritizedMessages = prioritizedMessages;
862    }
863
864    public void setAllConsumersExclusiveByDefault(boolean allConsumersExclusiveByDefault) {
865        this.allConsumersExclusiveByDefault = allConsumersExclusiveByDefault;
866    }
867
868    public boolean isAllConsumersExclusiveByDefault() {
869        return allConsumersExclusiveByDefault;
870    }
871
872    public boolean isGcInactiveDestinations() {
873        return this.gcInactiveDestinations;
874    }
875
876    public void setGcInactiveDestinations(boolean gcInactiveDestinations) {
877        this.gcInactiveDestinations = gcInactiveDestinations;
878    }
879
880    /**
881     * @return the amount of time spent inactive before GC of the destination kicks in.
882     *
883     * @deprecated use getInactiveTimeoutBeforeGC instead.
884     */
885    @Deprecated
886    public long getInactiveTimoutBeforeGC() {
887        return getInactiveTimeoutBeforeGC();
888    }
889
890    /**
891     * Sets the amount of time a destination is inactive before it is marked for GC
892     *
893     * @param inactiveTimoutBeforeGC
894     *        time in milliseconds to configure as the inactive timeout.
895     *
896     * @deprecated use getInactiveTimeoutBeforeGC instead.
897     */
898    @Deprecated
899    public void setInactiveTimoutBeforeGC(long inactiveTimoutBeforeGC) {
900        setInactiveTimeoutBeforeGC(inactiveTimoutBeforeGC);
901    }
902
903    /**
904     * @return the amount of time spent inactive before GC of the destination kicks in.
905     */
906    public long getInactiveTimeoutBeforeGC() {
907        return this.inactiveTimeoutBeforeGC;
908    }
909
910    /**
911     * Sets the amount of time a destination is inactive before it is marked for GC
912     *
913     * @param inactiveTimoutBeforeGC
914     *        time in milliseconds to configure as the inactive timeout.
915     */
916    public void setInactiveTimeoutBeforeGC(long inactiveTimeoutBeforeGC) {
917        this.inactiveTimeoutBeforeGC = inactiveTimeoutBeforeGC;
918    }
919
920    public void setGcWithNetworkConsumers(boolean gcWithNetworkConsumers) {
921        this.gcWithNetworkConsumers = gcWithNetworkConsumers;
922    }
923
924    public boolean isGcWithNetworkConsumers() {
925        return gcWithNetworkConsumers;
926    }
927
928    public boolean isReduceMemoryFootprint() {
929        return reduceMemoryFootprint;
930    }
931
932    public void setReduceMemoryFootprint(boolean reduceMemoryFootprint) {
933        this.reduceMemoryFootprint = reduceMemoryFootprint;
934    }
935
936    public void setNetworkBridgeFilterFactory(NetworkBridgeFilterFactory networkBridgeFilterFactory) {
937        this.networkBridgeFilterFactory = networkBridgeFilterFactory;
938    }
939
940    public NetworkBridgeFilterFactory getNetworkBridgeFilterFactory() {
941        return networkBridgeFilterFactory;
942    }
943
944    public boolean isDoOptimzeMessageStorage() {
945        return doOptimzeMessageStorage;
946    }
947
948    public void setDoOptimzeMessageStorage(boolean doOptimzeMessageStorage) {
949        this.doOptimzeMessageStorage = doOptimzeMessageStorage;
950    }
951
952    public int getOptimizeMessageStoreInFlightLimit() {
953        return optimizeMessageStoreInFlightLimit;
954    }
955
956    public void setOptimizeMessageStoreInFlightLimit(int optimizeMessageStoreInFlightLimit) {
957        this.optimizeMessageStoreInFlightLimit = optimizeMessageStoreInFlightLimit;
958    }
959
960    public void setPersistJMSRedelivered(boolean val) {
961        this.persistJMSRedelivered = val;
962    }
963
964    public boolean isPersistJMSRedelivered() {
965        return persistJMSRedelivered;
966    }
967
968    @Override
969    public String toString() {
970        return "PolicyEntry [" + destination + "]";
971    }
972}