org.codehaus.activemq.service.boundedvm
Class TransientTopicBoundedMessageManager

java.lang.Object
  extended byorg.codehaus.activemq.service.boundedvm.TransientTopicBoundedMessageManager
All Implemented Interfaces:
MessageContainerManager, Service

public class TransientTopicBoundedMessageManager
extends Object
implements MessageContainerManager

A manager of MessageContainer instances


Constructor Summary
TransientTopicBoundedMessageManager(MemoryBoundedQueueManager mgr)
          Constructor for TransientTopicBoundedMessageManager
 
Method Summary
 void acknowledgeMessage(BrokerClient client, MessageAck ack)
          Acknowledge a message as being read and consumed by the Consumer
 void acknowledgeTransactedMessage(BrokerClient client, String transactionId, MessageAck ack)
          This is a hook to notify the dispatcher for the clients subscription that we have acknowledged a message within a transaction but before the commit - so the message is not really being acknowledged here but this method is intended to be a hook to let the dispatcher know that we can now send another message to the client.
 void addMessageConsumer(BrokerClient client, ConsumerInfo info)
          Add a consumer if appropiate
 void commitTransaction(BrokerClient client, String transactionId)
          A hook when the transaction is about to be commited; so apply all outstanding commands to the Journal if using a Journal (transaction log)
protected  Filter createFilter(ConsumerInfo info)
          Create filter for a Consumer
 void createMessageContainer(ActiveMQDestination dest)
          Creates a destination.
 void deleteSubscription(String clientId, String subscriberName)
          Delete a durable subscriber
 void destroyMessageContainer(ActiveMQDestination dest)
          Destroys a destination.
 MessageContainer getContainer(String physicalName)
          For Transient topics - a MessageContainer maps on to the messages to be dispatched through a BrokerClient, not a destination
 DeadLetterPolicy getDeadLetterPolicy()
           
 Map getDestinations()
          Returns an unmodifiable map, indexed by String name, of all the Destination objects available in this container
 Map getMessageContainerAdmins()
          Returns an unmodifiable map, indexed by ActiveMQDestination, of all the MessageContainerAdmin objects available in this container
protected  boolean hasConsumerFor(ActiveMQDestination destination)
           
 void poll()
          Poll for messages
 void redeliverMessage(BrokerClient client, MessageAck ack)
          Called after a rollback of a JMS transaction to redeliver the message to the consumers dispatch queue
 void removeMessageConsumer(BrokerClient client, ConsumerInfo info)
           
 void rollbackTransaction(BrokerClient client, String transactionId)
          A hook when the transaction is about to be rolled back; so discard all outstanding commands that are pending to be written to the Journal
 void sendMessage(BrokerClient client, ActiveMQMessage message)
           
 void setDeadLetterPolicy(DeadLetterPolicy policy)
          Set the DeadLetterPolicy for this Container Manager
 void start()
          start the manager
 void stop()
          stop the manager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransientTopicBoundedMessageManager

public TransientTopicBoundedMessageManager(MemoryBoundedQueueManager mgr)
Constructor for TransientTopicBoundedMessageManager

Parameters:
mgr -
Method Detail

start

public void start()
           throws JMSException
start the manager

Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
stop the manager

Specified by:
stop in interface Service
Throws:
JMSException

addMessageConsumer

public void addMessageConsumer(BrokerClient client,
                               ConsumerInfo info)
                        throws JMSException
Add a consumer if appropiate

Specified by:
addMessageConsumer in interface MessageContainerManager
Parameters:
client -
info -
Throws:
JMSException

removeMessageConsumer

public void removeMessageConsumer(BrokerClient client,
                                  ConsumerInfo info)
                           throws JMSException
Specified by:
removeMessageConsumer in interface MessageContainerManager
Parameters:
client -
info -
Throws:
JMSException

deleteSubscription

public void deleteSubscription(String clientId,
                               String subscriberName)
                        throws JMSException
Delete a durable subscriber

Specified by:
deleteSubscription in interface MessageContainerManager
Parameters:
clientId -
subscriberName -
Throws:
JMSException - if the subscriber doesn't exist or is still active

sendMessage

public void sendMessage(BrokerClient client,
                        ActiveMQMessage message)
                 throws JMSException
Specified by:
sendMessage in interface MessageContainerManager
Parameters:
client -
message -
Throws:
JMSException

acknowledgeMessage

public void acknowledgeMessage(BrokerClient client,
                               MessageAck ack)
                        throws JMSException
