org.activemq.transport
Class NetworkChannel

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

public class NetworkChannel
extends java.lang.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  EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap queueConsumerMap
           
protected  long reconnectSleepTime
           
protected  java.lang.String remoteBrokerName
           
protected  java.lang.String remoteClusterName
           
protected  ActiveMQConnection remoteConnection
           
protected  java.lang.String remotePassword
           
protected  java.lang.String remoteUserName
           
protected  EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool
           
protected  EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap topicConsumerMap
           
protected  java.lang.String uri
           
 
Constructor Summary
NetworkChannel()
          Default constructor
NetworkChannel(NetworkConnector connector, BrokerContainer brokerContainer, java.lang.String uri)
          Constructor
NetworkChannel(NetworkConnector connector, BrokerContainer brokerContainer, TransportChannel channel, java.lang.String remoteBrokerName, java.lang.String remoteclusterName)
          Create a NetworkConnector from a TransportChannel
NetworkChannel(EDU.oswego.cs.dl.util.concurrent.PooledExecutor tp)
          Default Constructor
 
Method Summary
 BrokerContainer getBrokerContainer()
           
 ActiveMQPrefetchPolicy getLocalPrefetchPolicy()
           
 int getMaximumRetries()
           
 long getReconnectSleepTime()
           
 java.lang.String getRemoteBrokerName()
           
 java.lang.String getRemotePassword()
           
 ActiveMQPrefetchPolicy getRemotePrefetchPolicy()
           
 java.lang.String getRemoteUserName()
           
protected  EDU.oswego.cs.dl.util.concurrent.PooledExecutor getThreadPool()
           
 java.lang.String getUri()
           
protected  void initialize()
           
 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 setLocalPrefetchPolicy(ActiveMQPrefetchPolicy localPrefetchPolicy)
           
 void setMaximumRetries(int maximumRetries)
           
 void setReconnectSleepTime(long reconnectSleepTime)
           
 void setRemoteBrokerName(java.lang.String remoteBrokerName)
           
 void setRemotePassword(java.lang.String remotePassword)
           
 void setRemotePrefetchPolicy(ActiveMQPrefetchPolicy remotePrefetchPolicy)
           
 void setRemoteUserName(java.lang.String remoteUserName)
           
protected  void setThreadPool(EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool)
           
 void setUri(java.lang.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
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uri

protected java.lang.String uri

brokerContainer

protected BrokerContainer brokerContainer

localConnection

protected ActiveMQConnection localConnection

remoteConnection

protected ActiveMQConnection remoteConnection

topicConsumerMap

protected EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap topicConsumerMap

queueConsumerMap

protected EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap queueConsumerMap

remoteUserName

protected java.lang.String remoteUserName

remotePassword

protected java.lang.String remotePassword

remoteBrokerName

protected java.lang.String remoteBrokerName

remoteClusterName

protected java.lang.String remoteClusterName

maximumRetries

protected int maximumRetries

reconnectSleepTime

protected long reconnectSleepTime

threadPool

protected EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool
Constructor Detail

NetworkChannel

public NetworkChannel()
Default constructor


NetworkChannel

public NetworkChannel(EDU.oswego.cs.dl.util.concurrent.PooledExecutor tp)
Default Constructor

Parameters:
tp -

NetworkChannel

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

Parameters:
connector -
brokerContainer -
uri -

NetworkChannel

public NetworkChannel(NetworkConnector connector,
                      BrokerContainer brokerContainer,
                      TransportChannel channel,
                      java.lang.String remoteBrokerName,
                      java.lang.String remoteclusterName)
               throws javax.jms.JMSException
Create a NetworkConnector from a TransportChannel

Parameters:
connector -
brokerContainer -
channel -
remoteBrokerName -
remoteclusterName -
Throws:
javax.jms.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
Parameters:
event -
See Also:
TransportStatusEventListener.statusChanged(org.activemq.transport.TransportStatusEvent)

toString

public java.lang.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 javax.jms.JMSException
stop the channel

Specified by:
stop in interface Service
Throws:
javax.jms.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 java.lang.String getUri()
Returns:
the uri of the broker(s) this channel is connected to

setUri

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

Parameters:
uri -

getRemotePassword

public java.lang.String getRemotePassword()
Returns:
Returns the remotePassword.

setRemotePassword

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

getRemoteUserName

public java.lang.String getRemoteUserName()
Returns:
Returns the remoteUserName.

setRemoteUserName

public void setRemoteUserName(java.lang.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 java.lang.String getRemoteBrokerName()

setRemoteBrokerName

public void setRemoteBrokerName(java.lang.String remoteBrokerName)

getThreadPool

protected EDU.oswego.cs.dl.util.concurrent.PooledExecutor getThreadPool()
Returns:
Returns the threadPool.

setThreadPool

protected void setThreadPool(EDU.oswego.cs.dl.util.concurrent.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.

onEvent

public void onEvent(ConnectionAdvisoryEvent event)
Implementation of ConnectionAdvisoryEventListener

Specified by:
onEvent in interface ConnectionAdvisoryEventListener
Parameters:
event -

initialize

protected void initialize()
                   throws javax.jms.JMSException
Throws:
javax.jms.JMSException


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