Class TransportSupport

java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.transport.TransportSupport
All Implemented Interfaces:
Service, Transport
Direct Known Subclasses:
TransportThreadSupport

public abstract class TransportSupport extends ServiceSupport implements Transport
A useful base class for transport implementations.
  • Constructor Details

    • TransportSupport

      public TransportSupport()
  • Method Details

    • getTransportListener

      public TransportListener getTransportListener()
      Returns the current transport listener
      Specified by:
      getTransportListener in interface Transport
      Returns:
    • setTransportListener

      public void setTransportListener(TransportListener commandListener)
      Registers an inbound command listener
      Specified by:
      setTransportListener in interface Transport
      Parameters:
      commandListener -
    • narrow

      public <T> T narrow(Class<T> target)
      narrow acceptance
      Specified by:
      narrow in interface Transport
      Parameters:
      target -
      Returns:
      'this' if assignable
    • 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 interface Transport
      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 interface Transport
      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 interface Transport
      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 interface Transport
      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 interface Transport
      Throws:
      IOException - on failure of if not supported
    • isReconnectSupported

      public boolean isReconnectSupported()
      Specified by:
      isReconnectSupported in interface Transport
      Returns:
      true if reconnect is supported
    • isUpdateURIsSupported

      public boolean isUpdateURIsSupported()
      Specified by:
      isUpdateURIsSupported in interface Transport
      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 interface Transport
      Throws:
      IOException
    • isDisposed

      public boolean isDisposed()
      Specified by:
      isDisposed in interface Transport
      Returns:
      true if the transport is disposed
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface Transport
      Returns:
      true if the transport is connected