
io.dropwizard.redis.metrics.event.LettuceMetricsSubscriber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-redis Show documentation
Show all versions of dropwizard-redis Show documentation
Provides easy integration for Dropwizard applications with Redis
The newest version!
package io.dropwizard.redis.metrics.event;
import io.dropwizard.redis.metrics.event.visitor.EventVisitor;
import io.dropwizard.redis.metrics.event.wrapper.EventWrapperFactory;
import io.dropwizard.redis.metrics.event.wrapper.VisitableEventWrapper;
import io.lettuce.core.event.Event;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
public class LettuceMetricsSubscriber implements Consumer {
private final List eventVisitors;
public LettuceMetricsSubscriber(List eventVisitors) {
this.eventVisitors = eventVisitors;
}
@Override
public void accept(Event event) {
final Optional eventWrapperOpt = EventWrapperFactory.build(event);
eventWrapperOpt.ifPresent(eventWrapper -> eventVisitors.forEach(eventWrapper::accept));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy