001 /**002 * Licensed to the Apache Software Foundation (ASF) under one or more003 * contributor license agreements. See the NOTICE file distributed with004 * this work for additional information regarding copyright ownership.005 * The ASF licenses this file to You under the Apache License, Version 2.0006 * (the "License"); you may not use this file except in compliance with007 * the License. You may obtain a copy of the License at008 *009 * http://www.apache.org/licenses/LICENSE-2.0010 *011 * Unless required by applicable law or agreed to in writing, software012 * 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 and015 * limitations under the License.016 */017 package org.apache.activemq.command;018019 import org.apache.activemq.state.CommandVisitor;020021 /**022 * The Command Pattern so that we can send and receive commands on the different023 * transports024 * 025 * 026 */027 public interface Command extends DataStructure {028029 void setCommandId(int value);030031 /**032 * @return the unique ID of this request used to map responses to requests033 */034 int getCommandId();035036 void setResponseRequired(boolean responseRequired);037038 boolean isResponseRequired();039040 boolean isResponse();041042 boolean isMessageDispatch();043044 boolean isBrokerInfo();045046 boolean isWireFormatInfo();047048 boolean isMessage();049050 boolean isMessageAck();051052 boolean isMessageDispatchNotification();053054 boolean isShutdownInfo();055056 boolean isConnectionControl();057058 Response visit(CommandVisitor visitor) throws Exception;059060 /**061 * The endpoint within the transport where this message came from which062 * could be null if the transport only supports a single endpoint.063 */064 Endpoint getFrom();065066 void setFrom(Endpoint from);067068 /**069 * The endpoint within the transport where this message is going to - null070 * means all endpoints.071 */072 Endpoint getTo();073074 void setTo(Endpoint to);075 }