activemq-cpp-3.8.2
IOTransport.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_TRANSPORT_IOTRANSPORT_H_
19 #define _ACTIVEMQ_TRANSPORT_IOTRANSPORT_H_
20 
21 #include <activemq/util/Config.h>
27 
28 #include <decaf/lang/Runnable.h>
29 #include <decaf/lang/Thread.h>
33 
34 namespace activemq {
35 namespace transport {
36 
40 
41  class IOTransportImpl;
42 
59  public decaf::lang::Runnable {
60 
61  LOGDECAF_DECLARE(logger)
62 
63  private:
64 
65  IOTransportImpl* impl;
66 
67  private:
68 
69  IOTransport(const IOTransport&);
70  IOTransport& operator=(const IOTransport&);
71 
72  private:
73 
80  void fire(decaf::lang::Exception& ex);
81 
88  void fire(const Pointer<Command> command);
89 
90  public:
91 
95  IOTransport();
96 
105 
106  virtual ~IOTransport();
107 
114  virtual void setInputStream(decaf::io::DataInputStream* is);
115 
122  virtual void setOutputStream(decaf::io::DataOutputStream* os);
123 
124  public: // Transport methods
125 
126  virtual void oneway(const Pointer<Command> command);
127 
133  virtual Pointer<FutureResponse> asyncRequest(const Pointer<Command> command,
134  const Pointer<ResponseCallback> responseCallback);
135 
141  virtual Pointer<Response> request(const Pointer<Command> command);
142 
148  virtual Pointer<Response> request(const Pointer<Command> command, unsigned int timeout);
149 
150  virtual Pointer<wireformat::WireFormat> getWireFormat() const;
151 
152  virtual void setWireFormat(const Pointer<wireformat::WireFormat> wireFormat);
153 
154  virtual void setTransportListener(TransportListener* listener);
155 
156  virtual TransportListener* getTransportListener() const;
157 
158  virtual void start();
159 
160  virtual void stop();
161 
162  virtual void close();
163 
164  virtual Transport* narrow(const std::type_info& typeId) {
165  if (typeid(*this) == typeId) {
166  return this;
167  }
168 
169  return NULL;
170  }
171 
172  virtual bool isFaultTolerant() const {
173  return false;
174  }
175 
176  virtual bool isConnected() const;
177 
178  virtual bool isClosed() const;
179 
180  virtual std::string getRemoteAddress() const {
181  return "";
182  }
183 
184  virtual bool isReconnectSupported() const {
185  return false;
186  }
187 
188  virtual bool isUpdateURIsSupported() const {
189  return false;
190  }
191 
192  virtual void updateURIs(bool rebalance AMQCPP_UNUSED, const decaf::util::List<decaf::net::URI>& uris AMQCPP_UNUSED) {
193  throw decaf::io::IOException();
194  }
195 
201  virtual void reconnect(const decaf::net::URI& uri AMQCPP_UNUSED) {}
202 
203  public: // Runnable methods.
204 
205  virtual void run();
206 
207  };
208 
209 }}
210 
211 #endif /*_ACTIVEMQ_TRANSPORT_IOTRANSPORT_H_*/
virtual std::string getRemoteAddress() const
Definition: IOTransport.h:180
#define AMQCPP_API
Definition: Config.h:30
Implementation of the Transport interface that performs marshaling of commands to IO streams...
Definition: IOTransport.h:58
#define NULL
Definition: Config.h:33
Definition: Response.h:46
virtual bool isFaultTolerant() const
Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect.
Definition: IOTransport.h:172
Definition: IOException.h:28
virtual bool isReconnectSupported() const
Definition: IOTransport.h:184
Interface for a transport layer for command objects.
Definition: Transport.h:59
A data output stream lets an application write primitive Java data types to an output stream in a por...
Definition: DataOutputStream.h:34
virtual void updateURIs(bool rebalance AMQCPP_UNUSED, const decaf::util::List< decaf::net::URI > &uris AMQCPP_UNUSED)
Definition: IOTransport.h:192
A data input stream lets an application read primitive Java data types from an underlying input strea...
Definition: DataInputStream.h:46
This class represents an instance of a URI as defined by RFC 2396.
Definition: URI.h:36
virtual void reconnect(const decaf::net::URI &uri AMQCPP_UNUSED)
Definition: IOTransport.h:201
virtual Transport * narrow(const std::type_info &typeId)
Narrows down a Chain of Transports to a specific Transport to allow a higher level transport to skip ...
Definition: IOTransport.h:164
#define LOGDECAF_DECLARE(loggerName)
Definition: LoggerDefines.h:23
Definition: Command.h:33
virtual bool isUpdateURIsSupported() const
Definition: IOTransport.h:188
Interface for a runnable object - defines a task that can be run by a thread.
Definition: Runnable.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: Exception.h:38
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
A listener of asynchronous exceptions from a command transport object.
Definition: TransportListener.h:38