October 2018
Intermediate to advanced
982 pages
23h 29m
English
Having added the ability to comment on other people's posted images, it would be nice to start gathering metrics.
To do so, we can introduce metrics similar to those shown in Chapter 14, Developer Tools for Spring Boot Apps, as follows:
@Controller
public class CommentController {
private final RabbitTemplate rabbitTemplate;
private final MeterRegistry meterRegistry;
public CommentController(RabbitTemplate rabbitTemplate,
MeterRegistry meterRegistry) {
this.rabbitTemplate = rabbitTemplate;
this.meterRegistry = meterRegistry; } @PostMapping("/comments") public Mono<String> addComment(Mono<Comment> newComment) { return newComment.flatMap(comment -> Mono.fromRunnable(() -> rabbitTemplate .convertAndSend( ...Read now
Unlock full access