org.codehaus.activemq.broker.impl
Class BrokerClientImpl

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

public class BrokerClientImpl
extends Object
implements BrokerClient, ExceptionListener, PacketListener

A Broker client side proxy representing a JMS Connnection

Version:
$Revision: 1.25 $

Constructor Summary
BrokerClientImpl()
          Default Constructor of BrokerClientImpl
 
Method Summary
 void cleanUp()
          Called when the transport has been terminated, so do our best to shut down any resources and deregister from any subscriptions etc
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()
           
 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 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
 
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

onException

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

toString

public String toString()
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 for this client if the client has been initialised

getChannel

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

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()
Description copied from interface: BrokerClient
Called when the transport has been terminated, so do our best to shut down any resources and deregister from any subscriptions etc

Specified by:
cleanUp in interface BrokerClient

send

protected void send(Packet packet)

close

protected void close()


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