activemq-cpp-3.6.0
activemq::transport::tcp::TcpTransport Class Reference

Implements a TCP/IP based transport filter, this transport is meant to wrap an instance of an IOTransport. More...

#include <src/main/activemq/transport/tcp/TcpTransport.h>

Inheritance diagram for activemq::transport::tcp::TcpTransport:

Public Member Functions

 TcpTransport (const Pointer< Transport > next, const decaf::net::URI &location)
 Creates a new instance of a TcpTransport, the transport is left unconnected and is in a unusable state until the connect method is called.
virtual ~TcpTransport ()
void setConnectTimeout (int soConnectTimeout)
int getConnectTimeout () const
void setOutputBufferSize (int outputBufferSize)
int getOutputBufferSize () const
void setInputBufferSize (int inputBufferSize)
int getInputBufferSize () const
void setTrace (bool trace)
bool isTrace () const
void setLinger (int soLinger)
int getLinger () const
void setKeepAlive (bool soKeepAlive)
bool isKeepAlive () const
void setReceiveBufferSize (int soReceiveBufferSize)
int getReceiveBufferSize () const
void setSendBufferSize (int soSendBufferSize)
int getSendBufferSize () const
void setTcpNoDelay (bool tcpNoDelay)
bool isTcpNoDelay () const
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.
- Public Member Functions inherited from activemq::transport::TransportFilter
 TransportFilter (const Pointer< Transport > next)
 Constructor.
virtual ~TransportFilter ()
void start ()
 Starts the Transport, the send methods of a Transport will throw an exception if used before the Transport is started.
void stop ()
 Stops the Transport.
void close ()
 Closes this object and deallocates the appropriate resources.
virtual void onCommand (const Pointer< Command > command)
 Event handler for the receipt of a command.
virtual void onException (const decaf::lang::Exception &ex)
 Event handler for an exception from a command transport.
virtual void transportInterrupted ()
 The transport has suffered an interruption from which it hopes to recover.
virtual void transportResumed ()
 The transport has resumed after an interruption.
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.
virtual Pointer< Responserequest (const Pointer< Command > command)
 Sends the given command to the broker and then waits for the response.
virtual Pointer< Responserequest (const Pointer< Command > command, unsigned int timeout)
 Sends the given command to the broker and then waits for the response.
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 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 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 isReconnectSupported () const
virtual bool isUpdateURIsSupported () const
virtual bool isClosed () const
 Has the Transport been shutdown and no longer usable.
virtual std::string getRemoteAddress () const
virtual void reconnect (const decaf::net::URI &uri)
 reconnect to another location
virtual void updateURIs (bool rebalance, const decaf::util::List< decaf::net::URI > &uris)
 Updates the set of URIs the Transport can connect to.
- Public Member Functions inherited from activemq::transport::Transport
virtual ~Transport ()
- Public Member Functions inherited from decaf::io::Closeable
virtual ~Closeable ()
- Public Member Functions inherited from activemq::transport::TransportListener
virtual ~TransportListener ()

Protected Member Functions

virtual void beforeNextIsStarted ()
 Subclasses can override this method to do their own startup work.
virtual void afterNextIsStopped ()
 Subclasses can override this method to do their own stop work.
virtual void doClose ()
 Subclasses can override this method to do their own close work.
void connect ()
 Creates a Socket and configures it before attempting to connect to the location specified by the URI passed in.
virtual decaf::net::SocketcreateSocket ()
 Create an unconnected Socket instance to be used by the transport to communicate with the broker.
virtual void configureSocket (decaf::net::Socket *socket)
 Using options from configuration URI, configure the socket options before the Socket instance is connected to the Server.
- Protected Member Functions inherited from activemq::transport::TransportFilter
void checkClosed () const
 Throws an IOException if this filter chain has already been closed.
virtual void afterNextIsStarted ()
 Subclasses can override this method to do their own post startup work.
virtual void beforeNextIsStopped ()
 Subclasses can override this method to do their own pre-stop work.

Additional Inherited Members

- Protected Attributes inherited from activemq::transport::TransportFilter
Pointer< Transportnext
 The transport that this filter wraps around.
TransportListenerlistener
 Listener of this transport.

Detailed Description

Implements a TCP/IP based transport filter, this transport is meant to wrap an instance of an IOTransport.

The lower level transport should take care of managing stream reads and writes.

Constructor & Destructor Documentation

