Spring / Spring gRPC Interview Questions
What is the difference between a blocking stub, a non-blocking async stub, and a future stub in generated gRPC client code?
| Stub type | Behavior |
| Blocking stub | Synchronous call; calling thread waits for the response |
| Async stub | Takes a StreamObserver callback; non-blocking, supports all four call types |
| Future stub | Unary calls return a ListenableFuture, useful for async/reactive composition |
Choosing between them depends on the caller's threading model: a blocking stub is the simplest to reason about in a traditional Spring MVC controller thread, an async stub is needed for streaming calls or to avoid tying up a thread while waiting, and a future stub fits nicely when composing results with CompletableFuture-style pipelines or reactive chains.
More Related questions...