Spring Integration

org.springframework.integration.aggregator
Class MessageCountReleaseStrategy

java.lang.Object
  extended by org.springframework.integration.aggregator.MessageCountReleaseStrategy
All Implemented Interfaces:
ReleaseStrategy

public class MessageCountReleaseStrategy
extends Object
implements ReleaseStrategy

A ReleaseStrategy that releases only the first n messages, where n is a threshold.

Author:
Dave Syer

Constructor Summary
MessageCountReleaseStrategy()
          Convenient constructor is only one message is required (threshold=1).
MessageCountReleaseStrategy(int threshold)
           
 
Method Summary
 boolean canRelease(MessageGroup group)
          Release the group if it has more messages than the threshold and has not previously been released.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageCountReleaseStrategy

public MessageCountReleaseStrategy(int threshold)
Parameters:
threshold - the number of messages to accept before releasing

MessageCountReleaseStrategy

public MessageCountReleaseStrategy()
Convenient constructor is only one message is required (threshold=1).

Method Detail

canRelease

public boolean canRelease(MessageGroup group)
Release the group if it has more messages than the threshold and has not previously been released. Previous releases leave an imprint on the group in the form of marked messages. It is possible that more messages than the threshold could be released, but only if multiple consumers receive messages from the same group concurrently.

Specified by:
canRelease in interface ReleaseStrategy

Spring Integration

Copyright © 2010. All Rights Reserved.