org.springframework.integration.store
Class SimpleMessageGroup
java.lang.Object
org.springframework.integration.store.SimpleMessageGroup
All Implemented Interfaces: MessageGroup
public class SimpleMessageGroup extends java.lang.Objectimplements MessageGroup
Represents a mutable group of correlated messages that is bound to a certain MessageStore
and group id. The
group will grow during its lifetime, when messages are add
ed to it. This MessageGroup is thread safe.
Since:
2.0
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
marked
public final java.util.concurrent.BlockingQueue<Message <?>> marked
unmarked
public final java.util.concurrent.BlockingQueue<Message <?>> unmarked
SimpleMessageGroup
public SimpleMessageGroup (java.lang.Object groupId)
SimpleMessageGroup
public SimpleMessageGroup (java.util.Collection<? extends Message <?>> unmarked,
java.lang.Object groupId)
SimpleMessageGroup
public SimpleMessageGroup (java.util.Collection<? extends Message <?>> unmarked,
java.util.Collection<? extends Message <?>> marked,
java.lang.Object groupId,
long timestamp)
SimpleMessageGroup
public SimpleMessageGroup (MessageGroup template)
getTimestamp
public long getTimestamp ()
Specified by: getTimestamp
in interface MessageGroup
Returns: the timestamp (milliseconds since epoch) associated with the creation of this group
canAdd
public boolean canAdd (Message <?> message)
Description copied from interface: MessageGroup
Query if the message can be added.
Specified by: canAdd
in interface MessageGroup
add
public void add (Message <?> message)
remove
public void remove (Message <?> message)
getUnmarked
public java.util.Collection<Message <?>> getUnmarked ()
Specified by: getUnmarked
in interface MessageGroup
Returns: unmarked messages in the group at time of the invocation
getMarked
public java.util.Collection<Message <?>> getMarked ()
Specified by: getMarked
in interface MessageGroup
Returns: marked messages in the group at the time of the invocation
getGroupId
public java.lang.Object getGroupId ()
Specified by: getGroupId
in interface MessageGroup
Returns: the key that links these messages together
isComplete
public boolean isComplete ()
Specified by: isComplete
in interface MessageGroup
Returns: true if the group is complete (i.e. no more messages are expected to be added)
getSequenceSize
public int getSequenceSize ()
Specified by: getSequenceSize
in interface MessageGroup
Returns: the size of the sequence expected 0 if unknown
mark
public void mark (Message <?> messageToMark)
Mark the given message in this group. If the message is not part of this group then this call has no effect.
markAll
public void markAll ()
size
public int size ()
Specified by: size
in interface MessageGroup
Returns: the total number of messages (marked and unmarked) in this group
getOne
public Message <?> getOne ()
Specified by: getOne
in interface MessageGroup
Returns: a single message from the group
toString
public java.lang.String toString ()
Overrides: toString
in class java.lang.Object