This article serves as a valuable introduction to master I/O related technologies, it spans all of aspects needed to be on your way to demystify advanced frameworks, in particular the popular framework Netty. You will be prepared to delve deeper into more advanced topics by learning what is going on “under the hood”.
You may find that the article is a bit too long, but it’s not, most sections are just recalls, the aim is to ease the understanding.
We’ll begin with background on high-performance networking. With this context in place, we’ll introduce Netty, its core concepts, and building blocks.
Reactor hooks are a set of configurable lifecycle hooks that can be used for cross-cutting added behavior on Flux/Mono operators.
Dropping hooks are invoked when the source of an operator does not comply with the Reactive Streams specification. These kind of errors are outside of the normal execution path.
Typically below, when onError is invoked and we are in a completion state (done)
In that case, the onError unexpected exception is dropped. The same is true for onNext signal.
onOperatorError is invoked by operators when an unexpected Exception is thrown during the execution of their onNext, onError and onComplete signals.
When operating on data, errors are inevitable, when it occurs, you must make sure your code handles it in some way and gracefully recovers from it.
Reactor offers a number of operators to handle exceptions and errors.
onErrorResume is used when we want to subscribe to a fallback publisher when any error occurs. It’s like, listen, if any error occurs, I want you to forget about upstream and what happened and continue with subscribing to this stream that I am giving you.
As discussed earlier, you need to provide a fallback publisher
During the preceding article, we explored how bean classes gets registered inside the bean factory, we investigated in details a core bean processor responsible for scanning and registering various components.
The objective of this article is to take a look at beans initialisation, before covering that, let’s first introduce some concepts.
Inversion of control is a pattern describing an extern entity (container) responsible to wire objects at creation time by injecting it’s dependencies.
Dependency injection is a process of injecting the dependencies into an object.
Connecting objects with other objects, or “injecting” objects into other objects is called assembly.
In my previous article SpringBoot 2.4.x Configuration, we explored how spring load configuration files and create/update application’s environment.
In this article, we will continue our investigation, in particular, we will see how spring loads and register BeanDefinitions.
Let’s continue our investigation, starting from configureIgnoreBeanInfo method (just after environment have been prepared).
Specify Introspector.IGNORE_ALL_BEANINFO Flag.
spring.beaninfo.ignore configuration is used to determine whether to skip the search of the BeanInfo class.
In their new release, Spring decided to change the logic behind loading configuration files.
To represent elements that may contribute to the environment, a ConfigDataEnvironmentContributor is introduced, each contributor would be replaced during the process.
Spring decided to use a tree as a data structure in order to process/apply the configuration data.
I will refer to ConfigDataEnvironmentContributor as CDEContributor.
Each contributor can imports some properties (more on that later), and it will be appended as children, thus creating a whole tree.
Each contributor will contain some metadata describing the node:
1. location: a configDataLocation that will be resolved using a…
In Reactive Programming (Reactor)- Part 1, we explored the fundamentals of Reactive programming and discussed briefly Reactor Project.
In this article we will explore one of the most important and complex operator, FlatMap.
I highly recommend spending some time reading part 1 or any article explaining the basic principle of reactive programming (Reactor or RxJava doesn’t matter), so that you can follow easily.
It is basically just queue and subscription under one interface. it allows negotiating the fusion mode between subsequent operators.
The idea is that upstream can provide not only subscription but also allows subscribers to directly access…
Numerous components on a network, such as DNS servers, switches, load balancers, and others can generate errors anywhere in the life of a given request. A common way to handle theses failures is through the use of retries, and retries with backoff and jitter.
As an engineer, your should clearly enforce these practices when dealing with network connectivity or similar communication protocols over the internet.
Retries, as mentioned previously, are a nice way for dealing with transient remote API errors in client applications. …
In Traditional API servers, to deal with a large number of concurrent users, requests handling are made asynchronous. These solutions are based on several options (Callbacks, Future, CompletableFuture …).
We may think that using this kind of approach we can be completely asynchronous and be always available and performant, remember that each thread requires stack memory, there is always a limitation (error handling, call-back hell …), not to say that these are bad solutions, I just want to emphasize that it has not been designed to deal with operation that requires latency.
Idea behind the Reactive programming is to move…