public class AMQMessageStore extends AbstractMessageStore
| Modifier and Type | Field and Description |
|---|---|
protected TaskRunner |
asyncWriteTask |
protected java.util.concurrent.CountDownLatch |
flushLatch |
protected java.util.Set<Location> |
inFlightTxLocations |
protected Location |
lastLocation |
protected Location |
lastWrittenLocation |
protected java.util.concurrent.locks.Lock |
lock |
protected AMQPersistenceAdapter |
peristenceAdapter |
protected ReferenceStore |
referenceStore |
protected AMQTransactionStore |
transactionStore |
protected TransactionTemplate |
transactionTemplate |
destination, FUTURE, prioritizedMessages| Constructor and Description |
|---|
AMQMessageStore(AMQPersistenceAdapter adapter,
ReferenceStore referenceStore,
ActiveMQDestination destination) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(ConnectionContext context,
Message message)
Not synchronize since the Journal has better throughput if you increase the number of concurrent writes that it
is doing.
|
void |
addMessageReference(ConnectionContext context,
MessageId messageId,
long expirationTime,
java.lang.String messageRef) |
void |
dispose(ConnectionContext context) |
protected Location |
doAsyncWrite() |
void |
flush()
Waits till the lastest data has landed on the referenceStore
|
protected Location |
getLocation(MessageId messageId) |
Location |
getMark() |
Message |
getMessage(MessageId identity)
Looks up a message using either the String messageID or the
messageNumber.
|
int |
getMessageCount() |
java.lang.String |
getMessageReference(MessageId identity) |
ReferenceStore |
getReferenceStore() |
void |
recover(MessageRecoveryListener listener)
Replays the referenceStore first as those messages are the oldest ones, then messages are replayed from the
transaction log and then the cache is updated.
|
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.
|
boolean |
replayAddMessage(ConnectionContext context,
Message message,
Location location) |
boolean |
replayRemoveMessage(ConnectionContext context,
MessageAck messageAck) |
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
|
void |
setMemoryUsage(MemoryUsage memoryUsage) |
void |
start() |
void |
stop() |
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, getDestination, isEmpty, isPrioritizedMessages, removeAsyncMessage, setPrioritizedMessagesprotected final AMQPersistenceAdapter peristenceAdapter
protected final AMQTransactionStore transactionStore
protected final ReferenceStore referenceStore
protected final TransactionTemplate transactionTemplate
protected Location lastLocation
protected Location lastWrittenLocation
protected java.util.Set<Location> inFlightTxLocations
protected final TaskRunner asyncWriteTask
protected java.util.concurrent.CountDownLatch flushLatch
protected final java.util.concurrent.locks.Lock lock
public AMQMessageStore(AMQPersistenceAdapter adapter, ReferenceStore referenceStore, ActiveMQDestination destination)
public void setMemoryUsage(MemoryUsage memoryUsage)
setMemoryUsage in interface MessageStoresetMemoryUsage in class AbstractMessageStorememoryUsage - The SystemUsage that is controlling the
destination's memory usage.public final void addMessage(ConnectionContext context, Message message) throws java.io.IOException
context - contextjava.io.IOExceptionpublic boolean replayAddMessage(ConnectionContext context, Message message, Location location)
public void removeMessage(ConnectionContext context, MessageAck ack) throws java.io.IOException
MessageStoreack - 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.java.io.IOExceptionpublic boolean replayRemoveMessage(ConnectionContext context, MessageAck messageAck)
public void flush() throws java.io.InterruptedIOException
java.io.InterruptedIOExceptionprotected Location doAsyncWrite() throws java.io.IOException
java.io.IOExceptionpublic Message getMessage(MessageId identity) throws java.io.IOException
MessageStoreidentity - which contains either the messageID or the messageNumberjava.io.IOExceptionprotected Location getLocation(MessageId messageId) throws java.io.IOException
java.io.IOExceptionpublic void recover(MessageRecoveryListener listener) throws java.lang.Exception
listener - java.lang.Exceptionpublic void start() throws java.lang.Exception
start in interface Servicestart in class AbstractMessageStorejava.lang.Exceptionpublic void stop() throws java.lang.Exception
stop in interface Servicestop in class AbstractMessageStorejava.lang.Exceptionpublic ReferenceStore getReferenceStore()
public void removeAllMessages(ConnectionContext context) throws java.io.IOException
MessageStorejava.io.IOExceptionMessageStore.removeAllMessages(ConnectionContext)public void addMessageReference(ConnectionContext context, MessageId messageId, long expirationTime, java.lang.String messageRef) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getMessageReference(MessageId identity) throws java.io.IOException
java.io.IOExceptionpublic int getMessageCount() throws java.io.IOException
java.io.IOExceptionMessageStore.getMessageCount()public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws java.lang.Exception
java.lang.Exceptionpublic void resetBatching()
MessageStorepublic void dispose(ConnectionContext context)
dispose in interface MessageStoredispose in class AbstractMessageStorepublic void setBatch(MessageId messageId)
MessageStoresetBatch in interface MessageStoresetBatch in class AbstractMessageStoreCopyright © 2005-2012. All Rights Reserved.