Package io.github.resilience4j.consumer
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 Summary
ConstructorsConstructorDescriptionCircularEventConsumer(int capacity) Creates anCircuitBreakerEventConsumerwith the given (fixed) capacity -
Method Summary
Modifier and TypeMethodDescriptionvoidconsumeEvent(T event) Returns a list containing all of the buffered events.Returns a stream containing all of the buffered events.
-
Constructor Details
-
CircularEventConsumer
public CircularEventConsumer(int capacity) Creates anCircuitBreakerEventConsumerwith the given (fixed) capacity- Parameters:
capacity- the capacity of this CircuitBreakerEventConsumer- Throws:
IllegalArgumentException- ifcapacity < 1
-
-
Method Details
-
consumeEvent
- Specified by:
consumeEventin interfaceio.github.resilience4j.core.EventConsumer<T>
-
getBufferedEvents
Returns a list containing all of the buffered events.- Returns:
- a list containing all of the buffered events.
-
getBufferedEventsStream
Returns a stream containing all of the buffered events.- Returns:
- a stream containing all of the buffered events.
-