org.activemq.service.boundedvm
Class TransientTopicBoundedMessageContainer

java.lang.Object
  extended by org.activemq.service.boundedvm.TransientTopicBoundedMessageContainer
All Implemented Interfaces:
Runnable, MessageContainer, MessageContainerAdmin, Service

public class TransientTopicBoundedMessageContainer
extends Object
implements MessageContainer, Service, Runnable, MessageContainerAdmin

A MessageContainer for transient topics One of these exists for every active Connection consuming transient Topic messages

Version:
$Revision: 1.1.1.1 $

Constructor Summary
TransientTopicBoundedMessageContainer(TransientTopicBoundedMessageManager manager, BrokerClient client, MemoryBoundedQueue queue)
          Construct this beast
 
Method Summary
 TransientTopicSubscription addConsumer(Filter filter, ConsumerInfo info)
          Add a consumer to dispatch messages to
 void addMessage(ActiveMQMessage msg)
          Add an ActiveMQMessage to the message container
 void close()
          close down this container
 boolean containsMessage(MessageIdentity messageIdentity)
          Returns whether or not this container contains the given message identity which provides an optimisation over getMessage() where the message does not need to be loaded.
 void delete(MessageIdentity messageIdentity, MessageAck ack)
          Delete a message - if no
 void empty()
          Deletes all the messages that a container holds.
 BrokerClient getBrokerClient()
           
 String getDestinationName()
           
 ActiveMQMessage getMessage(MessageIdentity messageIdentity)
          Return the ActiveMQMessage that matches the Id
 MessageContainerAdmin getMessageContainerAdmin()
           
 boolean hasConsumerFor(ActiveMQDestination destination)
           
 boolean isDeadLetterQueue()
          returns true if this container is a dead letter queue
 boolean isInactive()
           
 void registerMessageInterest(MessageIdentity messageIdentity)
          Register that a consumer will be interested in this message
 void removeConsumer(ConsumerInfo info)
          Remove a consumer
 void run()
          do some dispatching
 void start()
          start working
 void stop()
          stop working
 boolean targetAndDispatch(BrokerClient sender, ActiveMQMessage message)
          See if this container should get this message and dispatch it
 void unregisterMessageInterest(MessageIdentity messageIdentity)
          A message consumer calls this when it's no longer interested in a message so that we know when we can delete (or archive) it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransientTopicBoundedMessageContainer

public TransientTopicBoundedMessageContainer(TransientTopicBoundedMessageManager manager,
                                             BrokerClient client,
                                             MemoryBoundedQueue queue)
Construct this beast

Parameters:
manager -
client -
queue -
Method Detail

isInactive

public boolean isInactive()
Returns:
true if this Container has no active subscriptions

getBrokerClient

public BrokerClient getBrokerClient()
Returns:
the BrokerClient this Container is dispatching to

addConsumer

public TransientTopicSubscription addConsumer(Filter filter,
                                              ConsumerInfo info)
Add a consumer to dispatch messages to

Parameters:
filter -
info -

removeConsumer

public void removeConsumer(ConsumerInfo info)
Remove a consumer

Parameters:
info -

start

public void start()
start working

Specified by:
start in interface Service

targetAndDispatch

public boolean targetAndDispatch(BrokerClient sender,
                                 ActiveMQMessage message)
                          throws JMSException
See if this container should get this message and dispatch it

Parameters:
sender - the BrokerClient the message came from
message -
Returns:
true if it is a valid container
Throws:
JMSException

stop

public void stop()
stop working

Specified by:
stop in interface Service

close

public void close()
close down this container


run

public void run()
do some dispatching

Specified by:
run in interface Runnable

hasConsumerFor

public boolean hasConsumerFor(ActiveMQDestination destination)
Parameters:
destination -
Returns:
true if a

getDestinationName

public String getDestinationName()
Specified by:
getDestinationName in interface MessageContainer
Specified by:
getDestinationName in interface MessageContainerAdmin
Returns:
the destination name

addMessage

public void addMessage(ActiveMQMessage msg)
                throws JMSException
Description copied from interface: MessageContainer
Add an ActiveMQMessage to the message container

Specified by:
addMessage in interface MessageContainer
Parameters:
msg -
Throws:
JMSException

delete

public void delete(MessageIdentity messageIdentity,
                   MessageAck ack)
            throws JMSException
Description copied from interface: MessageContainer
Delete a message - if no

Specified by:
delete in interface MessageContainer
Parameters:
messageIdentity -
ack -
Throws:
JMSException

getMessage

public ActiveMQMessage getMessage(MessageIdentity messageIdentity)
                           throws JMSException
Description copied from interface: MessageContainer
Return the ActiveMQMessage that matches the Id

Specified by:
getMessage in interface MessageContainer
Parameters:
messageIdentity -
Returns:
@throws JMSException
Throws:
JMSException

registerMessageInterest

public void registerMessageInterest(MessageIdentity messageIdentity)
                             throws JMSException
Description copied from interface: MessageContainer
Register that a consumer will be interested in this message

Specified by:
registerMessageInterest in interface MessageContainer
Parameters:
messageIdentity -
Throws:
JMSException

unregisterMessageInterest

public void unregisterMessageInterest(MessageIdentity messageIdentity)
                               throws JMSException
Description copied from interface: MessageContainer
A message consumer calls this when it's no longer interested in a message so that we know when we can delete (or archive) it

Specified by:
unregisterMessageInterest in interface MessageContainer
Parameters:
messageIdentity -
ack -
Throws:
JMSException

containsMessage

public boolean containsMessage(MessageIdentity messageIdentity)
                        throws JMSException
Description copied from interface: MessageContainer
Returns whether or not this container contains the given message identity which provides an optimisation over getMessage() where the message does not need to be loaded.

Specified by:
containsMessage in interface MessageContainer
Parameters:
messageIdentity -
Returns:
@throws JMSException
Throws:
JMSException

getMessageContainerAdmin

public MessageContainerAdmin getMessageContainerAdmin()
Specified by:
getMessageContainerAdmin in interface MessageContainer
Returns:
the adminstration interface of the container.
See Also:
MessageContainer.getMessageContainerAdmin()

empty

public void empty()
           throws JMSException
Description copied from interface: MessageContainerAdmin
Deletes all the messages that a container holds. This is usally used when the container is being destroyed.

Specified by:
empty in interface MessageContainerAdmin
Throws:
JMSException
See Also:
MessageContainerAdmin.empty()

isDeadLetterQueue

public boolean isDeadLetterQueue()
Description copied from interface: MessageContainer
returns true if this container is a dead letter queue

Specified by:
isDeadLetterQueue in interface MessageContainer
Returns:
See Also:
MessageContainer.isDeadLetterQueue()


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