org.activemq.transport
Class NetworkChannel

java.lang.Object
  extended by org.activemq.transport.NetworkChannel
All Implemented Interfaces:
ConnectionAdvisoryEventListener, ConsumerInfoListener, Service, TransportStatusEventListener
Direct Known Subclasses:
RemoteNetworkChannel

public class NetworkChannel
extends Object
implements Service, ConsumerInfoListener, ConnectionAdvisoryEventListener, TransportStatusEventListener

Represents a broker's connection with a single remote broker which bridges the two brokers to form a network.

The NetworkChannel contains a JMS connection with the remote broker.

New subscriptions on the local broker are multiplexed into the JMS connection so that messages published on the remote broker can be replayed onto the local broker.

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  BrokerContainer brokerContainer
           
protected  ActiveMQConnection localConnection
           
protected  int maximumRetries
           
protected  ConcurrentHashMap queueConsumerMap
           
protected  long reconnectSleepTime
           
protected  String remoteBrokerName
           
protected  String remoteClusterName
           
protected  ActiveMQConnection remoteConnection
           
protected  String remotePassword
           
protected  String remoteUserName
           
protected  PooledExecutor threadPool
           
protected  ConcurrentHashMap topicConsumerMap
           
protected  String uri
           
 
Constructor Summary
NetworkChannel()
          Default constructor
NetworkChannel(NetworkConnector connector, BrokerContainer brokerContainer, String uri)
          Constructor
NetworkChannel(NetworkConnector connector, BrokerContainer brokerContainer, TransportChannel channel, String remoteBrokerName, String remoteclusterName)
          Create a NetworkConnector from a TransportChannel
NetworkChannel(PooledExecutor tp)
          Default Constructor
 
Method Summary
 BrokerContainer getBrokerContainer()
           
 ActiveMQPrefetchPolicy getLocalPrefetchPolicy()
           
 int getMaximumRetries()
           
 long getReconnectSleepTime()
           
 String getRemoteBrokerName()
           
 String getRemotePassword()
           
 ActiveMQPrefetchPolicy getRemotePrefetchPolicy()
           
 String getRemoteUserName()
           
protected  PooledExecutor getThreadPool()
           
 String getUri()
           
protected  void initialize()
           
 boolean isDemandBasedForwarding()
           
 void onConsumerInfo(BrokerClient client, ConsumerInfo info)
          Listen for new Consumer events at this broker
 void onEvent(ConnectionAdvisoryEvent event)
          Implementation of ConnectionAdvisoryEventListener
 void setBrokerContainer(BrokerContainer brokerContainer)
           
 void setDemandBasedForwarding(boolean demandBasedForwarding)
           
 void setLocalPrefetchPolicy(ActiveMQPrefetchPolicy localPrefetchPolicy)
           
 void setMaximumRetries(int maximumRetries)
           
 void setReconnectSleepTime(long reconnectSleepTime)
           
 void setRemoteBrokerName(String remoteBrokerName)
           
 void setRemotePassword(String remotePassword)
           
 void setRemotePrefetchPolicy(ActiveMQPrefetchPolicy remotePrefetchPolicy)
           
 void setRemoteUserName(String remoteUserName)
           
protected  void setThreadPool(PooledExecutor threadPool)
           
 void setUri(String uri)
          set the uri of the broker(s) this channel is connected to
 void start()
          Start the channel
 void statusChanged(TransportStatusEvent event)
          called when the status of a transport channel changes
 void stop()
          stop the channel
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uri

protected String uri

brokerContainer

protected BrokerContainer brokerContainer

localConnection

protected ActiveMQConnection localConnection

remoteConnection

protected ActiveMQConnection remoteConnection

topicConsumerMap

protected ConcurrentHashMap topicConsumerMap

queueConsumerMap

protected ConcurrentHashMap queueConsumerMap

remoteUserName

protected String remoteUserName

remotePassword

protected String remotePassword

remoteBrokerName

protected String remoteBrokerName

remoteClusterName

protected String remoteClusterName

maximumRetries

protected int maximumRetries

reconnectSleepTime

protected long reconnectSleepTime

threadPool

protected PooledExecutor threadPool
Constructor Detail

NetworkChannel

public NetworkChannel()
Default constructor


NetworkChannel

public NetworkChannel(PooledExecutor tp)
Default Constructor

Parameters:
tp -

NetworkChannel

