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 @Override 052 public byte getDataStructureType() { 053 return DATA_STRUCTURE_TYPE; 054 } 055 056 @Override 057 public Response visit(CommandVisitor visitor) throws Exception { 058 return visitor.processConsumerControl(this); 059 } 060 061 @Override 062 public boolean isConsumerControl() { 063 return true; 064 } 065 066 /** 067 * @openwire:property version=1 068 * @return Returns the close. 069 */ 070 public boolean isClose() { 071 return close; 072 } 073 074 /** 075 * @param close 076 * The new value to assign the close state flag. 077 */ 078 public void setClose(boolean close) { 079 this.close = close; 080 } 081 082 /** 083 * @openwire:property version=1 084 * @return Returns the consumerId. 085 */ 086 public ConsumerId getConsumerId() { 087 return consumerId; 088 } 089 090 /** 091 * @param consumerId 092 * The consumerId to set. 093 */ 094 public void setConsumerId(ConsumerId consumerId) { 095 this.consumerId = consumerId; 096 } 097 098 /** 099 * @openwire:property version=1 100 * @return Returns the prefetch. 101 */ 102 public int getPrefetch() { 103 return prefetch; 104 } 105 106 /** 107 * @param prefetch 108 * The prefetch to set. 109 */ 110 public void setPrefetch(int prefetch) { 111 this.prefetch = prefetch; 112 } 113 114 /** 115 * @openwire:property version=2 116 * @return the flush 117 */ 118 public boolean isFlush() { 119 return this.flush; 120 } 121 122 /** 123 * @param flush 124 * The flush value to set on this command. 125 */ 126 public void setFlush(boolean flush) { 127 this.flush = flush; 128 } 129 130 /** 131 * @openwire:property version=2 132 * @return the start 133 */ 134 public boolean isStart() { 135 return this.start; 136 } 137 138 /** 139 * @param start 140 * The start value to set on this command. 141 */ 142 public void setStart(boolean start) { 143 this.start = start; 144 } 145 146 /** 147 * @openwire:property version=2 148 * @return the stop 149 */ 150 public boolean isStop() { 151 return this.stop; 152 } 153 154 /** 155 * @param stop 156 * the stop value to set on this Command. 157 */ 158 public void setStop(boolean stop) { 159 this.stop = stop; 160 } 161}