Spring-Boot 2.1.x and overriding bean definition
I was recently migrating an application from Spring Boot 1.5.X to Spring Boot 2.X and saw an issue with overriding Spring Bean definitions. One of the configurations was along these lines in...
View ArticleWater Pouring Problem with Kotlin and Vavr
The first time I saw the Water Pouring Problem being programmatically solved was the excellent lectures on functional Programming by Martin Odersky on Coursera. The solution demonstrates the power of...
View ArticleFunctional Hystrix using Spring Cloud HystrixCommands
Spring's WebClient provides a non-blocking client for making service to service calls. Hystrix, though now in a maintenance mode, has been used for protecting service to service calls by preventing...
View ArticleCallback hell and Reactive patterns
One of the ways that I have better understood the usefulness of a Reactive Streams based approach is how it simplifies a Non-blocking IO call.This post will be a quick walkthrough of the kind of code...
View ArticleChicken and egg - resolving Spring properties ahead of a test
Consider a service class responsible for making a remote call and retrieving a detail:...public class CitiesService { private final WebClient.Builder webClientBuilder; private final String baseUrl;...
View ArticleUnit test for Spring's WebClient
WebClient to quote its Java documentation is Spring Framework's Non-blocking, reactive client to perform HTTP requests, exposing a fluent, reactive API over underlying HTTP client libraries such as...
View ArticleHash a Json
I recently wrote a simple library to predictably hash a json. The utility is built on top of the excellent Jackson Json parsing libraryProblemI needed a hash generated out of a fairly large json based...
View ArticleProject reactor - de-structuring a Tuple
Tuples are simple data structures that hold a fixed set of items, each of a different data type.Project Reactor provides a Tuple data structure that can hold about 8 different types.Tuples are very...
View ArticleSpring WebClient and Java date-time fields
WebClient is Spring Framework's reactive client for making service to service calls.WebClient has become a go to utility for me, however I unexpectedly encountered an issue recently in the way it...
View ArticleProject Reactor expand method
One of my colleagues at work recently introduced me to the expand operator of the Project Reactor types and in this post I want to cover a few ways in which I have used it.Unrolling a Paginated...
View ArticleProcessing SQS Messages using Spring Boot and Project Reactor
I recently worked on a project where I had to efficiently process a large number of messages streaming in through an AWS SQS Queue. In this post (and potentially one more), I will go over the approach...
View ArticleProcessing SQS Messages using Spring Boot and Project Reactor - Part 2
This is a follow up to my blog post about processing SQS messages efficiently using Spring Boot and Project ReactorThere are a few gaps in the approach that I have listed in the first part. 1. Handling...
View ArticleAWS DynamoDB version field using AWS SDK for Java 2
It is useful to have a version attribute on any entity saved to an AWS DynamoDB database which is simply a numeric indication of the number of times the entity has been modified. When the entity is...
View ArticleExpressing a conditional expression using Json - Java Implementation
I had a need recently to express a conditional expression in a form that a front end Javascript application and a backend Java application could both create and read. Expressing the conditional...
View ArticleBackpressure in Project Reactor
Project Reactor implements the Reactive Streams specification, which is a standard for asynchronously processing a stream of data while respecting the processing capabilities of a consumer. At a very...
View ArticleAn experiment with Little's Law
My previous blog post about Project Reactor and Backpressure was about how Project Reactor provides sane defaults for scenarios where a lot more information is produced than a Consumer can consume. It...
View ArticlePermutation - Heap's Algorithm
This is a little bit of an experimentation that I did recently to figure out a reasonable code to get all possible permutations of a set of characters. So say given a set of characters "ABC", my...
View ArticleAWS SDK 2 for Java and storing a Json in DynamoDB
AWS DynamoDB is described as a NoSQL key-value and a document database. In my work I mostly use the key-value behavior of the database but rarely use the document database features, however the...
View ArticleGenerating a stream of Fibonacci numbers
A Java stream represents potentially an infinite sequence of data. This is a simple post that will go into the mechanics involved in generating a simple stream of Fibonacci numbers. The simplest way to...
View ArticleTop "n" using a Priority Queue
If you ever need to capture the smallest or largest "n" from a stream of data, the approach more often than not will be to use a simple data-structure called the Priority Queue. Priority Queues do one...
View Article