Class RateLimitingEventAggregator<E>

java.lang.Object
com.pnfsoftware.jeb.util.concurrent.RateLimitingEventAggregator<E>
Type Parameters:
E - event type

public class RateLimitingEventAggregator<E> extends Object
A rate-limiting event aggregator that buffers and forwards events to a destination target.
  • Constructor Details

    • RateLimitingEventAggregator

      public RateLimitingEventAggregator(RateLimitingEventAggregator.IEventTarget<E> target, long periodMs)
      Parameters:
      target - actual target for the events
      periodMs - the minimal time between two events to avoid buffering, in ms; setting this value to zero or negative effectively disables rate limiting (i.e. events are always passed to the target as they arrive)
  • Method Details

    • send

      public boolean send(E e)
      Parameters:
      e - a non-null event object
      Returns:
      a hint: if true, the event was passed to the target; else, it was buffered and will be passed at a later time