Class CircularEventConsumer<T>

java.lang.Object
io.github.resilience4j.consumer.CircularEventConsumer<T>
All Implemented Interfaces:
io.github.resilience4j.core.EventConsumer<T>

public class CircularEventConsumer<T> extends Object implements io.github.resilience4j.core.EventConsumer<T>
A consumer which stores CircuitBreakerEvents in a circular buffer with a fixed capacity.
  • Constructor Details

    • CircularEventConsumer

      public CircularEventConsumer(int capacity)
      Creates an CircuitBreakerEventConsumer with the given (fixed) capacity
      Parameters:
      capacity - the capacity of this CircuitBreakerEventConsumer
      Throws:
      IllegalArgumentException - if capacity < 1
  • Method Details

    • consumeEvent

      public void consumeEvent(T event)
      Specified by:
      consumeEvent in interface io.github.resilience4j.core.EventConsumer<T>
    • getBufferedEvents

      public List<T> getBufferedEvents()
      Returns a list containing all of the buffered events.
      Returns:
      a list containing all of the buffered events.
    • getBufferedEventsStream

      public Stream<T> getBufferedEventsStream()
      Returns a stream containing all of the buffered events.
      Returns:
      a stream containing all of the buffered events.