Package org.apache.activemq.transport
Class TransportSupport
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- org.apache.activemq.transport.TransportSupport
-
- Direct Known Subclasses:
AbstractMQTTSocket
,AbstractStompSocket
,AmqpWSTransport
,BlockingQueueTransport
,TransportThreadSupport
,WSTransportProxy
public abstract class TransportSupport extends ServiceSupport implements Transport
A useful base class for transport implementations.
-
-
Constructor Summary
Constructors Constructor Description TransportSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FutureResponse
asyncRequest(Object command, ResponseCallback responseCallback)
An asynchronous request response where the Receipt will be returned in the future.protected void
checkStarted()
void
doConsume(Object command)
Process the inbound commandTransportListener
getTransportListener()
Returns the current transport listenerboolean
isConnected()
boolean
isDisposed()
boolean
isFaultTolerant()
Indicates if the transport can handle faultsboolean
isReconnectSupported()
boolean
isUpdateURIsSupported()
<T> T
narrow(Class<T> target)
narrow acceptancevoid
onException(IOException e)
Passes any IO exceptions into the transport listenervoid
reconnect(URI uri)
reconnect to another locationObject
request(Object command)
A synchronous request responseObject
request(Object command, int timeout)
A synchronous request responsevoid
setTransportListener(TransportListener commandListener)
Registers an inbound command listenervoid
updateURIs(boolean reblance, URI[] uris)
Provide a list of available alternative locations-
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.transport.Transport
getPeerCertificates, getReceiveCounter, getRemoteAddress, getWireFormat, oneway, setPeerCertificates
-
-
-
-
Method Detail
-
getTransportListener
public TransportListener getTransportListener()
Returns the current transport listener- Specified by:
getTransportListener
in interfaceTransport
- Returns:
-
setTransportListener
public void setTransportListener(TransportListener commandListener)
Registers an inbound command listener- Specified by:
setTransportListener
in interfaceTransport
- Parameters:
commandListener
-
-
narrow
public <T> T narrow(Class<T> target)
narrow acceptance
-
asyncRequest
public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException
Description copied from interface:Transport
An asynchronous request response where the Receipt will be returned in the future. If responseCallback is not null, then it will be called when the response has been completed.- Specified by:
asyncRequest
in interfaceTransport
responseCallback
- TODO- Returns:
- the FutureResponse
- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:Transport
A synchronous request response- Specified by:
request
in interfaceTransport
- Returns:
- the response
- Throws:
IOException
-
request
public Object request(Object command, int timeout) throws IOException
Description copied from interface:Transport
A synchronous request response- Specified by:
request
in interfaceTransport
- Returns:
- the repsonse or null if timeout
- Throws:
IOException
-
doConsume
public void doConsume(Object command)
Process the inbound command
-
onException
public void onException(IOException e)
Passes any IO exceptions into the transport listener
-
checkStarted
protected void checkStarted() throws IOException
- Throws:
IOException
-
isFaultTolerant
public boolean isFaultTolerant()
Description copied from interface:Transport
Indicates if the transport can handle faults- Specified by:
isFaultTolerant
in interfaceTransport
- Returns:
- true if fault tolerant
-
reconnect
public void reconnect(URI uri) throws IOException
Description copied from interface:Transport
reconnect to another location- Specified by:
reconnect
in interfaceTransport
- Throws:
IOException
- on failure of if not supported
-
isReconnectSupported
public boolean isReconnectSupported()
- Specified by:
isReconnectSupported
in interfaceTransport
- Returns:
- true if reconnect is supported
-
isUpdateURIsSupported
public boolean isUpdateURIsSupported()
- Specified by:
isUpdateURIsSupported
in interfaceTransport
- Returns:
- true if updating uris is supported
-
updateURIs
public void updateURIs(boolean reblance, URI[] uris) throws IOException
Description copied from interface:Transport
Provide a list of available alternative locations- Specified by:
updateURIs
in interfaceTransport
- Throws:
IOException
-
isDisposed
public boolean isDisposed()
- Specified by:
isDisposed
in interfaceTransport
- Returns:
- true if the transport is disposed
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceTransport
- Returns:
- true if the transport is connected
-
-