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 long recvDelay = 0; // delay in milliseconds for processing received msg
030 protected String recvType = TIME_BASED_RECEIVING;
031 protected String messageSelector = null;
032
033 public boolean isDurable() {
034 return durable;
035 }
036
037 public void setDurable(boolean durable) {
038 this.durable = durable;
039 }
040
041 public boolean isUnsubscribe() {
042 return unsubscribe;
043 }
044
045 public void setUnsubscribe(boolean unsubscribe) {
046 this.unsubscribe = unsubscribe;
047 }
048
049 public boolean isAsyncRecv() {
050 return asyncRecv;
051 }
052
053 public void setAsyncRecv(boolean asyncRecv) {
054 this.asyncRecv = asyncRecv;
055 }
056
057 public long getRecvCount() {
058 return recvCount;
059 }
060
061 public void setRecvCount(long recvCount) {
062 this.recvCount = recvCount;
063 }
064
065 public long getRecvDuration() {
066 return recvDuration;
067 }
068
069 public void setRecvDuration(long recvDuration) {
070 this.recvDuration = recvDuration;
071 }
072
073 public String getRecvType() {
074 return recvType;
075 }
076
077 public void setRecvType(String recvType) {
078 this.recvType = recvType;
079 }
080
081 public void setRecvDelay(long delay) {
082 this.recvDelay = delay;
083 }
084
085 public long getRecvDelay() {
086 return this.recvDelay;
087 }
088
089 public String getMessageSelector() {
090 return this.messageSelector;
091 }
092
093 public void setMessageSelector(String selector) {
094 if (selector != null )
095 this.messageSelector = new String(selector);
096 }
097 }