org.activemq.broker.impl
Class BrokerConnectorImpl

java.lang.Object
  extended by org.activemq.broker.impl.BrokerConnectorImpl
All Implemented Interfaces:
BrokerConnector, Service, TransportChannelListener

public class BrokerConnectorImpl
extends Object
implements BrokerConnector, TransportChannelListener

An implementation of the broker (the JMS server)

Version:
$Revision: 1.1.1.1 $

Constructor Summary
BrokerConnectorImpl(BrokerContainer container)
           
BrokerConnectorImpl(BrokerContainer container, String bindAddress, WireFormat wireFormat)
          Helper constructor for TCP protocol with the given bind address
BrokerConnectorImpl(BrokerContainer container, TransportServerChannel serverChannel)
           
 
Method Summary
 void acknowledgeMessage(BrokerClient client, MessageAck ack)
          Acknowledge reciept of a message
 void addClient(TransportChannel channel)
          Called when a new channel is added to a server
 void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase)
          Commit an XA transaction.
 void commitTransaction(BrokerClient client, String transactionId)
          Commit a transaction
protected static TransportServerChannel createTransportServerChannel(WireFormat wireFormat, String bindAddress)
          Factory method ot create a transport channel
 void deregisterClient(BrokerClient client, ConnectionInfo info)
          Deregister a Broker Client
 void deregisterMessageConsumer(BrokerClient client, ConsumerInfo info)
          De-register a MessageConsumer from the Broker
 void deregisterMessageProducer(BrokerClient client, ProducerInfo info)
          De-register a MessageProducer from the Broker
 void deregisterSession(BrokerClient client, SessionInfo info)
          De-register a client-side Session from the Broker (used for monitoring)
 void durableUnsubscribe(BrokerClient client, DurableUnsubscribe ds)
          Command to delete a durable topic subscription
 int getBrokerCapacity()
          Get a hint about the broker capacity for more messages
 BrokerContainer getBrokerContainer()
           
 BrokerInfo getBrokerInfo()
           
 ActiveMQXid[] getPreparedTransactions(BrokerClient client)
          Gets the prepared XA transactions.
 String getResourceManagerId(BrokerClient client)
          Gets the unique id of the resource manager used for managing xa transactions.
 TransportServerChannel getServerChannel()
           
 int prepareTransaction(BrokerClient client, ActiveMQXid xid)
          Prepare an XA transaction.
 void registerClient(BrokerClient client, ConnectionInfo info)
          Register a Broker Client
 void registerMessageConsumer(BrokerClient client, ConsumerInfo info)
          Registers a MessageConsumer
 void registerMessageProducer(BrokerClient client, ProducerInfo info)
          Registers a MessageProducer
 void registerSession(BrokerClient client, SessionInfo info)
          Register a client-side Session (used for Monitoring)
 void removeClient(TransportChannel channel)
          Called when a channel has been closed and removed from a server
 void rollbackTransaction(BrokerClient client, ActiveMQXid xid)
          Rollback an XA transaction.
 void rollbackTransaction(BrokerClient client, String transactionId)
          Rollback a transacton
 void sendMessage(BrokerClient client, ActiveMQMessage message)
          Send a non-transacted message to the Broker
 void start()
          start the Broker
 void startTransaction(BrokerClient client, ActiveMQXid xid)
          Start an XA transaction.
 void startTransaction(BrokerClient client, String transactionId)
          Start a transaction from the Client session
 void stop()
          Stop the Broker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrokerConnectorImpl

public BrokerConnectorImpl(BrokerContainer container,
                           String bindAddress,
                           WireFormat wireFormat)
                    throws JMSException
Helper constructor for TCP protocol with the given bind address

Parameters:
container -
bindAddress -
Throws:
JMSException

BrokerConnectorImpl

public BrokerConnectorImpl(BrokerContainer container,
                           TransportServerChannel serverChannel)
Parameters:
container -
serverChannel -

BrokerConnectorImpl

public BrokerConnectorImpl(BrokerContainer container)
Parameters:
container -
serverChannel -
Method Detail

getBrokerInfo

public BrokerInfo getBrokerInfo()
Specified by:
getBrokerInfo in interface BrokerConnector
Returns:
infomation about the Broker

getBrokerCapacity

public int getBrokerCapacity()
Get a hint about the broker capacity for more messages

Specified by:
getBrokerCapacity in interface BrokerConnector
Returns:
percentage value (0-100) about how much capacity the broker has

getServerChannel

public TransportServerChannel getServerChannel()
Specified by:
getServerChannel in interface BrokerConnector
Returns:
Get the server channel

start

public void start()
           throws JMSException
start the Broker

Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
Stop the Broker

Specified by:
stop in interface Service
Throws:
JMSException

registerClient

public void registerClient(BrokerClient client,
                           ConnectionInfo info)
                    throws JMSException
Register a Broker Client

Specified by:
registerClient in interface BrokerConnector
Parameters:
client -
info - contains infomation about the Connection this Client represents
Throws:
JMSException
InvalidClientIDException - if the JMS client specifies an invalid or duplicate client ID.
JMSSecurityException - if client authentication fails due to an invalid user name or password.

deregisterClient

public void deregisterClient(BrokerClient client,
                             ConnectionInfo info)
                      throws JMSException
Deregister a Broker Client

Specified by:
deregisterClient in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException - if some internal error occurs

registerMessageConsumer

public void registerMessageConsumer(BrokerClient client,
                                    ConsumerInfo info)
                             throws JMSException
Registers a MessageConsumer

Specified by:
registerMessageConsumer in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException
JMSSecurityException - if client authentication fails for the Destination the Consumer applies for

