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.command;
018
019import 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 * 
026 */
027public 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    protected ActiveMQDestination destination;
038
039    /**
040     * @openwire:property version=6
041     * @return Returns the destination.
042     */
043    public ActiveMQDestination getDestination() {
044        return destination;
045    }
046
047    public void setDestination(ActiveMQDestination destination) {
048        this.destination = destination;
049    }
050
051    public byte getDataStructureType() {
052        return DATA_STRUCTURE_TYPE;
053    }
054
055    public Response visit(CommandVisitor visitor) throws Exception {
056        return visitor.processConsumerControl(this);
057    }
058
059    /**
060     * @openwire:property version=1
061     * @return Returns the close.
062     */
063    public boolean isClose() {
064        return close;
065    }
066
067    /**
068     * @param close The close to set.
069     */
070    public void setClose(boolean close) {
071        this.close = close;
072    }
073
074    /**
075     * @openwire:property version=1
076     * @return Returns the consumerId.
077     */
078    public ConsumerId getConsumerId() {
079        return consumerId;
080    }
081
082    /**
083     * @param consumerId The consumerId to set.
084     */
085    public void setConsumerId(ConsumerId consumerId) {
086        this.consumerId = consumerId;
087    }
088
089    /**
090     * @openwire:property version=1
091     * @return Returns the prefetch.
092     */
093    public int getPrefetch() {
094        return prefetch;
095    }
096
097    /**
098     * @param prefetch The prefetch to set.
099     */
100    public void setPrefetch(int prefetch) {
101        this.prefetch = prefetch;
102    }
103
104    /**
105     * @openwire:property version=2
106     * @return the flush
107     */
108    public boolean isFlush() {
109        return this.flush;
110    }
111
112    /**
113     * @param flush the flush to set
114     */
115    public void setFlush(boolean flush) {
116        this.flush = flush;
117    }
118
119    /**
120     * @openwire:property version=2
121     * @return the start
122     */
123    public boolean isStart() {
124        return this.start;
125    }
126
127    /**
128     * @param start the start to set
129     */
130    public void setStart(boolean start) {
131        this.start = start;
132    }
133
134    /**
135     * @openwire:property version=2
136     * @return the stop
137     */
138    public boolean isStop() {
139        return this.stop;
140    }
141
142    /**
143     * @param stop the stop to set
144     */
145    public void setStop(boolean stop) {
146        this.stop = stop;
147    }
148}