Testing and operating reactive code
15 questions in 4 subtopics.
StepVerifier
Write aStepVerifier test for a Flux<String> that should emit "a", "b" and then complete, and for a Mono<User> that should fail with UserNotFoundException.How do you test a Flux that emits one item per hour (for example built with Flux.interval(Duration.ofHours(1)).take(3)) without the test taking three hours?Reactive code in your organisation has frequent production bugs that unit tests did not catch, such as missing subscriptions and blocking calls. What testing standards would you introduce?Your organisation has 150 reactive services and is considering a gradual move toward virtual threads. How would you use testing (StepVerifier suites, contract tests, load tests) to make that migration safe over several years?Debugging reactive chains
Stack traces from Reactor errors often show only operator internals. What tools does Reactor offer to find where in your code the failing pipeline was assembled?A WebFlux endpoint sometimes returns an empty 200 response instead of data, with no error logged. How would you investigate?On-call engineers say reactive services are much harder to debug than MVC services. What would you put in place at the platform level?Operational cost (debugging time, incident duration) for reactive services has been consistently higher than for blocking ones in your company. How would you use this data in long-term platform decisions?Reactive vs virtual threads
What are virtual threads in Java 21 and how do you enable them in Spring Boot?After enabling virtual threads in a Spring MVC service, throughput rises but the database starts failing with pool timeouts and high load. Why, and what would you change?Compare reactive programming and virtual threads for a service that aggregates data from 10 downstream services per request, with strict latency targets.Your organisation has 150 WebFlux services built over six years. With virtual threads now mature, would you plan a migration back to blocking code? How would you decide?When not to go reactive
A junior developer wants to make a new internal admin service reactive because it is the modern approach. The service has 5 users and uses JPA. What would you tell them?List the signals that suggest a service should not be reactive, and the signals that suggest it should.How would you stop teams from adopting reactive programming where it does not fit, without banning it?No question matches these choices.