org.apache.activemq.store.jdbc
Class JDBCMessageStore

java.lang.Object
  extended by org.apache.activemq.store.jdbc.JDBCMessageStore
All Implemented Interfaces:
Service, MessageStore
Direct Known Subclasses:
JDBCTopicMessageStore

public class JDBCMessageStore
extends java.lang.Object
implements MessageStore

Version:
$Revision: 1.10 $

Field Summary
protected  JDBCAdapter adapter
           
protected  ActiveMQDestination destination
           
protected  JDBCPersistenceAdapter persistenceAdapter
           
protected  WireFormat wireFormat
           
 
Constructor Summary
JDBCMessageStore(JDBCPersistenceAdapter persistenceAdapter, JDBCAdapter adapter, WireFormat wireFormat, ActiveMQDestination destination)
           
 
Method Summary
 void addMessage(ConnectionContext context, Message message)
          Adds a message to the message store
 void addMessageReference(ConnectionContext context, MessageId messageId, long expirationTime, java.lang.String messageRef)
          Adds a message reference to the message store
 ActiveMQDestination getDestination()
          The destination that the message store is holding messages for.
 Message getMessage(MessageId messageId)
          Looks up a message using either the String messageID or the messageNumber.
 java.lang.String getMessageReference(MessageId messageId)
          Looks up a message using either the String messageID or the messageNumber.
 void recover(MessageRecoveryListener listener)
          Recover any messages to be delivered.
 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 setUsageManager(UsageManager usageManager)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wireFormat

protected final WireFormat wireFormat

destination

protected final ActiveMQDestination destination

adapter

protected final JDBCAdapter adapter

persistenceAdapter

protected final JDBCPersistenceAdapter persistenceAdapter
Constructor Detail

JDBCMessageStore

public JDBCMessageStore(JDBCPersistenceAdapter persistenceAdapter,
                        JDBCAdapter adapter,
                        WireFormat wireFormat,
                        ActiveMQDestination destination)
Method Detail

addMessage

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

Specified by:
addMessage in interface MessageStore
Parameters:
context - TODO
Throws:
java.io.IOException

addMessageReference

public void addMessageReference(ConnectionContext context,
                                MessageId messageId,
                                long expirationTime,
                                java.lang.String messageRef)
                         throws java.io.IOException
Description copied from interface: MessageStore
Adds a message reference to the message store

Specified by:
addMessageReference in interface MessageStore
Parameters:
context - TODO
messageId - TODO
expirationTime - TODO
Throws:
java.io.IOException

getMessage

public Message getMessage(MessageId messageId)
                   throws java.io.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.

Specified by:
getMessage in interface MessageStore
Parameters:
messageId - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
java.io.IOException

getMessageReference

public java.lang.String getMessageReference(MessageId messageId)
                                     throws java.io.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.

Specified by:
getMessageReference in interface MessageStore
Parameters:
messageId - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
java.io.IOException

removeMessage

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

Specified by:
removeMessage in interface MessageStore
Parameters:
context - TODO
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:
java.io.IOException

recover

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

Specified by:
recover in interface MessageStore
Throws:
java.lang.Exception

start

public void start()
Specified by:
start in interface Service

stop

public void stop()
Specified by:
stop in interface Service

removeAllMessages

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

Specified by:
removeAllMessages in interface MessageStore
Parameters:
context - TODO
Throws:
java.io.IOException
See Also:
MessageStore.removeAllMessages(ConnectionContext)

getDestination

public ActiveMQDestination getDestination()
Description copied from interface: MessageStore
The destination that the message store is holding messages for.

Specified by:
getDestination in interface MessageStore
Returns:

setUsageManager

public void setUsageManager(UsageManager usageManager)
Specified by:
setUsageManager in interface MessageStore
Parameters:
usageManager - The UsageManager that is controlling the destination's memory usage.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.