Implementation of the Transport interface that performs marshaling of commands to IO streams. More...
#include <src/main/activemq/transport/IOTransport.h>

Public Member Functions | |||||||||||||
| IOTransport () | |||||||||||||
| Default Constructor. | |||||||||||||
| IOTransport (const Pointer< wireformat::WireFormat > wireFormat) | |||||||||||||
| Create an instance of this Transport and assign its WireFormat instance at creation time. | |||||||||||||
| virtual | ~IOTransport () | ||||||||||||
| virtual void | setInputStream (decaf::io::DataInputStream *is) | ||||||||||||
| Sets the stream from which this Transport implementation will read its data. | |||||||||||||
| virtual void | setOutputStream (decaf::io::DataOutputStream *os) | ||||||||||||
| Sets the stream to which this Transport implementation will write its data. | |||||||||||||
| virtual void | oneway (const Pointer< Command > command) | ||||||||||||
| Sends a one-way command. | |||||||||||||
| 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 to find out the response from the broker.
| |||||||||||||
| virtual Pointer< Response > | request (const Pointer< Command > command) | ||||||||||||
Sends the given command to the broker and then waits for the response.
| |||||||||||||
| virtual Pointer< Response > | request (const Pointer< Command > command, unsigned int timeout) | ||||||||||||
Sends the given command to the broker and then waits for the response.
| |||||||||||||
| virtual Pointer < wireformat::WireFormat > | getWireFormat () const | ||||||||||||
| Gets the WireFormat instance that is in use by this transport. | |||||||||||||
| 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 TransportListener * | getTransportListener () const | ||||||||||||
| Gets the observer of asynchronous events from this transport. | |||||||||||||
| virtual void | start () | ||||||||||||
| Starts the Transport, the send methods of a Transport will throw an exception if used before the Transport is started. | |||||||||||||
| virtual void | stop () | ||||||||||||
| Stops the Transport. | |||||||||||||
| virtual void | close () | ||||||||||||
| Closes this object and deallocates the appropriate resources. | |||||||||||||
| 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 intermediate Transports in certain circumstances. | |||||||||||||
| virtual bool | isFaultTolerant () const | ||||||||||||
| Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect. | |||||||||||||
| virtual bool | isConnected () const | ||||||||||||
| Is the Transport Connected to its Broker. | |||||||||||||
| virtual bool | isClosed () const | ||||||||||||
| Has the Transport been shutdown and no longer usable. | |||||||||||||
| virtual std::string | getRemoteAddress () const | ||||||||||||
| virtual bool | isReconnectSupported () const | ||||||||||||
| virtual bool | isUpdateURIsSupported () const | ||||||||||||
| virtual void | updateURIs (bool rebalance AMQCPP_UNUSED, const decaf::util::List< decaf::net::URI > &uris AMQCPP_UNUSED) | ||||||||||||
| virtual void | reconnect (const decaf::net::URI &uri AMQCPP_UNUSED) | ||||||||||||
| | |||||||||||||
| virtual void | run () | ||||||||||||
| Run method - called by the Thread class in the context of the thread. | |||||||||||||
Implementation of the Transport interface that performs marshaling of commands to IO streams.
This class does not implement the Transport::request method, it only handles oneway messages. A thread polls on the input stream for in-coming commands. When a command is received, the command listener is notified. The polling thread is not started until the start method is called. Polling can be suspending by calling stop; however, because the read operation is blocking the transport my still pull one command off the wire even after the stop method has been called.
The close method will close the associated streams. Close can be called explicitly by the user, but is also called in the destructor. Once this object has been closed, it cannot be restarted.
| activemq::transport::IOTransport::IOTransport | ( | ) |
Default Constructor.
| activemq::transport::IOTransport::IOTransport | ( | const Pointer< wireformat::WireFormat > | wireFormat | ) |
Create an instance of this Transport and assign its WireFormat instance at creation time.
| wireFormat | Data encoder / decoder to use when reading and writing. |
| virtual activemq::transport::IOTransport::~IOTransport | ( | ) | [virtual] |
| virtual Pointer<FutureResponse> activemq::transport::IOTransport::asyncRequest | ( | const Pointer< Command > | command, | |
| const Pointer< ResponseCallback > | responseCallback | |||
| ) | [virtual] |
Sends a commands asynchronously, returning a FutureResponse object that the caller can use to check to find out the response from the broker.
| command | The Command object that is to sent out. | |
| responseCallback | A callback object that will be notified once a response to the command is received. |
| IOException | if an exception occurs during the read of the command. | |
| UnsupportedOperationException | if this method is not implemented by this transport. |
This method always thrown an UnsupportedOperationException.
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::close | ( | ) | [virtual] |
Closes this object and deallocates the appropriate resources.
The object is generally no longer usable after calling close.
| IOException | if an error occurs while closing. |
Implements decaf::io::Closeable.
| virtual std::string activemq::transport::IOTransport::getRemoteAddress | ( | ) | const [inline, virtual] |
Implements activemq::transport::Transport.
| virtual TransportListener* activemq::transport::IOTransport::getTransportListener | ( | ) | const [virtual] |
Gets the observer of asynchronous events from this transport.
Implements activemq::transport::Transport.
| virtual Pointer<wireformat::WireFormat> activemq::transport::IOTransport::getWireFormat | ( | ) | const [virtual] |
Gets the WireFormat instance that is in use by this transport.
In the case of nested transport this method delegates down to the lowest level transport that actually maintains a WireFormat info instance.
Implements activemq::transport::Transport.
| virtual bool activemq::transport::IOTransport::isClosed | ( | ) | const [virtual] |
Has the Transport been shutdown and no longer usable.
Implements activemq::transport::Transport.
| virtual bool activemq::transport::IOTransport::isConnected | ( | ) | const [virtual] |
Is the Transport Connected to its Broker.
Implements activemq::transport::Transport.
| virtual bool activemq::transport::IOTransport::isFaultTolerant | ( | ) | const [inline, virtual] |
Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect.
Implements activemq::transport::Transport.
| virtual bool activemq::transport::IOTransport::isReconnectSupported | ( | ) | const [inline, virtual] |
Implements activemq::transport::Transport.
| virtual bool activemq::transport::IOTransport::isUpdateURIsSupported | ( | ) | const [inline, virtual] |
Implements activemq::transport::Transport.
| virtual Transport* activemq::transport::IOTransport::narrow | ( | const std::type_info & | typeId | ) | [inline, virtual] |
Narrows down a Chain of Transports to a specific Transport to allow a higher level transport to skip intermediate Transports in certain circumstances.
| typeId | - The type_info of the Object we are searching for. |
Implements activemq::transport::Transport.
References NULL.
| virtual void activemq::transport::IOTransport::oneway | ( | const Pointer< Command > | command | ) | [virtual] |
Sends a one-way command.
Does not wait for any response from the broker.
| command | The command to be sent. |
| IOException | if an exception occurs during writing of the command. | |
| UnsupportedOperationException | if this method is not implemented by this transport. |
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::reconnect | ( | const decaf::net::URI &uri | AMQCPP_UNUSED | ) | [inline, virtual] |
This method does nothing in this subclass.
| virtual Pointer<Response> activemq::transport::IOTransport::request | ( | const Pointer< Command > | command, | |
| unsigned int | timeout | |||
| ) | [virtual] |
Sends the given command to the broker and then waits for the response.
| command | The command to be sent. | |
| timeout | The time to wait for this response. |
| IOException | if an exception occurs during the read of the command. | |
| UnsupportedOperationException | if this method is not implemented by this transport. |
This method always thrown an UnsupportedOperationException.
Implements activemq::transport::Transport.
| virtual Pointer<Response> activemq::transport::IOTransport::request | ( | const Pointer< Command > | command | ) | [virtual] |
Sends the given command to the broker and then waits for the response.
| command | the command to be sent. |
| IOException | if an exception occurs during the read of the command. | |
| UnsupportedOperationException | if this method is not implemented by this transport. |
This method always thrown an UnsupportedOperationException.
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::run | ( | ) | [virtual] |
Run method - called by the Thread class in the context of the thread.
Implements decaf::lang::Runnable.
| virtual void activemq::transport::IOTransport::setInputStream | ( | decaf::io::DataInputStream * | is | ) | [virtual] |
Sets the stream from which this Transport implementation will read its data.
| is | The InputStream that will be read from by this object. |
| virtual void activemq::transport::IOTransport::setOutputStream | ( | decaf::io::DataOutputStream * | os | ) | [virtual] |
Sets the stream to which this Transport implementation will write its data.
| os | The OuputStream that will be written to by this object. |
| virtual void activemq::transport::IOTransport::setTransportListener | ( | TransportListener * | listener | ) | [virtual] |
Sets the observer of asynchronous events from this transport.
| listener | the listener of transport events. |
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::setWireFormat | ( | const Pointer< wireformat::WireFormat > | wireFormat | ) | [virtual] |
Sets the WireFormat instance to use.
| wireFormat | The WireFormat the object used to encode / decode commands. |
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::start | ( | ) | [virtual] |
Starts the Transport, the send methods of a Transport will throw an exception if used before the Transport is started.
| IOException | if and error occurs while starting the Transport. |
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::stop | ( | ) | [virtual] |
Stops the Transport.
| IOException | if an error occurs while stopping the transport. |
Implements activemq::transport::Transport.
| virtual void activemq::transport::IOTransport::updateURIs | ( | bool rebalance | AMQCPP_UNUSED, | |
| const decaf::util::List< decaf::net::URI > &uris | AMQCPP_UNUSED | |||
| ) | [inline, virtual] |
1.6.1