org.activemq.service.boundedvm
Class TransientQueueBoundedMessageContainer

java.lang.Object
  extended byorg.activemq.service.boundedvm.TransientQueueBoundedMessageContainer
All Implemented Interfaces:
MessageContainer, MessageContainerAdmin, Runnable, Service

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

A MessageContainer for transient queues

Version:
$Revision: 1.1.1.1 $

Constructor Summary
TransientQueueBoundedMessageContainer(Executor threadPool, MemoryBoundedQueueManager queueManager, ActiveMQDestination destination, RedeliveryPolicy redeliveryPolicy, DeadLetterPolicy deadLetterPolicy)
          Construct this beast
 
Method Summary
 TransientQueueSubscription addConsumer(Filter filter, ConsumerInfo info, BrokerClient client)
          Add a consumer to dispatch messages to
 void addMessage(ActiveMQMessage msg)
          Add an ActiveMQMessage to the message container
protected  void clear()
           
 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.
 void enqueue(ActiveMQMessage message)
          enqueue a message for dispatching
 ActiveMQDestination getDestination()
           
 String getDestinationName()
           
 long getIdleTimestamp()
           
 ActiveMQMessage getMessage(MessageIdentity messageIdentity)
          Return the ActiveMQMessage that matches the Id
 MessageContainerAdmin getMessageContainerAdmin()
           
 boolean isActive()
           
 boolean isDeadLetterQueue()
          returns true if this container is a dead letter queue
 boolean isEmpty()
           
 void redeliver(ActiveMQMessage message)
          re-enqueue a message for dispatching
 void redeliver(List messages)
           
 void registerMessageInterest(MessageIdentity messageIdentity)
          Register that a consumer will be interested in this message
 void removeConsumer(ConsumerInfo info)
          Remove a consumer
protected  void removeExpiredMessages()
           
 void run()
          do some dispatching
 void start()
          start working
protected  void startRunning()
           
 void stop()
          stop working
 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

TransientQueueBoundedMessageContainer

public TransientQueueBoundedMessageContainer(Executor threadPool,
                                             MemoryBoundedQueueManager queueManager,
                                             ActiveMQDestination destination,
                                             RedeliveryPolicy redeliveryPolicy,
                                             DeadLetterPolicy deadLetterPolicy)
Construct this beast

Parameters:
threadPool -
queueManager -
destination -
redeliveryPolicy -
deadLetterPolicy -
Method Detail

isActive

public boolean isActive()
Returns:
true if there are subscribers waiting for messages

isEmpty

public boolean isEmpty()
Returns:
true if no messages are enqueued

getIdleTimestamp

public long getIdleTimestamp()
Returns:
the timestamp (ms) from the when the last active subscriber stopped

addConsumer

public TransientQueueSubscription addConsumer(Filter filter,
                                              ConsumerInfo info,
                                              BrokerClient client)
                                       throws JMSException
Add a consumer to dispatch messages to

Parameters:
filter -
info -
client -
Returns:
TransientQueueSubscription
Throws:
JMSException

removeConsumer

public void removeConsumer(ConsumerInfo info)
                    throws JMSException
Remove a consumer

Parameters:
info -
Throws:
JMSException

start

public void start()
           throws JMSException
start working

Specified by:
start in interface Service
Throws:
JMSException

enqueue

public void enqueue(ActiveMQMessage message)
enqueue a message for dispatching

Parameters:
message -

redeliver

public void redeliver(ActiveMQMessage message)
re-enqueue a message for dispatching

Parameters:
message -

redeliver

public void redeliver(List messages)

stop

public void stop()
stop working

Specified by:
stop in interface Service

close

public void close()
           throws JMSException
close down this container

Throws:
JMSException

run

public void run()
do some dispatching

Specified by:
run in interface Runnable

getDestination

public ActiveMQDestination getDestination()
Returns:
the destination associated with this container

getDestinationName

public String getDestinationName()
Specified by:
getDestinationName in interface MessageContainer
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 -
Returns:
@throws JMSException
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 -
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

clear

protected void clear()

removeExpiredMessages

protected void removeExpiredMessages()

startRunning

protected void startRunning()

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-2007 Protique, Ltd.. All Rights Reserved.