activemq-cpp-3.6.0
activemq::transport::IOTransport Class Reference

Implementation of the Transport interface that performs marshaling of commands to IO streams. More...

#include <src/main/activemq/transport/IOTransport.h>

Inheritance diagram for activemq::transport::IOTransport:

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< FutureResponseasyncRequest (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.
Parameters
commandThe Command object that is to sent out.
responseCallbackA callback object that will be notified once a response to the command is received.
Returns
A FutureResponse instance that can be queried for the Response to the Command.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif this method is not implemented by this transport.

virtual Pointer< Responserequest (const Pointer< Command > command)
 Sends the given command to the broker and then waits for the response.
Parameters
commandthe command to be sent.
Returns
the response from the broker.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif this method is not implemented by this transport.

virtual Pointer< Responserequest (const Pointer< Command > command, unsigned int timeout)
 Sends the given command to the broker and then waits for the response.
Parameters
commandThe command to be sent.
timeoutThe time to wait for this response.
Returns
the response from the broker.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif this method is not implemented by this transport.

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 TransportListenergetTransportListener () 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 Transportnarrow (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.
- Public Member Functions inherited from activemq::transport::Transport
virtual ~Transport ()
virtual void reconnect (const decaf::net::URI &uri)=0
 reconnect to another location
virtual void updateURIs (bool rebalance, const decaf::util::List< decaf::net::URI > &uris)=0
 Updates the set of URIs the Transport can connect to.
- Public Member Functions inherited from decaf::io::Closeable
virtual ~Closeable ()
- Public Member Functions inherited from decaf::lang::Runnable
virtual ~Runnable ()

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
wireFormatData encoder / decoder to use when reading and writing.
virtual activemq::transport::IOTransport::~IOTransport ( )
virtual

Member Function Documentation

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.

Parameters
commandThe Command object that is to sent out.
responseCallbackA callback object that will be notified once a response to the command is received.
Returns
A FutureResponse instance that can be queried for the Response to the Command.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif 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.

Exceptions
IOExceptionif an error occurs while closing.

Implements decaf::io::Closeable.

virtual std::string activemq::transport::IOTransport::getRemoteAddress ( ) const
inlinevirtual
Returns
the remote address for this connection

Implements activemq::transport::Transport.

virtual TransportListener* activemq::transport::IOTransport::getTransportListener ( ) const
virtual

Gets the observer of asynchronous events from this transport.

Returns
the listener of transport events.

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.

Returns
The WireFormat the object used to encode / decode commands.

Implements activemq::transport::Transport.

virtual bool activemq::transport::IOTransport::isClosed ( ) const
virtual

Has the Transport been shutdown and no longer usable.

Returns
true if the Transport

Implements activemq::transport::Transport.

virtual bool activemq::transport::IOTransport::isConnected ( ) const
virtual

Is the Transport Connected to its Broker.

Returns
true if a connection has been made.

Implements activemq::transport::Transport.

virtual bool activemq::transport::IOTransport::isFaultTolerant ( ) const
inlinevirtual

Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect.

Returns
true if the Transport is fault tolerant.

Implements activemq::transport::Transport.

virtual bool activemq::transport::IOTransport::isReconnectSupported ( ) const
inlinevirtual
Returns
true if reconnect is supported.

Implements activemq::transport::Transport.

virtual bool activemq::transport::IOTransport::isUpdateURIsSupported ( ) const
inlinevirtual
Returns
true if updating uris is supported.

Implements activemq::transport::Transport.

virtual Transport* activemq::transport::IOTransport::narrow ( const std::type_info &  typeId)
inlinevirtual

Narrows down a Chain of Transports to a specific Transport to allow a higher level transport to skip intermediate Transports in certain circumstances.

Parameters
typeId- The type_info of the Object we are searching for.
Returns
the requested Object. or NULL if its not in this chain.

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.

Parameters
commandThe command to be sent.
Exceptions
IOExceptionif an exception occurs during writing of the command.
UnsupportedOperationExceptionif 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)
inlinevirtual

This method does nothing in this subclass.

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.

Parameters
commandthe command to be sent.
Returns
the response from the broker.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif 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,
unsigned int  timeout 
)
virtual

Sends the given command to the broker and then waits for the response.

Parameters
commandThe command to be sent.
timeoutThe time to wait for this response.
Returns
the response from the broker.
Exceptions
IOExceptionif an exception occurs during the read of the command.
UnsupportedOperationExceptionif 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.

Parameters
isThe 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.

Parameters
osThe 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.

Parameters
listenerthe 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.

Parameters
wireFormatThe 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.

Exceptions
IOExceptionif and error occurs while starting the Transport.

Implements activemq::transport::Transport.

virtual void activemq::transport::IOTransport::stop ( )
virtual

Stops the Transport.

Exceptions
IOExceptionif 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 
)
inlinevirtual

The documentation for this class was generated from the following file: