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.command;
018    
019    import org.apache.activemq.state.CommandVisitor;
020    
021    /**
022     * Used to start and stop transports as well as terminating clients.
023     * 
024     * @openwire:marshaller code="17"
025     * @version $Revision: 1.1 $
026     */
027    public class ConsumerControl extends BaseCommand {
028    
029        public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONSUMER_CONTROL;
030    
031        protected ConsumerId consumerId;
032        protected boolean close;
033        protected boolean stop;
034        protected boolean start;
035        protected boolean flush;
036        protected int prefetch;
037    
038        public byte getDataStructureType() {
039            return DATA_STRUCTURE_TYPE;
040        }
041    
042        public Response visit(CommandVisitor visitor) throws Exception {
043            return visitor.processConsumerControl(this);
044        }
045    
046        /**
047         * @openwire:property version=1
048         * @return Returns the close.
049         */
050        public boolean isClose() {
051            return close;
052        }
053    
054        /**
055         * @param close The close to set.
056         */
057        public void setClose(boolean close) {
058            this.close = close;
059        }
060    
061        /**
062         * @openwire:property version=1
063         * @return Returns the consumerId.
064         */
065        public ConsumerId getConsumerId() {
066            return consumerId;
067        }
068    
069        /**
070         * @param consumerId The consumerId to set.
071         */
072        public void setConsumerId(ConsumerId consumerId) {
073            this.consumerId = consumerId;
074        }
075    
076        /**
077         * @openwire:property version=1
078         * @return Returns the prefetch.
079         */
080        public int getPrefetch() {
081            return prefetch;
082        }
083    
084        /**
085         * @param prefetch The prefetch to set.
086         */
087        public void setPrefetch(int prefetch) {
088            this.prefetch = prefetch;
089        }
090    
091        /**
092         * @openwire:property version=2
093         * @return the flush
094         */
095        public boolean isFlush() {
096            return this.flush;
097        }
098    
099        /**
100         * @param flush the flush to set
101         */
102        public void setFlush(boolean flush) {
103            this.flush = flush;
104        }
105    
106        /**
107         * @openwire:property version=2
108         * @return the start
109         */
110        public boolean isStart() {
111            return this.start;
112        }
113    
114        /**
115         * @param start the start to set
116         */
117        public void setStart(boolean start) {
118            this.start = start;
119        }
120    
121        /**
122         * @openwire:property version=2
123         * @return the stop
124         */
125        public boolean isStop() {
126            return this.stop;
127        }
128    
129        /**
130         * @param stop the stop to set
131         */
132        public void setStop(boolean stop) {
133            this.stop = stop;
134        }
135    }