Reactor Developer Tools
Get introduced to the debugging Reactor flows.
We'll cover the following...
The tools covered so far are specific to Spring Boot. But since we’ve embraced Project Reactor, we don’t want to pass up their tools, either.
Debugging Reactor flows
When something goes wrong in a Reactor flow, what can we do? Can we inspect the stack trace?
What do we think we’ll get when printing out a stack trace? Perhaps something based on the assembly, or something based on the subscription?
When writing Reactor code, the series of operations we lay out in our application can be a recipe for what will happen. In the documentation, this is referred to as assembly. It’s like putting together a bunch of command objects using lambda functions and method handles. The assembly of our recipe may occur in a single thread.
But remember, nothing happens until someone subscribes for the results. Our recipe kicks into action when that happens, and nothing says that the thread used to assemble our Reactor flow is the same thread (or threads) used to carry out all those steps.
Another complication is that Java stack traces don’t cross thread boundaries. We must do something deliberately for multithreaded code to capture an exception and hand it over the boundary. This issue is magnified when writing reactive code, where every step in a flow has the potential to be run on a different thread at the time of subscription. ...