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     */
017    package org.apache.activemq.tool.properties;
018    
019    public class JmsConsumerProperties extends JmsClientProperties {
020        public static final String TIME_BASED_RECEIVING = "time"; // Receive messages on a time-based interval
021        public static final String COUNT_BASED_RECEIVING = "count"; // Receive a specific count of messages
022    
023        protected boolean durable; // Consumer is a durable subscriber
024        protected boolean unsubscribe = true; // If true, unsubscribe a durable subscriber after it finishes running
025        protected boolean asyncRecv = true;  // If true, use onMessage() to receive messages, else use receive()
026    
027        protected long recvCount    = 1000000;       // Receive a million messages by default
028        protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default
029        protected String recvType   = TIME_BASED_RECEIVING;
030    
031        public boolean isDurable() {
032            return durable;
033        }
034    
035        public void setDurable(boolean durable) {
036            this.durable = durable;
037        }
038    
039        public boolean isUnsubscribe() {
040            return unsubscribe;
041        }
042    
043        public void setUnsubscribe(boolean unsubscribe) {
044            this.unsubscribe = unsubscribe;
045        }
046    
047        public boolean isAsyncRecv() {
048            return asyncRecv;
049        }
050    
051        public void setAsyncRecv(boolean asyncRecv) {
052            this.asyncRecv = asyncRecv;
053        }
054    
055        public long getRecvCount() {
056            return recvCount;
057        }
058    
059        public void setRecvCount(long recvCount) {
060            this.recvCount = recvCount;
061        }
062    
063        public long getRecvDuration() {
064            return recvDuration;
065        }
066    
067        public void setRecvDuration(long recvDuration) {
068            this.recvDuration = recvDuration;
069        }
070    
071        public String getRecvType() {
072            return recvType;
073        }
074    
075        public void setRecvType(String recvType) {
076            this.recvType = recvType;
077        }
078    }