org.apache.activemq.store.kahadaptor
Class KahaMessageStore

java.lang.Object
  extended by org.apache.activemq.store.AbstractMessageStore
      extended by org.apache.activemq.store.kahadaptor.KahaMessageStore
All Implemented Interfaces:
Service, MessageStore
Direct Known Subclasses:
KahaTopicMessageStore

public class KahaMessageStore
extends AbstractMessageStore

An implementation of MessageStore which uses a JPS Container


Field Summary
protected  StoreEntry batchEntry
           
protected  MapContainer<MessageId,Message> messageContainer
           
 
Fields inherited from class org.apache.activemq.store.AbstractMessageStore
destination, FUTURE, prioritizedMessages
 
Constructor Summary
KahaMessageStore(MapContainer<MessageId,Message> container, ActiveMQDestination destination)
           
 
Method Summary
 void addMessage(ConnectionContext context, Message message)
          Adds a message to the message store
 void delete()
           
 Object getId()
           
 Message getMessage(MessageId identity)
          Looks up a message using either the String messageID or the messageNumber.
 int getMessageCount()
           
protected  MessageId getMessageId(Object object)
           
 MessageId getPreviousMessageIdToDeliver(MessageId id)
           
 boolean isSupportForCursors()
           
 void recover(MessageRecoveryListener listener)
          Recover any messages to be delivered.
protected  boolean recoverMessage(MessageRecoveryListener listener, Message msg)
           
 void recoverNextMessages(int maxReturned, MessageRecoveryListener listener)
           
 void removeAllMessages(ConnectionContext context)
          Removes all the messages from the message store.
 void removeMessage(ConnectionContext context, MessageAck ack)
          Removes a message from the message store.
 void removeMessage(MessageId msgId)
           
 void resetBatching()
          A hint to the Store to reset any batching state for the Destination
 void setBatch(MessageId messageId)
          allow caching cursors to set the current batch offset when cache is exhausted
 
Methods inherited from class org.apache.activemq.store.AbstractMessageStore
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, dispose, getDestination, isEmpty, isPrioritizedMessages, removeAsyncMessage, setMemoryUsage, setPrioritizedMessages, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageContainer

protected final MapContainer<MessageId,Message> messageContainer

batchEntry

protected StoreEntry batchEntry
Constructor Detail

KahaMessageStore

public KahaMessageStore(MapContainer<MessageId,Message> container,
                        ActiveMQDestination destination)
                 throws IOException
Throws:
IOException
Method Detail

getMessageId

protected MessageId getMessageId(Object object)

getId

public Object getId()

addMessage

public void addMessage(ConnectionContext context,
                       Message message)
                throws IOException
Description copied from interface: MessageStore
Adds a message to the message store

Parameters:
context - context
Throws:
IOException

getMessage

public Message getMessage(MessageId identity)
                   throws IOException
Description copied from interface: MessageStore
Looks up a message using either the String messageID or the messageNumber. Implementations are encouraged to fill in the missing key if its easy to do so.

Parameters:
identity - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
IOException

recoverMessage

protected boolean recoverMessage(MessageRecoveryListener listener,
                                 Message msg)
                          throws Exception
Throws:
Exception

removeMessage

public void removeMessage(ConnectionContext context,
                          MessageAck ack)
                   throws IOException
Description copied from interface: MessageStore
Removes a message from the message store.

ack - the ack request that cause the message to be removed. It conatins the identity which contains the messageID of the message that needs to be removed.
Throws:
IOException

removeMessage

public void removeMessage(MessageId msgId)
                   throws IOException
Throws:
IOException

recover

public void recover(MessageRecoveryListener listener)
             throws Exception
Description copied from interface: MessageStore
Recover any messages to be delivered.

Throws:
Exception

removeAllMessages

public void removeAllMessages(ConnectionContext context)
                       throws IOException
Description copied from interface: MessageStore
Removes all the messages from the message store.

Throws:
IOException

delete

public void delete()

getMessageCount

public int getMessageCount()
Returns:
the number of messages held by this destination
See Also:
MessageStore.getMessageCount()

getPreviousMessageIdToDeliver

public MessageId getPreviousMessageIdToDeliver(MessageId id)
                                        throws Exception
Parameters:
id -
Returns:
null
Throws:
Exception
See Also:
org.apache.activemq.store.MessageStore#getPreviousMessageIdToDeliver(org.apache.activemq.command.MessageId)

recoverNextMessages

public void recoverNextMessages(int maxReturned,
                                MessageRecoveryListener listener)
                         throws Exception
Parameters:
lastMessageId -
maxReturned -
listener -
Throws:
Exception
See Also:
org.apache.activemq.store.MessageStore#recoverNextMessages(org.apache.activemq.command.MessageId, int, org.apache.activemq.store.MessageRecoveryListener)

resetBatching

public void resetBatching()
Description copied from interface: MessageStore
A hint to the Store to reset any batching state for the Destination

Parameters:
nextToDispatch -
See Also:
org.apache.activemq.store.MessageStore#resetBatching(org.apache.activemq.command.MessageId)

isSupportForCursors

public boolean isSupportForCursors()
Returns:
true if the store supports cursors

setBatch

public void setBatch(MessageId messageId)
Description copied from interface: MessageStore
allow caching cursors to set the current batch offset when cache is exhausted

Specified by:
setBatch in interface MessageStore
Overrides:
setBatch in class AbstractMessageStore


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.