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     * 
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        boolean isConnectionControl();
057    
058        Response visit(CommandVisitor visitor) throws Exception;
059    
060        /**
061         * The endpoint within the transport where this message came from which
062         * could be null if the transport only supports a single endpoint.
063         */
064        Endpoint getFrom();
065    
066        void setFrom(Endpoint from);
067    
068        /**
069         * The endpoint within the transport where this message is going to - null
070         * means all endpoints.
071         */
072        Endpoint getTo();
073    
074        void setTo(Endpoint to);
075    }