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 * 023 * @openwire:marshaller code="21" 024 * @version $Revision$ 025 */ 026 public class MessageDispatch extends BaseCommand { 027 028 public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_DISPATCH; 029 030 protected ConsumerId consumerId; 031 protected ActiveMQDestination destination; 032 protected Message message; 033 protected int redeliveryCounter; 034 035 protected transient long deliverySequenceId; 036 protected transient Object consumer; 037 protected transient Runnable transmitCallback; 038 039 public byte getDataStructureType() { 040 return DATA_STRUCTURE_TYPE; 041 } 042 043 public boolean isMessageDispatch() { 044 return true; 045 } 046 047 /** 048 * @openwire:property version=1 cache=true 049 */ 050 public ConsumerId getConsumerId() { 051 return consumerId; 052 } 053 054 public void setConsumerId(ConsumerId consumerId) { 055 this.consumerId = consumerId; 056 } 057 058 /** 059 * @openwire:property version=1 cache=true 060 */ 061 public ActiveMQDestination getDestination() { 062 return destination; 063 } 064 065 public void setDestination(ActiveMQDestination destination) { 066 this.destination = destination; 067 } 068 069 /** 070 * @openwire:property version=1 071 */ 072 public Message getMessage() { 073 return message; 074 } 075 076 public void setMessage(Message message) { 077 this.message = message; 078 } 079 080 public long getDeliverySequenceId() { 081 return deliverySequenceId; 082 } 083 084 public void setDeliverySequenceId(long deliverySequenceId) { 085 this.deliverySequenceId = deliverySequenceId; 086 } 087 088 /** 089 * @openwire:property version=1 090 */ 091 public int getRedeliveryCounter() { 092 return redeliveryCounter; 093 } 094 095 public void setRedeliveryCounter(int deliveryCounter) { 096 this.redeliveryCounter = deliveryCounter; 097 } 098 099 public Object getConsumer() { 100 return consumer; 101 } 102 103 public void setConsumer(Object consumer) { 104 this.consumer = consumer; 105 } 106 107 public Response visit(CommandVisitor visitor) throws Exception { 108 return visitor.processMessageDispatch(this); 109 } 110 111 public Runnable getTransmitCallback() { 112 return transmitCallback; 113 } 114 115 public void setTransmitCallback(Runnable transmitCallback) { 116 this.transmitCallback = transmitCallback; 117 } 118 119 }