Spring Integration

org.springframework.integration.store
Class SimpleMessageGroup

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

public class SimpleMessageGroup
extends Object
implements 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 added to it. This MessageGroup is thread safe.

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

Field Summary
 BlockingQueue<Message<?>> marked
           
 BlockingQueue<Message<?>> unmarked
           
 
Constructor Summary
SimpleMessageGroup(Collection<? extends Message<?>> unmarked, Collection<? extends Message<?>> marked, Object groupId, long timestamp)
           
SimpleMessageGroup(Collection<? extends Message<?>> unmarked, Object groupId)
           
SimpleMessageGroup(MessageGroup template)
           
SimpleMessageGroup(Object groupId)
           
 
Method Summary
 void add(Message<?> message)
           
 boolean canAdd(Message<?> message)
          Query if the message can be added.
 Object getGroupId()
           
 Collection<Message<?>> getMarked()
           
 Message<?> getOne()
           
 int getSequenceSize()
           
 long getTimestamp()
           
 Collection<Message<?>> getUnmarked()
           
 boolean isComplete()
           
 void mark(Message<?> messageToMark)
           
 void markAll()
           
 void remove(Message<?> message)
           
 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 BlockingQueue<Message<?>> marked

unmarked

public final BlockingQueue<Message<?>> unmarked
Constructor Detail

SimpleMessageGroup

public SimpleMessageGroup(Object groupId)

SimpleMessageGroup

public SimpleMessageGroup(Collection<? extends Message<?>> unmarked,
                          Object groupId)

SimpleMessageGroup

public SimpleMessageGroup(Collection<? extends Message<?>> unmarked,
                          Collection<? extends Message<?>> marked,
                          Object groupId,
                          long timestamp)

SimpleMessageGroup

public SimpleMessageGroup(MessageGroup template)
Method Detail

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 Collection<Message<?>> getUnmarked()
Specified by:
getUnmarked in interface MessageGroup
Returns:
unmarked messages in the group at time of the invocation

getMarked

public Collection<Message<?>> getMarked()
Specified by:
getMarked in interface MessageGroup
Returns:
marked messages in the group at the time of the invocation

getGroupId

public 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)

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

Spring Integration

Copyright © 2010. All Rights Reserved.