org.codehaus.activemq.service.impl
Class QueueMessageContainerManager

java.lang.Object
  extended byorg.codehaus.activemq.service.impl.MessageContainerManagerSupport
      extended byorg.codehaus.activemq.service.impl.QueueMessageContainerManager
All Implemented Interfaces:
MessageContainerManager, Service

public class QueueMessageContainerManager
extends MessageContainerManagerSupport

A default Broker used for Queue messages

Version:
$Revision: 1.14 $

Field Summary
protected  java.util.Map activeSubscriptions
           
protected  java.util.Map browsers
           
protected  FilterFactory filterFactory
           
protected  SubscriptionContainer subscriptionContainer
           
 
Fields inherited from class org.codehaus.activemq.service.impl.MessageContainerManagerSupport
dispatcher, messageContainers
 
Constructor Summary
QueueMessageContainerManager(PersistenceAdapter persistenceAdapter)
           
QueueMessageContainerManager(PersistenceAdapter persistenceAdapter, SubscriptionContainer subscriptionContainer, FilterFactory filterFactory, Dispatcher dispatcher)
           
 
Method Summary
 void acknowledgeMessage(BrokerClient client, MessageAck ack)
          Acknowledge a message as being read and consumed by the Consumer
 void acknowledgeTransactedMessage(BrokerClient client, java.lang.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)
           
 void commitTransaction(BrokerClient client, java.lang.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 deleteSubscription(java.lang.String clientId, java.lang.String subscriberName)
          Delete a durable subscriber
 MessageContainer getContainer(java.lang.String destinationName)
          Allows the lookup of a specific named message container
 void poll()
          Poll for messages
protected  void processSubscription(Subscription subscription, QueueMessageContainer container)
           
 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, java.lang.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)
           
 
Methods inherited from class org.codehaus.activemq.service.impl.MessageContainerManagerSupport
start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subscriptionContainer

protected SubscriptionContainer subscriptionContainer

filterFactory

protected FilterFactory filterFactory

activeSubscriptions

protected java.util.Map activeSubscriptions

browsers

protected java.util.Map browsers
Constructor Detail

QueueMessageContainerManager

public QueueMessageContainerManager(PersistenceAdapter persistenceAdapter)

QueueMessageContainerManager

public QueueMessageContainerManager(PersistenceAdapter persistenceAdapter,
                                    SubscriptionContainer subscriptionContainer,
                                    FilterFactory filterFactory,
                                    Dispatcher dispatcher)
Method Detail

addMessageConsumer

public void addMessageConsumer(BrokerClient client,
                               ConsumerInfo info)
                        throws JMSException
Parameters:
client -
info -
Throws:
JMSException

removeMessageConsumer

public void removeMessageConsumer(BrokerClient client,
                                  ConsumerInfo info)
                           throws JMSException
Parameters:
client -
info -
Throws:
JMSException

deleteSubscription

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

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
Parameters:
client -
message -
Throws:
JMSException

acknowledgeMessage

public void acknowledgeMessage(BrokerClient client,
                               MessageAck ack)
                        throws JMSException
Acknowledge a message as being read and consumed by the Consumer

Parameters:
client -
ack -
Throws:
JMSException

acknowledgeTransactedMessage

public void acknowledgeTransactedMessage(BrokerClient client,
                                         java.lang.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()

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

Parameters:
client -
ack -
Throws:
JMSException

poll

public void poll()
          throws JMSException
Poll for messages

Throws:
JMSException

commitTransaction

public void commitTransaction(BrokerClient client,
                              java.lang.String transactionId)
Description copied from interface: MessageContainerManager
A hook when the transaction is about to be commited; so apply all outstanding commands to the Journal if using a Journal (transaction log)

Parameters:
client -
transactionId -

rollbackTransaction

public void rollbackTransaction(BrokerClient client,
                                java.lang.String transactionId)
Description copied from interface: MessageContainerManager
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

Parameters:
client -
transactionId -

getContainer

public MessageContainer getContainer(java.lang.String destinationName)
                              throws JMSException
Description copied from interface: MessageContainerManager
Allows the lookup of a specific named message container

Parameters:
destinationName -
Returns:
Throws:
JMSException

processSubscription

protected void processSubscription(Subscription subscription,
                                   QueueMessageContainer container)
                            throws JMSException
Throws:
JMSException

createFilter

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

Parameters:
info -
Returns:
the Fitler
Throws:
JMSException


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