public NetworkChannel(NetworkConnector connector,
                      BrokerContainer brokerContainer,
                      String uri)
Constructor

Parameters:
connector -
brokerContainer -
uri -

NetworkChannel

public NetworkChannel(NetworkConnector connector,
                      BrokerContainer brokerContainer,
                      TransportChannel channel,
                      String remoteBrokerName,
                      String remoteclusterName)
               throws JMSException
Create a NetworkConnector from a TransportChannel

Parameters:
connector -
brokerContainer -
channel -
remoteBrokerName -
remoteclusterName -
Throws:
JMSException
Method Detail

statusChanged

public void statusChanged(TransportStatusEvent event)
Description copied from interface: TransportStatusEventListener
called when the status of a transport channel changes

Specified by:
statusChanged in interface TransportStatusEventListener
See Also:
TransportStatusEventListener.statusChanged(org.activemq.transport.TransportStatusEvent)

toString

public String toString()
Overrides:
toString in class Object
Returns:
text info on this

start

public void start()
Start the channel

Specified by:
start in interface Service

stop

public void stop()
          throws JMSException
stop the channel

Specified by:
stop in interface Service
Throws:
JMSException - on error

onConsumerInfo

public void onConsumerInfo(BrokerClient client,
                           ConsumerInfo info)
Listen for new Consumer events at this broker

Specified by:
onConsumerInfo in interface ConsumerInfoListener
Parameters:
client -
info -

getUri

public String getUri()
Returns:
the uri of the broker(s) this channel is connected to

setUri

public void setUri(String uri)
set the uri of the broker(s) this channel is connected to

Parameters:
uri -

getRemotePassword

public String getRemotePassword()
Returns:
Returns the remotePassword.

setRemotePassword

public void setRemotePassword(String remotePassword)
Parameters:
remotePassword - The remotePassword to set.

getRemoteUserName

public String getRemoteUserName()
Returns:
Returns the remoteUserName.

setRemoteUserName

public void setRemoteUserName(String remoteUserName)
Parameters:
remoteUserName - The remoteUserName to set.

getBrokerContainer

public BrokerContainer getBrokerContainer()
Returns:
Returns the brokerContainer.

setBrokerContainer

public void setBrokerContainer(BrokerContainer brokerContainer)
Parameters:
brokerContainer - The brokerContainer to set.

getMaximumRetries

public int getMaximumRetries()

setMaximumRetries

public void setMaximumRetries(int maximumRetries)

getReconnectSleepTime

public long getReconnectSleepTime()

setReconnectSleepTime

public void setReconnectSleepTime(long reconnectSleepTime)

getRemoteBrokerName

public String getRemoteBrokerName()

setRemoteBrokerName

public void setRemoteBrokerName(String remoteBrokerName)

getThreadPool

protected PooledExecutor getThreadPool()
Returns:
Returns the threadPool.

setThreadPool

protected void setThreadPool(PooledExecutor threadPool)
Parameters:
threadPool - The threadPool to set.

getLocalPrefetchPolicy

public ActiveMQPrefetchPolicy getLocalPrefetchPolicy()
Returns:
Returns the localPrefetchPolicy.

setLocalPrefetchPolicy

public void setLocalPrefetchPolicy(ActiveMQPrefetchPolicy localPrefetchPolicy)
Parameters:
localPrefetchPolicy - The localPrefetchPolicy to set.

getRemotePrefetchPolicy

public ActiveMQPrefetchPolicy getRemotePrefetchPolicy()
Returns:
Returns the remotePrefetchPolicy.

setRemotePrefetchPolicy

public void setRemotePrefetchPolicy(ActiveMQPrefetchPolicy remotePrefetchPolicy)
Parameters:
remotePrefetchPolicy - The remotePrefetchPolicy to set.

isDemandBasedForwarding

public boolean isDemandBasedForwarding()
Returns:
Returns the demandBasedForwarding.

setDemandBasedForwarding

public void setDemandBasedForwarding(boolean demandBasedForwarding)
Parameters:
demandBasedForwarding - The demandBasedForwarding to set.

onEvent

public void onEvent(ConnectionAdvisoryEvent event)
Implementation of ConnectionAdvisoryEventListener

Specified by:
onEvent in interface ConnectionAdvisoryEventListener
Parameters:
event -

initialize

protected void initialize()
                   throws JMSException
Throws:
JMSException


Copyright © 2004-2009 Protique, Ltd.. All Rights Reserved.