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