1 18 package org.apache.activemq.command; 19 20 import org.apache.activemq.filter.BooleanExpression; 21 import org.apache.activemq.state.CommandVisitor; 22 23 24 29 public class ConsumerInfo extends BaseCommand { 30 31 public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONSUMER_INFO; 32 33 public static final byte HIGH_PRIORITY = 10; 34 public static final byte NORMAL_PRIORITY = 0; 35 public static final byte NETWORK_CONSUMER_PRIORITY = -5; 36 public static final byte LOW_PRIORITY = -10; 37 38 39 protected ConsumerId consumerId; 40 protected ActiveMQDestination destination; 41 protected int prefetchSize; 42 protected int maximumPendingMessageLimit; 43 protected boolean browser; 44 protected boolean dispatchAsync; 45 protected String selector; 46 protected String subscriptionName; 47 protected boolean noLocal; 48 protected boolean exclusive; 49 protected boolean retroactive; 50 protected byte priority; 51 protected BrokerId[] brokerPath; 52 protected boolean optimizedAcknowledge; 53 protected transient int currentPrefetchSize; protected boolean noRangeAcks; 56 protected BooleanExpression additionalPredicate; 57 protected transient boolean networkSubscription; 59 public ConsumerInfo() { 60 } 61 62 public ConsumerInfo(ConsumerId consumerId) { 63 this.consumerId=consumerId; 64 } 65 66 public ConsumerInfo(SessionInfo sessionInfo, long consumerId) { 67 this.consumerId = new ConsumerId(sessionInfo.getSessionId(), consumerId); 68 } 69 70 public ConsumerInfo copy() { 71 ConsumerInfo info = new ConsumerInfo(); 72 copy(info); 73 return info; 74 } 75 76 public void copy(ConsumerInfo info) { 77 super.copy(info); 78 info.consumerId = consumerId; 79 info.destination = destination; 80 info.prefetchSize = prefetchSize; 81 info.maximumPendingMessageLimit = maximumPendingMessageLimit; 82 info.browser = browser; 83 info.dispatchAsync = dispatchAsync; 84 info.selector = selector; 85 info.subscriptionName=subscriptionName; 86 info.noLocal = noLocal; 87 info.exclusive = exclusive; 88 info.retroactive = retroactive; 89 info.priority = priority; 90 info.brokerPath=brokerPath; 91 } 92 93 public boolean isDurable() { 94 return subscriptionName!=null; 95 } 96 97 public byte getDataStructureType() { 98 return DATA_STRUCTURE_TYPE; 99 } 100 101 106 public ConsumerId getConsumerId() { 107 return consumerId; 108 } 109 public void setConsumerId(ConsumerId consumerId) { 110 this.consumerId = consumerId; 111 } 112 113 118 public boolean isBrowser() { 119 return browser; 120 } 121 public void setBrowser(boolean browser) { 122 this.browser = browser; 123 } 124 125 131 public ActiveMQDestination getDestination() { 132 return destination; 133 } 134 public void setDestination(ActiveMQDestination destination) { 135 this.destination = destination; 136 } 137 138 144 public int getPrefetchSize() { 145 return prefetchSize; 146 } 147 148 public void setPrefetchSize(int prefetchSize) { 149 this.prefetchSize = prefetchSize; 150 this.currentPrefetchSize = prefetchSize; 151 } 152 153 159 public int getMaximumPendingMessageLimit() { 160 return maximumPendingMessageLimit; 161 } 162 163 public void setMaximumPendingMessageLimit(int maximumPendingMessageLimit) { 164 this.maximumPendingMessageLimit = maximumPendingMessageLimit; 165 } 166 167 175 public boolean isDispatchAsync() { 176 return dispatchAsync; 177 } 178 public void setDispatchAsync(boolean dispatchAsync) { 179 this.dispatchAsync = dispatchAsync; 180 } 181 182 188 public String getSelector() { 189 return selector; 190 } 191 public void setSelector(String selector) { 192 this.selector = selector; 193 } 194 195 200 public String getSubscriptionName() { 201 return subscriptionName; 202 } 203 public void setSubscriptionName(String durableSubscriptionId) { 204 this.subscriptionName = durableSubscriptionId; 205 } 206 207 211 public String getSubcriptionName() { 212 return subscriptionName; 213 } 214 215 220 public void setSubcriptionName(String durableSubscriptionId) { 221 this.subscriptionName = durableSubscriptionId; 222 } 223 224 229 public boolean isNoLocal() { 230 return noLocal; 231 } 232 public void setNoLocal(boolean noLocal) { 233 this.noLocal = noLocal; 234 } 235 236 243 public boolean isExclusive() { 244 return exclusive; 245 } 246 public void setExclusive(boolean exclusive) { 247 this.exclusive = exclusive; 248 } 249 250 259 public boolean isRetroactive() { 260 return retroactive; 261 } 262 public void setRetroactive(boolean retroactive) { 263 this.retroactive = retroactive; 264 } 265 266 public RemoveInfo createRemoveCommand() { 267 RemoveInfo command = new RemoveInfo(getConsumerId()); 268 command.setResponseRequired(isResponseRequired()); 269 return command; 270 } 271 272 279 public byte getPriority() { 280 return priority; 281 } 282 public void setPriority(byte priority) { 283 this.priority = priority; 284 } 285 286 291 public BrokerId[] getBrokerPath() { 292 return brokerPath; 293 } 294 public void setBrokerPath(BrokerId[] brokerPath) { 295 this.brokerPath = brokerPath; 296 } 297 298 305 public BooleanExpression getAdditionalPredicate() { 306 return additionalPredicate; 307 } 308 public void setAdditionalPredicate(BooleanExpression additionalPredicate) { 309 this.additionalPredicate = additionalPredicate; 310 } 311 312 public Response visit(CommandVisitor visitor) throws Exception { 313 return visitor.processAddConsumer( this ); 314 } 315 316 320 public boolean isNetworkSubscription(){ 321 return networkSubscription; 322 } 323 324 327 public void setNetworkSubscription(boolean networkSubscription){ 328 this.networkSubscription=networkSubscription; 329 } 330 331 335 public boolean isOptimizedAcknowledge(){ 336 return optimizedAcknowledge; 337 } 338 339 342 public void setOptimizedAcknowledge(boolean optimizedAcknowledge){ 343 this.optimizedAcknowledge=optimizedAcknowledge; 344 } 345 346 349 public int getCurrentPrefetchSize(){ 350 return currentPrefetchSize; 351 } 352 353 356 public void setCurrentPrefetchSize(int currentPrefetchSize){ 357 this.currentPrefetchSize=currentPrefetchSize; 358 } 359 360 367 public boolean isNoRangeAcks() { 368 return noRangeAcks; 369 } 370 371 public void setNoRangeAcks(boolean noRangeAcks) { 372 this.noRangeAcks = noRangeAcks; 373 } 374 375 } 376 | Popular Tags |