deregisterMessageConsumer

public void deregisterMessageConsumer(BrokerClient client,
                                      ConsumerInfo info)
                               throws JMSException
De-register a MessageConsumer from the Broker

Specified by:
deregisterMessageConsumer in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException

registerMessageProducer

public void registerMessageProducer(BrokerClient client,
                                    ProducerInfo info)
                             throws JMSException
Registers a MessageProducer

Specified by:
registerMessageProducer in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException
JMSSecurityException - if client authentication fails for the Destination the Consumer applies for

deregisterMessageProducer

public void deregisterMessageProducer(BrokerClient client,
                                      ProducerInfo info)
                               throws JMSException
De-register a MessageProducer from the Broker

Specified by:
deregisterMessageProducer in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException

registerSession

public void registerSession(BrokerClient client,
                            SessionInfo info)
                     throws JMSException
Register a client-side Session (used for Monitoring)

Specified by:
registerSession in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException

deregisterSession

public void deregisterSession(BrokerClient client,
                              SessionInfo info)
                       throws JMSException
De-register a client-side Session from the Broker (used for monitoring)

Specified by:
deregisterSession in interface BrokerConnector
Parameters:
client -
info -
Throws:
JMSException

startTransaction

public void startTransaction(BrokerClient client,
                             String transactionId)
                      throws JMSException
Start a transaction from the Client session

Specified by:
startTransaction in interface BrokerConnector
Parameters:
client -
transactionId -
Throws:
JMSException

rollbackTransaction

public void rollbackTransaction(BrokerClient client,
                                String transactionId)
                         throws JMSException
Rollback a transacton

Specified by:
rollbackTransaction in interface BrokerConnector
Parameters:
client -
transactionId -
Throws:
JMSException

commitTransaction

public void commitTransaction(BrokerClient client,
                              String transactionId)
                       throws JMSException
Commit a transaction

Specified by:
commitTransaction in interface BrokerConnector
Parameters:
client -
transactionId -
Throws:
JMSException

sendMessage

public void sendMessage(BrokerClient client,
                        ActiveMQMessage message)
                 throws JMSException
Send a non-transacted message to the Broker

Specified by:
sendMessage in interface BrokerConnector
Parameters:
client -
message -
Throws:
JMSException

acknowledgeMessage

public void acknowledgeMessage(BrokerClient client,
                               MessageAck ack)
                        throws JMSException
Acknowledge reciept of a message

Specified by:
acknowledgeMessage in interface BrokerConnector
Parameters:
client -
ack -
Throws:
JMSException

durableUnsubscribe

public void durableUnsubscribe(BrokerClient client,
                               DurableUnsubscribe ds)
                        throws JMSException
Command to delete a durable topic subscription

Specified by:
durableUnsubscribe in interface BrokerConnector
Parameters:
client -
ds -
Throws:
JMSException

addClient

public void addClient(TransportChannel channel)
Description copied from interface: TransportChannelListener
Called when a new channel is added to a server

Specified by:
addClient in interface TransportChannelListener
Parameters:
channel - - client to add

removeClient

public void removeClient(TransportChannel channel)
Description copied from interface: TransportChannelListener
Called when a channel has been closed and removed from a server

Specified by:
removeClient in interface TransportChannelListener
Parameters:
channel - - client to remove

getBrokerContainer

public BrokerContainer getBrokerContainer()
Specified by:
getBrokerContainer in interface BrokerConnector
Returns:
the BrokerContainer for this Connector

startTransaction

public void startTransaction(BrokerClient client,
                             ActiveMQXid xid)
                      throws XAException
Start an XA transaction.

Specified by:
startTransaction in interface BrokerConnector
Throws:
XAException
See Also:
BrokerConnector.startTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)

getPreparedTransactions

public ActiveMQXid[] getPreparedTransactions(BrokerClient client)
                                      throws XAException
Gets the prepared XA transactions.

Specified by:
getPreparedTransactions in interface BrokerConnector
Returns:
Throws:
XAException
See Also:
BrokerConnector.getPreparedTransactions(org.activemq.broker.BrokerClient)

prepareTransaction

public int prepareTransaction(BrokerClient client,
                              ActiveMQXid xid)
                       throws XAException
Prepare an XA transaction.

Specified by:
prepareTransaction in interface BrokerConnector
Returns:
Throws:
XAException
See Also:
BrokerConnector.prepareTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)

rollbackTransaction

public void rollbackTransaction(BrokerClient client,
                                ActiveMQXid xid)
                         throws XAException
Rollback an XA transaction.

Specified by:
rollbackTransaction in interface BrokerConnector
Throws:
XAException
See Also:
BrokerConnector.rollbackTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)

commitTransaction

public void commitTransaction(BrokerClient client,
                              ActiveMQXid xid,
                              boolean onePhase)
                       throws XAException
Commit an XA transaction.

Specified by:
commitTransaction in interface BrokerConnector
Throws:
XAException
See Also:
BrokerConnector.commitTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid, boolean)

getResourceManagerId

public String getResourceManagerId(BrokerClient client)
Description copied from interface: BrokerConnector
Gets the unique id of the resource manager used for managing xa transactions.

Specified by:
getResourceManagerId in interface BrokerConnector
Returns:
the id
See Also:
BrokerConnector.getResourceManagerId(org.activemq.broker.BrokerClient)

createTransportServerChannel

protected static TransportServerChannel createTransportServerChannel(WireFormat wireFormat,
                                                                     String bindAddress)
                                                              throws JMSException
Factory method ot create a transport channel

Parameters:
bindAddress -
Returns:
@throws JMSException
Throws:
JMSException


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