org.activemq.broker.impl
Class BrokerClientImpl

java.lang.Object
  extended by org.activemq.broker.impl.BrokerClientImpl
All Implemented Interfaces:
ExceptionListener, BrokerClient, PacketListener, Service

public class BrokerClientImpl
extends Object
implements BrokerClient, ExceptionListener, PacketListener

A Broker client side proxy representing a JMS Connnection

Version:
$Revision: 1.1.1.1 $

Constructor Summary
BrokerClientImpl()
          Default Constructor of BrokerClientImpl
 
Method Summary
 void cleanUp()
          cleanup
protected  void close()
           
 void consume(Packet packet)
          Consume a Packet from the underlying TransportChannel for processing
 void consumeConnectionInfo(ConnectionInfo info)
          register with the Broker
 void consumeConsumerInfo(ConsumerInfo info)
          Register/deregister MessageConsumer with the Broker
 void dispatch(ActiveMQMessage message)
          Dispatch an ActiveMQMessage to the end client
 BrokerConnector getBrokerConnector()
           
 int getCapacity()
          Get the Capacity for in-progress messages at the peer (probably a JMSConnection) Legimate values between 0-100.
 TransportChannel getChannel()
           
 String getClientID()
           
 ConnectionInfo getConnectionInfo()
           
 Subject getSubject()
           
 void initialize(BrokerConnector brokerConnector, TransportChannel channel)
          Initialize the BrokerClient
 boolean isBrokerConnection()
           
 boolean isClusteredConnection()
           
 boolean isSlowConsumer()
          Get an indication if the peer should be considered as a slow consumer
 void onException(JMSException jmsEx)
           
protected  void send(Packet packet)
           
 void setSubject(Subject subject)
          Associcates a subject with BrokerClient.
 void start()
          start consuming messages
 void stop()
          stop consuming messages
 String toString()
           
 void updateBrokerCapacity(int capacity)
          Update the peer Connection about the Broker's capacity for messages
 void validateConnection(int timeout)
          validate the connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BrokerClientImpl

public BrokerClientImpl()
Default Constructor of BrokerClientImpl

Method Detail

initialize

public void initialize(BrokerConnector brokerConnector,
                       TransportChannel channel)
Initialize the BrokerClient

Specified by:
initialize in interface BrokerClient
Parameters:
brokerConnector -
channel -

getBrokerConnector

public BrokerConnector getBrokerConnector()
Specified by:
getBrokerConnector in interface BrokerClient
Returns:
the BrokerConnector this client is associated with

getConnectionInfo

public ConnectionInfo getConnectionInfo()
Specified by:
getConnectionInfo in interface BrokerClient
Returns:
the connection information for this client

onException

public void onException(JMSException jmsEx)
Specified by:
onException in interface ExceptionListener
See Also:
ExceptionListener.onException(javax.jms.JMSException)

toString

public String toString()
Overrides:
toString in class Object
Returns:
pretty print for this brokerConnector-client

dispatch

public void dispatch(ActiveMQMessage message)
Dispatch an ActiveMQMessage to the end client

Specified by:
dispatch in interface BrokerClient
Parameters:
message -

isBrokerConnection

public boolean isBrokerConnection()
Specified by:
isBrokerConnection in interface BrokerClient
Returns:
true if the peer for this Client is itself another Broker

isClusteredConnection

public boolean isClusteredConnection()
Specified by:
isClusteredConnection in interface BrokerClient
Returns:
true id this client is part of a cluster

getCapacity

public int getCapacity()
Get the Capacity for in-progress messages at the peer (probably a JMSConnection) Legimate values between 0-100. 0 capacity representing that the peer cannot process any more messages at the current time

Specified by:
getCapacity in interface BrokerClient
Returns:

getClientID

public String getClientID()
Specified by:
getClientID in interface BrokerClient
Returns:
the client id of the remote connection

getChannel

public TransportChannel getChannel()
Specified by:
getChannel in interface BrokerClient
Returns:
the channel used

isSlowConsumer

public boolean isSlowConsumer()
Get an indication if the peer should be considered as a slow consumer

Specified by:
isSlowConsumer in interface BrokerClient
Returns:
true id the peer should be considered as a slow consumer

consume

public void consume(Packet packet)
Consume a Packet from the underlying TransportChannel for processing

Specified by:
consume in interface PacketListener
Parameters:
packet -

consumeConsumerInfo

public void consumeConsumerInfo(ConsumerInfo info)
                         throws JMSException
Register/deregister MessageConsumer with the Broker

Parameters:
info -
Throws:
JMSException

updateBrokerCapacity

public void updateBrokerCapacity(int capacity)
Update the peer Connection about the Broker's capacity for messages

Specified by:
updateBrokerCapacity in interface BrokerClient
Parameters:
capacity -

consumeConnectionInfo

public void consumeConnectionInfo(ConnectionInfo info)
                           throws JMSException
register with the Broker

Parameters:
info -
Throws:
JMSException

start

public void start()
           throws JMSException
start consuming messages

Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
stop consuming messages

Specified by:
stop in interface Service
Throws:
JMSException

cleanUp

public void cleanUp()
cleanup

Specified by:
cleanUp in interface BrokerClient

send

protected void send(Packet packet)

validateConnection

public void validateConnection(int timeout)
                        throws JMSException
validate the connection

Specified by:
validateConnection in interface BrokerClient
Parameters:
timeout -
Throws:
JMSException

close

protected void close()

setSubject

public void setSubject(Subject subject)
Description copied from interface: BrokerClient
Associcates a subject with BrokerClient.

Specified by:
setSubject in interface BrokerClient
Parameters:
subject -

getSubject

public Subject getSubject()
Specified by:
getSubject in interface BrokerClient
Returns:
the subject


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