org.codehaus.activemq.transport
Class NetworkChannel

java.lang.Object
  extended byorg.codehaus.activemq.transport.NetworkChannel
All Implemented Interfaces:
ConsumerInfoListener, Service
Direct Known Subclasses:
RemoteNetworkChannel

public class NetworkChannel
extends Object
implements Service, ConsumerInfoListener

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.6 $

Field Summary
protected  BrokerContainer brokerContainer
           
protected  ConcurrentHashMap consumerMap
           
protected  ActiveMQConnection localConnection
           
protected  int maximumRetries
           
protected  long reconnectSleepTime
           
protected  String remoteBrokerName
           
protected  String remoteClusterName
           
protected  ActiveMQConnection remoteConnection
           
protected  String remotePassword
           
protected  String remoteUserName
           
protected  PooledExecutor threadPool
           
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()
           
 ActiveMQConnection getLocalConnection()
           
 int getMaximumRetries()
           
 long getReconnectSleepTime()
           
 String getRemoteBrokerName()
           
 ActiveMQConnection getRemoteConnection()
           
 String getRemotePassword()
           
 String getRemoteUserName()
           
protected  PooledExecutor getThreadPool()
           
 String getUri()
           
protected  void initialize()
           
 void onConsumerInfo(BrokerClient client, ConsumerInfo info)
          Listen for new Consumer events at this broker
 void setBrokerContainer(BrokerContainer brokerContainer)
           
 void setMaximumRetries(int maximumRetries)
           
 void setReconnectSleepTime(long reconnectSleepTime)
           
 void setRemoteBrokerName(String remoteBrokerName)
           
 void setRemotePassword(String remotePassword)
           
 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 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

consumerMap

protected ConcurrentHashMap consumerMap

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

toString

public String toString()
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.

getLocalConnection

public ActiveMQConnection getLocalConnection()
                                      throws JMSException
Throws:
JMSException

getRemoteConnection

public ActiveMQConnection getRemoteConnection()
                                       throws JMSException
Throws:
JMSException

initialize

protected void initialize()
                   throws JMSException
Throws:
JMSException


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