Docker RabbitMQ cluster
I have been trying to create a Docker based RabbitMQ cluster on and off for sometime and got it working today - fairly basic and flaky but could be a good starting point for others to improve on.This...
View ArticleSpring Caching abstraction and Google Guava Cache
Spring provides a great out of the box support for caching expensive method calls. The caching abstraction is covered in a great detail here.My objective here is to cover one of the newer cache...
View ArticleSpring boot based websocket application and capturing http session id
I was involved in a project recently where we needed to capture the http session id for a websocket request - the reason was to determine the number of websocket sessions utilizing the same underlying...
View ArticleSpring boot war packaging
Spring boot recommends creating an executable jar with an embedded container(tomcat or jetty) during build time and using this executable jar as a standalone process at runtime. It is common however to...
View ArticleExternalizing session state for a Spring-boot application using spring-session
Spring-session is a very cool new project that aims to provide a simpler way of managing sessions in Java based web applications. One of the features that I explored with spring-session recently was...
View ArticleSpring RestTemplate with a linked resource
Spring Data REST is an awesome project that provides mechanisms to expose the resources underlying a Spring Data based repository as REST resources.Exposing a service with a linked resourceConsider two...
View ArticleRabbitMQ - Processing messages serially using Spring integration Java DSL
If you ever have a need to process messages serially with RabbitMQ with a cluster of listeners processing the messages, the best way that I have seen is to use a "exclusive consumer" flag on a listener...
View ArticleSolving "Water buckets" problem using Scala
I recently came across a puzzle called the "Water Buckets" problem in this book, which totally stumped me. You have a 12-gallon bucket, an 8-gallon bucket and a 5-gallon bucket. The 12-gallon bucket is...
View ArticleSpring retry - ways to integrate with your project
If you have a need to implement robust retry logic in your code, a proven way would be to use the spring retry library. My objective here is not to show how to use the spring retry project itself, but...
View ArticleUsing Netflix Hystrix annotations with Spring
I can't think of a better way to describe a specific feature of Netflix Hystrix library than by quoting from its home page:Latency and Fault Tolerance by:Stop cascading failures. Fallbacks and graceful...
View ArticleLearning Netflix Governator - Part 1
I have been working with Netflix Governator for the last few days and got to try out a small sample using Governator as a way to compare it with the dependency injection feature set of Spring...
View ArticleLearning Netflix Governator - Part 2
To continue from the previous entry on some basic learnings on Netflix Governator, here I will cover one more enhancement that Netflix Governator brings to Google Guice - Lifecycle ManagementLifecycle...
View ArticleDisambiguating between instances with Google Guice
Google guice provides a neat way to select a target implementation if there are multiple implementations of an interface. My samples are based on an excellent article by Josh Long(@starbuxman) on a...
View ArticleNetflix Governator Tests - Introducing governator-junit-runner
Consider a typical Netflix Governator junit test.public class SampleWithGovernatorJunitSupportTest { @Rule public LifecycleTester tester = new LifecycleTester(); @Test public void...
View ArticleStanding up a local Netflix Eureka
Here I will consider two different ways of standing up a local instance of Netflix Eureka. If you are not familiar with Eureka, it provides a central registry where (micro)services can register...
View ArticleAsync abstractions using rx-java
One of the big benefits in using Rx-java for me has been the way the code looks exactly the same whether the underlying calls are synchronous or asynchronous and hence the title of this entry.Consider...
View ArticleJava 8 Stream to Rx-Java Observable
I was recently looking at a way to convert a Java 8 Stream to Rx-JavaObservable.There is one api in Observable that appears to do this :public static final <T> Observable<T>...
View ArticleNetflix Archaius properties in a Spring project
Archaius BasicsNetflix Archaius is a library for managing configuration for an application. Consider a properties file "sample.properties" holding a property called...
View ArticleUsing rx-java Observable in a Spring MVC flow
Spring MVC has supported asynchronous request processing flow for sometime now and this support internally utilizes the Servlet 3 async support of containers like Tomcat/Jetty. Spring Web Async...
View ArticleHot and cold rx-java Observable
My own understanding of Hot and Cold Observable is quite shaky, but here is what I have understood till now!Cold ObservableConsider an API which returns an rx-java Observable:import obs.Util;import...
View Article