
pl.allegro.tech.hermes.management.api.StatsEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-management Show documentation
Show all versions of hermes-management Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.management.api;
import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
import io.swagger.annotations.ApiOperation;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HttpMethod;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import org.springframework.beans.factory.annotation.Autowired;
import pl.allegro.tech.hermes.api.Stats;
import pl.allegro.tech.hermes.api.SubscriptionStats;
import pl.allegro.tech.hermes.api.TopicStats;
import pl.allegro.tech.hermes.management.domain.subscription.SubscriptionService;
import pl.allegro.tech.hermes.management.domain.topic.TopicService;
@Path("stats")
public class StatsEndpoint {
private final SubscriptionService subscriptionService;
private final TopicService topicService;
@Autowired
public StatsEndpoint(SubscriptionService subscriptionService, TopicService topicService) {
this.subscriptionService = subscriptionService;
this.topicService = topicService;
}
@GET
@Produces(APPLICATION_JSON)
@ApiOperation(
value = "Get topic and subscription stats",
response = Stats.class,
httpMethod = HttpMethod.GET)
public Stats getStats() {
TopicStats topicStats = topicService.getStats();
SubscriptionStats subscriptionStats = subscriptionService.getStats();
return new Stats(topicStats, subscriptionStats);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy