Spring Integration

org.springframework.integration.store
Interface MessageStore

All Known Implementing Classes:
AbstractKeyValueMessageStore, GemfireMessageStore, JdbcMessageStore, MongoDbMessageStore, RedisMessageStore, SimpleMessageStore

public interface MessageStore

Strategy interface for storing and retrieving messages.

Since:
2.0
Author:
Mark Fisher, Iwein Fuld, Dave Syer

Method Summary
<T> Message<T>
addMessage(Message<T> message)
          Put the provided Message into the MessageStore.
 Message<?> getMessage(java.util.UUID id)
          Return the Message with the given id, or null if no Message with that id exists in the MessageStore.
 long getMessageCount()
          Optional attribute giving the number of messages in the store.
 Message<?> removeMessage(java.util.UUID id)
          Remove the Message with the given id from the MessageStore, if present, and return it.
 

Method Detail

getMessage

Message<?> getMessage(java.util.UUID id)
Return the Message with the given id, or null if no Message with that id exists in the MessageStore.


addMessage

<T> Message<T> addMessage(Message<T> message)
Put the provided Message into the MessageStore. The store may need to mutate the message internally, and if it does then the return value can be different than the input. The id of the return value will be used as an index so that the getMessage(UUID) and removeMessage(UUID) behave properly. Since messages are immutable, putting the same message more than once is a no-op.

Returns:
the message that was stored

removeMessage

Message<?> removeMessage(java.util.UUID id)
Remove the Message with the given id from the MessageStore, if present, and return it. If no Message with that id is present in the store, this will return null.


getMessageCount

@ManagedAttribute
long getMessageCount()
Optional attribute giving the number of messages in the store. Implementations may decline to respond by throwing an exception.

Returns:
the number of messages
Throws:
java.lang.UnsupportedOperationException - if not implemented

Spring Integration