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 FutureResponseasyncRequest(Object command, ResponseCallback responseCallback)An asynchronous request response where the Receipt will be returned in the future.protected voidcheckStarted()voiddoConsume(Object command)Process the inbound commandTransportListenergetTransportListener()Returns the current transport listenerbooleanisConnected()booleanisDisposed()booleanisFaultTolerant()Indicates if the transport can handle faultsbooleanisReconnectSupported()booleanisUpdateURIsSupported()<T> Tnarrow(Class<T> target)narrow acceptancevoidonException(IOException e)Passes any IO exceptions into the transport listenervoidreconnect(URI uri)reconnect to another locationObjectrequest(Object command)A synchronous request responseObjectrequest(Object command, int timeout)A synchronous request responsevoidsetTransportListener(TransportListener commandListener)Registers an inbound command listenervoidupdateURIs(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:
getTransportListenerin interfaceTransport- Returns:
-
setTransportListener
public void setTransportListener(TransportListener commandListener)
Registers an inbound command listener- Specified by:
setTransportListenerin 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:TransportAn 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:
asyncRequestin interfaceTransportresponseCallback- TODO- Returns:
- the FutureResponse
- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Returns:
- the response
- Throws:
IOException
-
request
public Object request(Object command, int timeout) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin 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:TransportIndicates if the transport can handle faults- Specified by:
isFaultTolerantin interfaceTransport- Returns:
- true if fault tolerant
-
reconnect
public void reconnect(URI uri) throws IOException
Description copied from interface:Transportreconnect to another location- Specified by:
reconnectin interfaceTransport- Throws:
IOException- on failure of if not supported
-
isReconnectSupported
public boolean isReconnectSupported()
- Specified by:
isReconnectSupportedin interfaceTransport- Returns:
- true if reconnect is supported
-
isUpdateURIsSupported
public boolean isUpdateURIsSupported()
- Specified by:
isUpdateURIsSupportedin interfaceTransport- Returns:
- true if updating uris is supported
-
updateURIs
public void updateURIs(boolean reblance, URI[] uris) throws IOExceptionDescription copied from interface:TransportProvide a list of available alternative locations- Specified by:
updateURIsin interfaceTransport- Throws:
IOException
-
isDisposed
public boolean isDisposed()
- Specified by:
isDisposedin interfaceTransport- Returns:
- true if the transport is disposed
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceTransport- Returns:
- true if the transport is connected
-
-