org.springframework.integration.store
Class SimpleMessageStore

java.lang.Object
  extended by org.springframework.integration.store.SimpleMessageStore
All Implemented Interfaces:
MessageStore

public class SimpleMessageStore
extends java.lang.Object
implements MessageStore

Map-based implementation of MessageStore that enforces a maximum capacity.

Since:
2.0
Author:
Iwein Fuld, Mark Fisher

Constructor Summary
SimpleMessageStore(int capacity)
           
 
Method Summary
 Message<?> delete(java.lang.Object key)
          Remove the Message with the given id from the MessageStore, if present, and return it.
 Message<?> get(java.lang.Object key)
          Return the Message with the given id, or null if no Message with that id exists in the MessageStore.
 java.util.List<Message<?>> list()
          Return all Messages currently in the MessageStore.
 java.util.List<Message<?>> list(java.lang.Object correlationKey)
          Return all Messages currently in the MessageStore that contain the provided correlationId header value.
<T> Message<T>
put(Message<T> message)
          Put the provided Message into the MessageStore.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMessageStore

public SimpleMessageStore(int capacity)
Method Detail

put

public <T> Message<T> put(Message<T> message)
Description copied from interface: MessageStore
Put the provided Message into the MessageStore. Its id will be used as an index so that the MessageStore.get(Object) and MessageStore.delete(Object) behave properly. If available, its correlationId header will also be stored so that the MessageStore.list(Object) method behaves properly.

Specified by:
put in interface MessageStore

get

public Message<?> get(java.lang.Object key)
Description copied from interface: MessageStore
Return the Message with the given id, or null if no Message with that id exists in the MessageStore.

Specified by:
get in interface MessageStore

list

public java.util.List<Message<?>> list()
Description copied from interface: MessageStore
Return all Messages currently in the MessageStore.

Specified by:
list in interface MessageStore

delete

public Message<?> delete(java.lang.Object key)
Description copied from interface: MessageStore
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.

Specified by:
delete in interface MessageStore

size

public int size()

list

public java.util.List<Message<?>> list(java.lang.Object correlationKey)
Description copied from interface: MessageStore
Return all Messages currently in the MessageStore that contain the provided correlationId header value.

Specified by:
list in interface MessageStore
See Also:
MessageHeaders.getCorrelationId()