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 * The Command Pattern so that we can send and receive commands on the different 023 * transports 024 * 025 * @version $Revision: 1.7 $ 026 */ 027 public interface Command extends DataStructure { 028 029 void setCommandId(int value); 030 031 /** 032 * @return the unique ID of this request used to map responses to requests 033 */ 034 int getCommandId(); 035 036 void setResponseRequired(boolean responseRequired); 037 038 boolean isResponseRequired(); 039 040 boolean isResponse(); 041 042 boolean isMessageDispatch(); 043 044 boolean isBrokerInfo(); 045 046 boolean isWireFormatInfo(); 047 048 boolean isMessage(); 049 050 boolean isMessageAck(); 051 052 boolean isMessageDispatchNotification(); 053 054 boolean isShutdownInfo(); 055 056 Response visit(CommandVisitor visitor) throws Exception; 057 058 /** 059 * The endpoint within the transport where this message came from which 060 * could be null if the transport only supports a single endpoint. 061 */ 062 Endpoint getFrom(); 063 064 void setFrom(Endpoint from); 065 066 /** 067 * The endpoint within the transport where this message is going to - null 068 * means all endpoints. 069 */ 070 Endpoint getTo(); 071 072 void setTo(Endpoint to); 073 }