Scrivio Interview library

Testing and operating reactive code

15 questions in 4 subtopics.

StepVerifier

CodingFoundations6 min read
Write a StepVerifier test for a Flux<String> that should emit "a", "b" and then complete, and for a Mono<User> that should fail with UserNotFoundException.
CodingIntermediate6 min read
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?
LeadershipAdvanced7 min read
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?
DesignPrincipal6 min read
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

ConceptFoundations6 min read
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?
DebuggingIntermediate7 min read
A WebFlux endpoint sometimes returns an empty 200 response instead of data, with no error logged. How would you investigate?
ScenarioAdvanced6 min read
On-call engineers say reactive services are much harder to debug than MVC services. What would you put in place at the platform level?
LeadershipPrincipal6 min read
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

ConceptFoundations6 min read
What are virtual threads in Java 21 and how do you enable them in Spring Boot?
ScenarioIntermediate7 min read
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?
DesignAdvanced9 min read
Compare reactive programming and virtual threads for a service that aggregates data from 10 downstream services per request, with strict latency targets.
LeadershipPrincipal7 min read
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

ScenarioFoundations7 min read
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?
DesignIntermediate8 min read
List the signals that suggest a service should not be reactive, and the signals that suggest it should.
LeadershipAdvanced6 min read
How would you stop teams from adopting reactive programming where it does not fit, without banning it?