Package org.apache.activemq.store
Interface MessageStore
-
- All Superinterfaces:
Service
- All Known Subinterfaces:
ReferenceStore
,TopicMessageStore
,TopicReferenceStore
- All Known Implementing Classes:
AbstractMessageStore
,JDBCMessageStore
,JDBCTopicMessageStore
,JournalMessageStore
,JournalTopicMessageStore
,KahaDBStore.KahaDBMessageStore
,MemoryMessageStore
,MemoryTopicMessageStore
,ProxyMessageStore
,ProxyTopicMessageStore
,TempKahaDBStore.KahaDBMessageStore
public interface MessageStore extends Service
Represents a message store which is used by the persistent implementations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addMessage(ConnectionContext context, Message message)
Adds a message to the message storevoid
addMessage(ConnectionContext context, Message message, boolean canOptimizeHint)
Adds a message to the message storeListenableFuture<Object>
asyncAddQueueMessage(ConnectionContext context, Message message)
Adds a message to the message storeListenableFuture<Object>
asyncAddQueueMessage(ConnectionContext context, Message message, boolean canOptimizeHint)
Adds a message to the message storeListenableFuture<Object>
asyncAddTopicMessage(ConnectionContext context, Message message)
Adds a message to the message storeListenableFuture<Object>
asyncAddTopicMessage(ConnectionContext context, Message message, boolean canOptimizeHint)
Adds a message to the message storevoid
dispose(ConnectionContext context)
ActiveMQDestination
getDestination()
The destination that the message store is holding messages for.Message
getMessage(MessageId identity)
Looks up a message using either the String messageID or the messageNumber.int
getMessageCount()
long
getMessageSize()
MessageStoreStatistics
getMessageStoreStatistics()
boolean
isEmpty()
flag to indicate if the store is emptyboolean
isPrioritizedMessages()
void
recover(MessageRecoveryListener container)
Recover any messages to be delivered.void
recoverNextMessages(int maxReturned, MessageRecoveryListener listener)
void
registerIndexListener(IndexListener indexListener)
void
removeAllMessages(ConnectionContext context)
Removes all the messages from the message store.void
removeAsyncMessage(ConnectionContext context, MessageAck ack)
void
removeMessage(ConnectionContext context, MessageAck ack)
Removes a message from the message store.void
resetBatching()
A hint to the Store to reset any batching state for the Destinationvoid
setBatch(MessageId messageId)
allow caching cursors to set the current batch offset when cache is exhaustedvoid
setMemoryUsage(MemoryUsage memoryUsage)
void
setPrioritizedMessages(boolean prioritizedMessages)
A hint to the store to try recover messages according to priorityvoid
updateMessage(Message message)
-
-
-
Method Detail
-
addMessage
void addMessage(ConnectionContext context, Message message) throws IOException
Adds a message to the message store- Parameters:
context
- contextmessage
-- Throws:
IOException
-
addMessage
void addMessage(ConnectionContext context, 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, Message message) throws IOException
Adds a message to the message store- Parameters:
context
- contextmessage
-- Returns:
- a Future to track when this is complete
- Throws:
IOException
IOException
-
asyncAddQueueMessage
ListenableFuture<Object> asyncAddQueueMessage(ConnectionContext context, 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:
IOException
IOException
-
asyncAddTopicMessage
ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, Message message) throws IOException
Adds a message to the message store- Parameters:
context
- contextmessage
-- Returns:
- a ListenableFuture to track when this is complete
- Throws:
IOException
IOException
-
asyncAddTopicMessage
ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, 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:
IOException
IOException
-
getMessage
Message getMessage(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, 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, MessageAck ack) throws IOException
- Throws:
IOException
-
removeAllMessages
void removeAllMessages(ConnectionContext context) throws IOException
Removes all the messages from the message store.- Parameters:
context
-- Throws:
IOException
-
recover
void recover(MessageRecoveryListener container) throws Exception
Recover any messages to be delivered.- Parameters:
container
-- Throws:
Exception
-
getDestination
ActiveMQDestination getDestination()
The destination that the message store is holding messages for.- Returns:
- the destination
-
setMemoryUsage
void setMemoryUsage(MemoryUsage memoryUsage)
- Parameters:
memoryUsage
- The SystemUsage that is controlling the destination's memory usage.
-
getMessageCount
int getMessageCount() throws IOException
- Returns:
- the number of messages ready to deliver
- Throws:
IOException
-
getMessageSize
long getMessageSize() throws IOException
- 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
void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception
- Throws:
Exception
-
dispose
void dispose(ConnectionContext context)
-
setBatch
void setBatch(MessageId messageId) throws Exception
allow caching cursors to set the current batch offset when cache is exhausted- Parameters:
messageId
-- Throws:
Exception
-
isEmpty
boolean isEmpty() throws Exception
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
void updateMessage(Message message) throws IOException
- Throws:
IOException
-
registerIndexListener
void registerIndexListener(IndexListener indexListener)
-
-