Description copied from interface: MessageContainerManager
Acknowledge a message as being read and consumed by the Consumer

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

acknowledgeTransactedMessage

public void acknowledgeTransactedMessage(BrokerClient client,
                                         String transactionId,
                                         MessageAck ack)
                                  throws JMSException
Description copied from interface: MessageContainerManager
This is a hook to notify the dispatcher for the clients subscription that we have acknowledged a message within a transaction but before the commit - so the message is not really being acknowledged here but this method is intended to be a hook to let the dispatcher know that we can now send another message to the client.

Without this hook, if we have a prefetch value of 1, we can never consume 2 messages in a transaction, since the ack for the first message never arrives until the commit()

Specified by:
acknowledgeTransactedMessage in interface MessageContainerManager
Parameters:
client -
transactionId -
ack -
Throws:
JMSException

redeliverMessage

public void redeliverMessage(BrokerClient client,
                             MessageAck ack)
                      throws JMSException
Description copied from interface: MessageContainerManager
Called after a rollback of a JMS transaction to redeliver the message to the consumers dispatch queue

Specified by:
redeliverMessage in interface MessageContainerManager
Parameters:
client -
ack -
Throws:
JMSException

poll

public void poll()
          throws JMSException
Description copied from interface: MessageContainerManager
Poll for messages

Specified by:
poll in interface MessageContainerManager
Throws:
JMSException

commitTransaction

public void commitTransaction(BrokerClient client,
                              String transactionId)
                       throws JMSException
A hook when the transaction is about to be commited; so apply all outstanding commands to the Journal if using a Journal (transaction log)

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

rollbackTransaction

public void rollbackTransaction(BrokerClient client,
                                String transactionId)
A hook when the transaction is about to be rolled back; so discard all outstanding commands that are pending to be written to the Journal

Specified by:
rollbackTransaction in interface MessageContainerManager
Parameters:
client -
transactionId -

getContainer

public MessageContainer getContainer(String physicalName)
                              throws JMSException
For Transient topics - a MessageContainer maps on to the messages to be dispatched through a BrokerClient, not a destination

Specified by:
getContainer in interface MessageContainerManager
Parameters:
physicalName -
Returns:
the MessageContainer used for dispatching - always returns null
Throws:
JMSException

getDestinations

public Map getDestinations()
Description copied from interface: MessageContainerManager
Returns an unmodifiable map, indexed by String name, of all the Destination objects available in this container

Specified by:
getDestinations in interface MessageContainerManager
Returns:
a map of all the destinations

getDeadLetterPolicy

public DeadLetterPolicy getDeadLetterPolicy()
Specified by:
getDeadLetterPolicy in interface MessageContainerManager
Returns:
the DeadLetterPolicy for this Container Manager

setDeadLetterPolicy

public void setDeadLetterPolicy(DeadLetterPolicy policy)
Set the DeadLetterPolicy for this Container Manager

Specified by:
setDeadLetterPolicy in interface MessageContainerManager
Parameters:
policy -

createFilter

protected Filter createFilter(ConsumerInfo info)
                       throws JMSException
Create filter for a Consumer

Parameters:
info -
Returns:
the Fitler
Throws:
JMSException

hasConsumerFor

protected boolean hasConsumerFor(ActiveMQDestination destination)

createMessageContainer

public void createMessageContainer(ActiveMQDestination dest)
                            throws JMSException
Description copied from interface: MessageContainerManager
Creates a destination.

Specified by:
createMessageContainer in interface MessageContainerManager
Parameters:
dest -
Throws:
JMSException
See Also:
MessageContainerManager.createMessageContainer(org.codehaus.activemq.message.ActiveMQDestination)

destroyMessageContainer

public void destroyMessageContainer(ActiveMQDestination dest)
                             throws JMSException
Description copied from interface: MessageContainerManager
Destroys a destination.

Specified by:
destroyMessageContainer in interface MessageContainerManager
Parameters:
dest -
Throws:
JMSException
See Also:
MessageContainerManager.destroyMessageContainer(org.codehaus.activemq.message.ActiveMQDestination)

getMessageContainerAdmins

public Map getMessageContainerAdmins()
                              throws JMSException
Description copied from interface: MessageContainerManager
Returns an unmodifiable map, indexed by ActiveMQDestination, of all the MessageContainerAdmin objects available in this container

Specified by:
getMessageContainerAdmins in interface MessageContainerManager
Returns:
the Map
Throws:
JMSException
See Also:
MessageContainerManager.getMessageContainerAdmins()


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