Package org.apache.activemq.store
Interface MessageStore
- All Superinterfaces:
org.apache.activemq.Service
- All Known Subinterfaces:
ReferenceStore,TopicMessageStore,TopicReferenceStore
- All Known Implementing Classes:
AbstractMessageStore,MemoryMessageStore,MemoryTopicMessageStore,ProxyMessageStore,ProxyTopicMessageStore
public interface MessageStore
extends org.apache.activemq.Service
Represents a message store which is used by the persistent implementations
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(ConnectionContext context, org.apache.activemq.command.Message message) Adds a message to the message storevoidaddMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) Adds a message to the message storeasyncAddQueueMessage(ConnectionContext context, org.apache.activemq.command.Message message) Adds a message to the message storeasyncAddQueueMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) Adds a message to the message storeasyncAddTopicMessage(ConnectionContext context, org.apache.activemq.command.Message message) Adds a message to the message storeasyncAddTopicMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) Adds a message to the message storevoiddispose(ConnectionContext context) org.apache.activemq.command.ActiveMQDestinationThe destination that the message store is holding messages for.org.apache.activemq.command.MessagegetMessage(org.apache.activemq.command.MessageId identity) Looks up a message using either the String messageID or the messageNumber.intlonggetType()booleanisEmpty()flag to indicate if the store is emptybooleanvoidrecover(MessageRecoveryListener container) Recover any messages to be delivered.voidrecoverNextMessages(int maxReturned, MessageRecoveryListener listener) voidregisterIndexListener(IndexListener indexListener) voidremoveAllMessages(ConnectionContext context) Removes all the messages from the message store.voidremoveAsyncMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) voidremoveMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) Removes a message from the message store.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 exhaustedvoidsetMemoryUsage(org.apache.activemq.usage.MemoryUsage memoryUsage) voidsetPrioritizedMessages(boolean prioritizedMessages) A hint to the store to try recover messages according to priorityvoidupdateMessage(org.apache.activemq.command.Message message) Methods inherited from interface org.apache.activemq.Service
start, stop
-
Method Details
-
addMessage
void addMessage(ConnectionContext context, org.apache.activemq.command.Message message) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-- Throws:
IOException
-
addMessage
void addMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-canOptimizeHint- - give a hint to the store that the message may be consumed before it hits the disk- Throws:
IOException
-
asyncAddQueueMessage
ListenableFuture<Object> asyncAddQueueMessage(ConnectionContext context, org.apache.activemq.command.Message message) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-- Returns:
- a Future to track when this is complete
- Throws:
IOExceptionIOException
-
asyncAddQueueMessage
ListenableFuture<Object> asyncAddQueueMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-canOptimizeHint- - give a hint to the store that the message may be consumed before it hits the disk- Returns:
- a Future to track when this is complete
- Throws:
IOExceptionIOException
-
asyncAddTopicMessage
ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, org.apache.activemq.command.Message message) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-- Returns:
- a ListenableFuture to track when this is complete
- Throws:
IOExceptionIOException
-
asyncAddTopicMessage
ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, org.apache.activemq.command.Message message, boolean canOptimizeHint) throws IOException Adds a message to the message store- Parameters:
context- contextmessage-canOptimizeHint- - give a hint to the store that the message may be consumed before it hits the disk- Returns:
- a ListenableFuture to track when this is complete
- Throws:
IOExceptionIOException
-
getMessage
org.apache.activemq.command.Message getMessage(org.apache.activemq.command.MessageId identity) throws IOException 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
-
removeMessage
void removeMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) throws IOException Removes a message from the message store.- Parameters:
context-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
-
removeAsyncMessage
void removeAsyncMessage(ConnectionContext context, org.apache.activemq.command.MessageAck ack) throws IOException - Throws:
IOException
-
removeAllMessages
Removes all the messages from the message store.- Parameters:
context-- Throws:
IOException
-
recover
Recover any messages to be delivered.- Parameters:
container-- Throws:
Exception
-
getDestination
org.apache.activemq.command.ActiveMQDestination getDestination()The destination that the message store is holding messages for.- Returns:
- the destination
-
setMemoryUsage
void setMemoryUsage(org.apache.activemq.usage.MemoryUsage memoryUsage) - Parameters:
memoryUsage- The SystemUsage that is controlling the destination's memory usage.
-
getMessageCount
- Returns:
- the number of messages ready to deliver
- Throws:
IOException
-
getMessageSize
- Returns:
- the size of the messages ready to deliver
- Throws:
IOException
-
getMessageStoreStatistics
MessageStoreStatistics getMessageStoreStatistics()- Returns:
- The statistics bean for this message store
-
resetBatching
void resetBatching()A hint to the Store to reset any batching state for the Destination -
recoverNextMessages
- Throws:
Exception
-
dispose
-
setBatch
allow caching cursors to set the current batch offset when cache is exhausted- Parameters:
messageId-- Throws:
Exception
-
isEmpty
flag to indicate if the store is empty- Returns:
- true if the message count is 0
- Throws:
Exception
-
setPrioritizedMessages
void setPrioritizedMessages(boolean prioritizedMessages) A hint to the store to try recover messages according to priority- Parameters:
prioritizedMessages-
-
isPrioritizedMessages
boolean isPrioritizedMessages()- Returns:
- true if store is trying to recover messages according to priority
-
updateMessage
- Throws:
IOException
-
registerIndexListener
-
getType
MessageStore.StoreType getType()
-