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