More and more engineers now use Spring reactive stack to build resilient applications on cloud platforms. However, the debugging process for the reactive stack is not straightforward, as it is in the Spring MVC stack. That is mainly due to the drastically different assembly and execution-style from one to another. This article goes through tools available to debug and identify the problems in reactive code.
The examples and explanations in this article assume the reader has a basic knowledge of the reactive streams, their execution.
This article divides the debugging into three main sections.
Validation is an integral part of the API request lifecycle. Validating the incoming data is a best practice for any API because of the following reasons.
Reduce the complexity of logic at lower layers.
If the API accepts the HTTP request from the API consumer without validation, the API has to check for the empty, malformed values all along with the business logic. This will ultimately affect the code readability negatively as it shifts the reader’s focus away from the core business logic.
Improve the security of the system
The data from the web frontend, mobile, or command-line client can…
Almost every modern business which has some digital presence use this 20-year-old protocol. It could be a web site, a mobile application, or some standalone application that needs to updated through the internet; HTTP is ubiquitous. Hence, most software engineers out there have to deal with HTTP to fulfil their job. But only a few of them truly understand this remarkable medium of communication.
There are two main reasons for this. Firstly, like any other protocol, HTTP also wrapped with high-level abstractions via modern libraries when it meets the application engineer.
Secondly, people only start to care about it when…
You do not have to re-implement all existing APIs in reactive streams.
බොහෝ විට දුම් රියෙන් උදේට හවසට වැඩට යන මම කල්පනා සයුරේ ගිලී සිතිවිලි රැලි අතර පිහිනමින් ගමන නිමා කරමි. සැතපුම් දහස් ගනනක් මවු බිමෙන් ඈත්ව සිටින මට නිතර අම්මා සිහිවීම අරුමයක් නොවේ. ඇය දැන් මහළුය මා දුරකථනයෙන් අමතන වදන්ද කීප වරක් පැවසිය යුතුය. සෑම මවක් මෙන්ම ඇයද අපි සිවුදෙනා ලොකුමහත් කරගැනීමට බොහෝ කැපකිරීම් කලාය. තමා ආදරය කල ගුරු වෘතියෙන්ද කලින්ම සමු ගත්තාය. මේ සටහන මා අතින් ලියැවෙන්නේ ඈට හා ඈ වන් සුවහසක් මවුවරුන් වෙනුවෙන් මගේ සිත් සන්තානයේ ගොජ දමමින් තිබු අප්රමාණ ආදර ගෞරවයේ පිටාර යාමක් ලෙසිනි.
අපේ අම්මා ඇතුලුව සියලු අම්මලා විශේෂ මනුෂ්ය කොට්ටාසයකි. එය වටහා ගැනීමට අපි ලොකු මහත්…
Reactive stream is a powerful technique to address the use cases we encounter in even-driven systems. It allows the developer a lot more flexibility than its counterparts. And more importantly empower the developer to focus on business logic , rather than wasting productivity on dealing with the underlying execution mechanism.
Here in this post we are going to discuss various error handling mechanisms offered through reactive stream fluent APIs. For this example we are using project reactor.
Exception and Errors
Before we dive deep we need to be clear about a few concepts. Exceptions and Errors are not unfamiliar…
The WebClient is the de-facto interface to use when calling reactive downstream endpoints while developing web services on the reactive stack. It is a non-blocking, reactive client to perform HTTP requests. It uses Reactor Netty as its default underlying HTTP client library. And allow the application developers to customise the implementation if required.
One of the key aspects of calling downstream endpoints in a resilient system is to handle the timeouts gracefully and stop the possible cascading failures. If not carefully designed unhandled timeouts can exhaust the system resources.
The illusion of signal timeout.
In Building Reactive REST APIs in Java : Part 1 we identified difference between Reactive systems and Reactive programming and also laid solid foundation on reactive programming. If you have not read it yet please consider reading it and come back. Most of the technical details that we are going to discuss here will be based on the foundation in that article.
In this article, we are going to build a RESTFul API using Reactor reactive library and Spring WebFlux stack.
The main reason behind selecting Reactor as the reactive library for this article is that it’s…
This article is focused on building RESTFul APIs using Java while benefiting from the reactive programming model. But unlike most other articles on this topic, this article would not rush to code straight away. It will guide you through the backbone of this programming paradigm to give you solid understanding of it. Then use that knowledge to build APIs.
This series consists of two parts. First part introduce reactive systems and reactive programming and clear the confusion between these terms.
Then it covers the fundamentals of reactive programming, and compares the traditional concurrency model with message/event driven concurrency.
Axios is a popular Promises based HTTP client library. It offers nice abstraction over the core node http module. This post explains the default error propagation mechanism of axios library, and how to control it using the axios request configuration. Finally, how you can test all these using nock, HTTP mocking library and Jest test library.
This article assumes the reader has good understanding of how Promises work and how async/await create a syntactic sugar layer over Promises to make asynchronous execution looks like synchronous.
To keep the focus on the topic of this article I am going to use…