Package org.apache.activemq.store.memory
Class MemoryMessageStore
java.lang.Object
org.apache.activemq.store.AbstractMessageStore
org.apache.activemq.store.memory.MemoryMessageStore
- All Implemented Interfaces:
org.apache.activemq.Service,MessageStore
- Direct Known Subclasses:
MemoryTopicMessageStore
An implementation of
MessageStore-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.activemq.command.MessageIdprotected final Map<org.apache.activemq.command.MessageId,org.apache.activemq.command.Message> protected longFields inherited from class org.apache.activemq.store.AbstractMessageStore
destination, FUTURE, indexListener, messageStoreStatistics, prioritizedMessages -
Constructor Summary
ConstructorsConstructorDescriptionMemoryMessageStore(org.apache.activemq.command.ActiveMQDestination destination) MemoryMessageStore(org.apache.activemq.command.ActiveMQDestination destination, Map<org.apache.activemq.command.MessageId, org.apache.activemq.command.Message> messageTable) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(ConnectionContext context, org.apache.activemq.command.Message message) Adds a message to the message storeprotected static final voiddecMessageStoreStatistics(MessageStoreStatistics stats, org.apache.activemq.command.Message message) voiddelete()org.apache.activemq.command.MessagegetMessage(org.apache.activemq.command.MessageId identity) Looks up a message using either the String messageID or the messageNumber.protected static final voidincMessageStoreStatistics(MessageStoreStatistics stats, org.apache.activemq.command.Message message) voidrecover(MessageRecoveryListener listener) Recover any messages to be delivered.voidvoidrecoverNextMessages(int maxReturned, MessageRecoveryListener listener) voidremoveAllMessages(ConnectionContext context) Removes all the messages from the message store.voidremoveMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) Removes a message from the message store.voidremoveMessage(org.apache.activemq.command.MessageId msgId) voidA hint to the Store to reset any batching state for the DestinationvoidsetBatch(org.apache.activemq.command.MessageId messageId) allow caching cursors to set the current batch offset when cache is exhaustedvoidupdateMessage(org.apache.activemq.command.Message message) Methods inherited from class org.apache.activemq.store.AbstractMessageStore
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, dispose, getDestination, getIndexListener, getMessageCount, getMessageSize, getMessageStoreStatistics, isEmpty, isPrioritizedMessages, registerIndexListener, removeAsyncMessage, setMemoryUsage, setPrioritizedMessages, start, stop
-
Field Details
-
messageTable
protected final Map<org.apache.activemq.command.MessageId,org.apache.activemq.command.Message> messageTable -
lastBatchId
protected org.apache.activemq.command.MessageId lastBatchId -
sequenceId
protected long sequenceId
-
-
Constructor Details
-
MemoryMessageStore
public MemoryMessageStore(org.apache.activemq.command.ActiveMQDestination destination) -
MemoryMessageStore
public MemoryMessageStore(org.apache.activemq.command.ActiveMQDestination destination, Map<org.apache.activemq.command.MessageId, org.apache.activemq.command.Message> messageTable)
-
-
Method Details
-
addMessage
public void addMessage(ConnectionContext context, org.apache.activemq.command.Message message) throws IOException Description copied from interface:MessageStoreAdds a message to the message store- Parameters:
context- context- Throws:
IOException
-
getMessage
public org.apache.activemq.command.Message getMessage(org.apache.activemq.command.MessageId identity) throws IOException Description copied from interface:MessageStoreLooks 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
-
removeMessage
public void removeMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) throws IOException Description copied from interface:MessageStoreRemoves 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
- Throws:
IOException
-
recover
Description copied from interface:MessageStoreRecover any messages to be delivered.- Throws:
Exception
-
removeAllMessages
Description copied from interface:MessageStoreRemoves all the messages from the message store.- Throws:
IOException
-
delete
public void delete() -
recoverNextMessages
- Throws:
Exception
-
resetBatching
public void resetBatching()Description copied from interface:MessageStoreA hint to the Store to reset any batching state for the Destination -
setBatch
public void setBatch(org.apache.activemq.command.MessageId messageId) Description copied from interface:MessageStoreallow caching cursors to set the current batch offset when cache is exhausted- Specified by:
setBatchin interfaceMessageStore- Overrides:
setBatchin classAbstractMessageStore
-
updateMessage
public void updateMessage(org.apache.activemq.command.Message message) - Specified by:
updateMessagein interfaceMessageStore- Overrides:
updateMessagein classAbstractMessageStore
-
recoverMessageStoreStatistics
- Overrides:
recoverMessageStoreStatisticsin classAbstractMessageStore- Throws:
IOException
-
incMessageStoreStatistics
protected static final void incMessageStoreStatistics(MessageStoreStatistics stats, org.apache.activemq.command.Message message) -
decMessageStoreStatistics
protected static final void decMessageStoreStatistics(MessageStoreStatistics stats, org.apache.activemq.command.Message message)
-