Class MessageCountReleaseStrategy

java.lang.Object
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, Oleg Zhurakousky, Artem Bilan
  • Constructor Details

    • MessageCountReleaseStrategy

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

      public MessageCountReleaseStrategy(int threshold)
      Construct an instance based on the provided threshold.
      Parameters:
      threshold - the number of messages to accept before releasing
  • Method Details

    • canRelease

      public boolean canRelease(MessageGroup group)
      Release the group if it has more messages than the threshold and has not previously been released. 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