org.apache.activemq.transport.fanout
Class FanoutTransport

java.lang.Object
  extended by org.apache.activemq.transport.fanout.FanoutTransport
All Implemented Interfaces:
Service, CompositeTransport, Transport

public class FanoutTransport
extends Object
implements CompositeTransport

A Transport that fans out a connection to multiple brokers.


Constructor Summary
FanoutTransport()
           
 
Method Summary
 void add(boolean reblance, URI[] uris)
           
 FutureResponse asyncRequest(Object command, ResponseCallback responseCallback)
          An asynchronous request response where the Receipt will be returned in the future.
 long getInitialReconnectDelay()
           
 int getMaxReconnectAttempts()
           
 long getMaxReconnectDelay()
           
 int getMinAckCount()
           
 int getReceiveCounter()
          Returns a counter which gets incremented as data is read from the transport.
 long getReconnectDelayExponent()
           
 String getRemoteAddress()
           
 TransportListener getTransportListener()
          Returns the current transport listener
 boolean isConnected()
           
 boolean isDisposed()
           
 boolean isFanOutQueues()
           
 boolean isFaultTolerant()
          Indicates if the transport can handle faults
 boolean isReconnectSupported()
           
 boolean isUpdateURIsSupported()
           
<T> T
narrow(Class<T> target)
           
 void oneway(Object o)
          A one way asynchronous send
 void reconnect()
           
 void reconnect(URI uri)
          reconnect to another location
 void remove(boolean rebalance, URI[] uris)
           
 Object request(Object command)
          A synchronous request response
 Object request(Object command, int timeout)
          A synchronous request response
protected  void restoreTransport(org.apache.activemq.transport.fanout.FanoutTransport.FanoutTransportHandler th)
           
 void setFanOutQueues(boolean fanOutQueues)
           
 void setInitialReconnectDelay(long initialReconnectDelay)
           
 void setMaxReconnectAttempts(int maxReconnectAttempts)
           
 void setMaxReconnectDelay(long maxReconnectDelay)
           
 void setMinAckCount(int minAckCount)
           
 void setReconnectDelayExponent(long reconnectDelayExponent)
           
 void setTransportListener(TransportListener commandListener)
          Registers an inbound command listener
 void start()
           
 void stop()
           
protected  void transportListenerOnCommand(Command command)
           
 void updateURIs(boolean reblance, URI[] uris)
          Provide a list of available alternative locations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FanoutTransport

public FanoutTransport()
                throws InterruptedIOException
Throws:
InterruptedIOException
Method Detail

start

public void start()
           throws Exception
Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Service
Throws:
Exception

getMinAckCount

public int getMinAckCount()

setMinAckCount

public void setMinAckCount(int minAckCount)

getInitialReconnectDelay

public long getInitialReconnectDelay()

setInitialReconnectDelay

public void setInitialReconnectDelay(long initialReconnectDelay)

getMaxReconnectDelay

public long getMaxReconnectDelay()

setMaxReconnectDelay

public void setMaxReconnectDelay(long maxReconnectDelay)

getReconnectDelayExponent

public long getReconnectDelayExponent()

setReconnectDelayExponent

public void setReconnectDelayExponent(long reconnectDelayExponent)

getMaxReconnectAttempts

public int getMaxReconnectAttempts()

setMaxReconnectAttempts

public void setMaxReconnectAttempts(int maxReconnectAttempts)

oneway

public void oneway(Object o)
            throws IOException
Description copied from interface: Transport
A one way asynchronous send

Specified by:
oneway in interface Transport
Throws:
IOException

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

reconnect

public void reconnect()

getTransportListener

public TransportListener getTransportListener()
Description copied from interface: Transport
Returns the current transport listener

Specified by:
getTransportListener in interface Transport
Returns:

setTransportListener

public void setTransportListener(TransportListener commandListener)
Description copied from interface: Transport
Registers an inbound command listener

Specified by:
setTransportListener in interface Transport

narrow

public <T> T narrow(Class<T> target)
Specified by:
narrow in interface Transport
Returns:
the target

restoreTransport

protected void restoreTransport(org.apache.activemq.transport.fanout.FanoutTransport.FanoutTransportHandler th)
                         throws Exception,
                                IOException
Throws:
Exception
IOException

add

public void add(boolean reblance,
                URI[] uris)
Specified by:
add in interface CompositeTransport

remove

public void remove(boolean rebalance,
                   URI[] uris)
Specified by:
remove in interface CompositeTransport

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

getRemoteAddress

public String getRemoteAddress()
Specified by:
getRemoteAddress in interface Transport
Returns:
the remote address for this connection

transportListenerOnCommand

protected void transportListenerOnCommand(Command command)

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

isFanOutQueues

public boolean isFanOutQueues()

setFanOutQueues

public void setFanOutQueues(boolean fanOutQueues)

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

getReceiveCounter

public int getReceiveCounter()
Description copied from interface: Transport
Returns a counter which gets incremented as data is read from the transport. It should only be used to determine if there is progress being made in reading the next command from the transport. The value may wrap into the negative numbers.

Specified by:
getReceiveCounter in interface Transport
Returns:
a counter which gets incremented as data is read from the transport.


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.