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