activemq-cpp-3.4.0

src/main/activemq/transport/Transport.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef ACTIVEMQ_TRANSPORT_TRANSPORT_H_
00019 #define ACTIVEMQ_TRANSPORT_TRANSPORT_H_
00020 
00021 #include <decaf/io/InputStream.h>
00022 #include <decaf/io/OutputStream.h>
00023 #include <decaf/io/IOException.h>
00024 #include <decaf/io/Closeable.h>
00025 #include <decaf/util/List.h>
00026 #include <decaf/net/URI.h>
00027 #include <decaf/lang/Pointer.h>
00028 #include <decaf/lang/exceptions/UnsupportedOperationException.h>
00029 #include <activemq/util/Config.h>
00030 #include <activemq/commands/Command.h>
00031 #include <activemq/commands/Response.h>
00032 #include <typeinfo>
00033 
00034 namespace activemq{
00035 namespace wireformat{
00036     class WireFormat;
00037 }
00038 namespace transport{
00039 
00040     // Forward declarations.
00041     class TransportListener;
00042 
00043     using decaf::lang::Pointer;
00044     using activemq::commands::Command;
00045     using activemq::commands::Response;
00046 
00057     class AMQCPP_API Transport : public decaf::io::Closeable {
00058     public:
00059 
00060         virtual ~Transport() {}
00061 
00068         virtual void start() = 0;
00069 
00075         virtual void stop() = 0;
00076 
00088         virtual void oneway( const Pointer<Command>& command ) = 0;
00089 
00101         virtual Pointer<Response> request( const Pointer<Command>& command ) = 0;
00102 
00117         virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout ) = 0;
00118 
00126         virtual Pointer<wireformat::WireFormat> getWireFormat() const = 0;
00127 
00133         virtual void setWireFormat( const Pointer<wireformat::WireFormat>& wireFormat ) = 0;
00134 
00139         virtual void setTransportListener( TransportListener* listener ) = 0;
00140 
00145         virtual TransportListener* getTransportListener() const = 0;
00146 
00156         virtual Transport* narrow( const std::type_info& typeId ) = 0;
00157 
00164         virtual bool isFaultTolerant() const = 0;
00165 
00171         virtual bool isConnected() const = 0;
00172 
00178         virtual bool isClosed() const = 0;
00179 
00183         virtual bool isReconnectSupported() const = 0;
00184 
00188         virtual bool isUpdateURIsSupported() const = 0;
00189 
00193         virtual std::string getRemoteAddress() const = 0;
00194 
00203         virtual void reconnect( const decaf::net::URI& uri ) = 0;
00204 
00216         virtual void updateURIs( bool rebalance, const decaf::util::List<decaf::net::URI>& uris ) = 0;
00217 
00218     };
00219 
00220 }}
00221 
00222 #endif /*_ACTIVEMQ_TRANSPORT_TRANSPORT_H_*/