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     * 
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        protected transient Throwable rollbackCause;
039    
040        public byte getDataStructureType() {
041            return DATA_STRUCTURE_TYPE;
042        }
043    
044        public boolean isMessageDispatch() {
045            return true;
046        }
047    
048        /**
049         * @openwire:property version=1 cache=true
050         */
051        public ConsumerId getConsumerId() {
052            return consumerId;
053        }
054    
055        public void setConsumerId(ConsumerId consumerId) {
056            this.consumerId = consumerId;
057        }
058    
059        /**
060         * @openwire:property version=1 cache=true
061         */
062        public ActiveMQDestination getDestination() {
063            return destination;
064        }
065    
066        public void setDestination(ActiveMQDestination destination) {
067            this.destination = destination;
068        }
069    
070        /**
071         * @openwire:property version=1
072         */
073        public Message getMessage() {
074            return message;
075        }
076    
077        public void setMessage(Message message) {
078            this.message = message;
079        }
080    
081        public long getDeliverySequenceId() {
082            return deliverySequenceId;
083        }
084    
085        public void setDeliverySequenceId(long deliverySequenceId) {
086            this.deliverySequenceId = deliverySequenceId;
087        }
088    
089        /**
090         * @openwire:property version=1
091         */
092        public int getRedeliveryCounter() {
093            return redeliveryCounter;
094        }
095    
096        public void setRedeliveryCounter(int deliveryCounter) {
097            this.redeliveryCounter = deliveryCounter;
098        }
099    
100        public Object getConsumer() {
101            return consumer;
102        }
103    
104        public void setConsumer(Object consumer) {
105            this.consumer = consumer;
106        }
107    
108        public Response visit(CommandVisitor visitor) throws Exception {
109            return visitor.processMessageDispatch(this);
110        }
111    
112        public Runnable getTransmitCallback() {
113            return transmitCallback;
114        }
115    
116        public void setTransmitCallback(Runnable transmitCallback) {
117            this.transmitCallback = transmitCallback;
118        }
119    
120        public Throwable getRollbackCause() {
121            return rollbackCause;
122        }
123    
124        public void setRollbackCause(Throwable rollbackCause) {
125            this.rollbackCause = rollbackCause;
126        }
127    }