activemq::transport::tcp::TcpTransport::TcpTransport ( const Pointer< Transport next,
const decaf::net::URI location 
)

Creates a new instance of a TcpTransport, the transport is left unconnected and is in a unusable state until the connect method is called.

Parameters
nextThe next transport in the chain
locationThe URI of the host this transport is to connect to.
virtual activemq::transport::tcp::TcpTransport::~TcpTransport ( )
virtual

Member Function Documentation

virtual void activemq::transport::tcp::TcpTransport::afterNextIsStopped ( )
protectedvirtual

Subclasses can override this method to do their own stop work.

This method is always called after all the next transports have been stopped to prevent this transport for destroying resources needed by the lower level transports.

Reimplemented from activemq::transport::TransportFilter.

virtual void activemq::transport::tcp::TcpTransport::beforeNextIsStarted ( )
protectedvirtual

Subclasses can override this method to do their own startup work.

This method will always be called before the next transport in the chain is called in order to allow this transport a chance to initialize required resources.

Reimplemented from activemq::transport::TransportFilter.

virtual void activemq::transport::tcp::TcpTransport::configureSocket ( decaf::net::Socket socket)
protectedvirtual

Using options from configuration URI, configure the socket options before the Socket instance is connected to the Server.

Subclasses can override this option to set more configuration options, they should called the base class version to allow the default set of Socket options to also be configured.

Parameters
socketThe Socket instance to configure using options from the given Properties.
Exceptions
NullPointerExceptionif the Socket instance is null.
IllegalArgumentExceptionif the socket instance is not handled by the class.
SocketExceptionif there is an error while setting one of the Socket options.

Reimplemented in activemq::transport::tcp::SslTransport.

void activemq::transport::tcp::TcpTransport::connect ( )
protected

Creates a Socket and configures it before attempting to connect to the location specified by the URI passed in.

virtual decaf::net::Socket* activemq::transport::tcp::TcpTransport::createSocket ( )
protectedvirtual

Create an unconnected Socket instance to be used by the transport to communicate with the broker.

Returns
a newly created unconnected Socket instance.
Exceptions
IOExceptionif there is an error while creating the unconnected Socket.

Reimplemented in activemq::transport::tcp::SslTransport.

virtual void activemq::transport::tcp::TcpTransport::doClose ( )
protectedvirtual

Subclasses can override this method to do their own close work.

This method is always called after all the next transports have been closed to prevent this transport for destroying resources needed by the lower level transports.

Reimplemented from activemq::transport::TransportFilter.

int activemq::transport::tcp::TcpTransport::getConnectTimeout ( ) const
int activemq::transport::tcp::TcpTransport::getInputBufferSize ( ) const
int activemq::transport::tcp::TcpTransport::getLinger ( ) const
int activemq::transport::tcp::TcpTransport::getOutputBufferSize ( ) const
int activemq::transport::tcp::TcpTransport::getReceiveBufferSize ( ) const
int activemq::transport::tcp::TcpTransport::getSendBufferSize ( ) const
virtual bool activemq::transport::tcp::TcpTransport::isConnected ( ) const
virtual

Is the Transport Connected to its Broker.

Returns
true if a connection has been made.

Reimplemented from activemq::transport::TransportFilter.

virtual bool activemq::transport::tcp::TcpTransport::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.

Reimplemented from activemq::transport::TransportFilter.

bool activemq::transport::tcp::TcpTransport::isKeepAlive ( ) const
bool activemq::transport::tcp::TcpTransport::isTcpNoDelay ( ) const
bool activemq::transport::tcp::TcpTransport::isTrace ( ) const
void activemq::transport::tcp::TcpTransport::setConnectTimeout ( int  soConnectTimeout)
void activemq::transport::tcp::TcpTransport::setInputBufferSize ( int  inputBufferSize)
void activemq::transport::tcp::TcpTransport::setKeepAlive ( bool  soKeepAlive)
void activemq::transport::tcp::TcpTransport::setLinger ( int  soLinger)
void activemq::transport::tcp::TcpTransport::setOutputBufferSize ( int  outputBufferSize)
void activemq::transport::tcp::TcpTransport::setReceiveBufferSize ( int  soReceiveBufferSize)
void activemq::transport::tcp::TcpTransport::setSendBufferSize ( int  soSendBufferSize)
void activemq::transport::tcp::TcpTransport::setTcpNoDelay ( bool  tcpNoDelay)
void activemq::transport::tcp::TcpTransport::setTrace ( bool  trace)

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