activemq-cpp-3.9.5
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
27
28#include <decaf/lang/Runnable.h>
29#include <decaf/lang/Thread.h>
33
34namespace activemq {
35namespace transport {
36
37 using decaf::lang::Pointer;
38 using activemq::commands::Command;
39 using activemq::commands::Response;
40
41 class IOTransportImpl;
42
58 class AMQCPP_API IOTransport : public Transport,
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
96
105
106 virtual ~IOTransport();
107
115
123
124 public: // Transport methods
125
126 virtual void oneway(const Pointer<Command> command);
127
134 const Pointer<ResponseCallback> responseCallback);
135
142
148 virtual Pointer<Response> request(const Pointer<Command> command, unsigned int timeout);
149
151
152 virtual void setWireFormat(const Pointer<wireformat::WireFormat> wireFormat);
153
155
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) {
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_*/
#define LOGDECAF_DECLARE(loggerName)
Definition LoggerDefines.h:23
#define AMQCPP_API
Definition Config.h:30
IOTransport(const Pointer< wireformat::WireFormat > wireFormat)
Create an instance of this Transport and assign its WireFormat instance at creation time.
virtual void updateURIs(bool rebalance AMQCPP_UNUSED, const decaf::util::List< decaf::net::URI > &uris AMQCPP_UNUSED)
Definition IOTransport.h:192
virtual Pointer< Response > request(const Pointer< Command > command)
Sends the given command to the broker and then waits for the response.the response from the broker.
virtual bool isUpdateURIsSupported() const
Definition IOTransport.h:188
virtual void stop()
Stops the Transport.
virtual bool isClosed() const
Has the Transport been shutdown and no longer usable.
virtual void start()
Starts the Transport, the send methods of a Transport will throw an exception if used before the Tran...
virtual std::string getRemoteAddress() const
Definition IOTransport.h:180
virtual bool isReconnectSupported() const
Definition IOTransport.h:184
virtual TransportListener * getTransportListener() const
Gets the observer of asynchronous events from this transport.
virtual void setOutputStream(decaf::io::DataOutputStream *os)
Sets the stream to which this Transport implementation will write its data.
virtual bool isFaultTolerant() const
Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect.
Definition IOTransport.h:172
virtual Pointer< wireformat::WireFormat > getWireFormat() const
Gets the WireFormat instance that is in use by this transport.
virtual void reconnect(const decaf::net::URI &uri AMQCPP_UNUSED)
Definition IOTransport.h:201
IOTransport()
Default Constructor.
virtual void close()
Closes this object and deallocates the appropriate resources.
virtual void run()
Run method - called by the Thread class in the context of the thread.
virtual bool isConnected() const
Is the Transport Connected to its Broker.
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
virtual Pointer< Response > request(const Pointer< Command > command, unsigned int timeout)
Sends the given command to the broker and then waits for the response.the response from the broker.
virtual void setInputStream(decaf::io::DataInputStream *is)
Sets the stream from which this Transport implementation will read its data.
virtual Pointer< FutureResponse > asyncRequest(const Pointer< Command > command, const Pointer< ResponseCallback > responseCallback)
Sends a commands asynchronously, returning a FutureResponse object that the caller can use to check t...
virtual void setWireFormat(const Pointer< wireformat::WireFormat > wireFormat)
Sets the WireFormat instance to use.
virtual void setTransportListener(TransportListener *listener)
Sets the observer of asynchronous events from this transport.
virtual void oneway(const Pointer< Command > command)
Sends a one-way command.
Interface for a transport layer for command objects.
Definition Transport.h:60
A listener of asynchronous exceptions from a command transport object.
Definition TransportListener.h:38
A data input stream lets an application read primitive Java data types from an underlying input strea...
Definition DataInputStream.h:46
A data output stream lets an application write primitive Java data types to an output stream in a por...
Definition DataOutputStream.h:34
Definition IOException.h:28
Definition Exception.h:38
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
Interface for a runnable object - defines a task that can be run by a thread.
Definition Runnable.h:29
This class represents an instance of a URI as defined by RFC 2396.
Definition URI.h:37
An ordered collection (also known as a sequence).
Definition List.h:47
#define NULL
Definition Config.h:33
Definition AbstractTransportFactory.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24