org.springframework.integration.store
Class SimpleMessageGroup

java.lang.Object
  extended by org.springframework.integration.store.SimpleMessageGroup
All Implemented Interfaces:
MessageGroup

public class SimpleMessageGroup
extends java.lang.Object
implements MessageGroup

Represents a mutable group of correlated messages that is bound to a certain MessageStore and correlation key. The group will grow during its lifetime, when messages are added to it. This is not thread safe and should not be used for long running aggregations.

Since:
2.0
Author:
Iwein Fuld, Oleg Zhurakousky, Dave Syer

Field Summary
 java.util.Collection<Message<?>> marked
           
 java.util.Collection<Message<?>> unmarked
           
 
Constructor Summary
SimpleMessageGroup(java.util.Collection<? extends Message<?>> unmarked, java.util.Collection<? extends Message<?>> marked, java.lang.Object correlationKey, long timestamp)
           
SimpleMessageGroup(java.util.Collection<? extends Message<?>> unmarked, java.lang.Object correlationKey)
           
SimpleMessageGroup(MessageGroup template)
           
SimpleMessageGroup(java.lang.Object correlationKey)
           
 
Method Summary
 boolean add(Message<?> message)
          Add a message to the internal list.
 java.lang.Object getCorrelationKey()
           
 java.util.Collection<Message<?>> getMarked()
           
 Message<?> getOne()
           
 int getSequenceSize()
           
 long getTimestamp()
           
 java.util.Collection<Message<?>> getUnmarked()
           
 boolean isComplete()
           
 void mark()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

marked

public final java.util.Collection<Message<?>> marked

unmarked

public final java.util.Collection<Message<?>> unmarked
Constructor Detail

SimpleMessageGroup

public SimpleMessageGroup(java.lang.Object correlationKey)

SimpleMessageGroup

public SimpleMessageGroup(java.util.Collection<? extends Message<?>> unmarked,
                          java.lang.Object correlationKey)

SimpleMessageGroup

public SimpleMessageGroup(java.util.Collection<? extends Message<?>> unmarked,
                          java.util.Collection<? extends Message<?>> marked,
                          java.lang.Object correlationKey,
                          long timestamp)

SimpleMessageGroup

public SimpleMessageGroup(MessageGroup template)
Method Detail

getTimestamp

public long getTimestamp()
Specified by:
getTimestamp in interface MessageGroup

add

public boolean add(Message<?> message)
Description copied from interface: MessageGroup
Add a message to the internal list. This is needed to avoid hitting the underlying store or copying the internal list. Use with care.

Specified by:
add in interface MessageGroup

getUnmarked

public java.util.Collection<Message<?>> getUnmarked()
Specified by:
getUnmarked in interface MessageGroup
Returns:
internal message list, modification is allowed, but not recommended

getMarked

public java.util.Collection<Message<?>> getMarked()
Specified by:
getMarked in interface MessageGroup
Returns:
internal message list, modification is allowed, but not recommended

getCorrelationKey

public java.lang.Object getCorrelationKey()
Specified by:
getCorrelationKey in interface MessageGroup
Returns:
the correlation key that links these messages together according to a particular CorrelationStrategy

isComplete

public boolean isComplete()
Specified by:
isComplete in interface MessageGroup

getSequenceSize

public int getSequenceSize()
Specified by:
getSequenceSize in interface MessageGroup

mark

public void mark()
Specified by:
mark in interface MessageGroup

size

public int size()
Specified by:
size in interface MessageGroup

getOne

public Message<?> getOne()
Specified by:
getOne in interface MessageGroup