Skip to content

shakyasudeep/pay-reactive-backend-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java - reactive backend examples

This repository contains a collection of examples/patterns that can be adopted to make a java based micorservice reactive.

GOV.UK Pay, a payment platform for the government consists of many microservices. Our backend is RESTFUL by default, and we use Dropwizard for most of java based microservices. Dropwizard is based on Jetty, a lightweight java http/servlet container. Architecturally, jetty is a thread based synchronous (blocking) request processing container, similar to many other traditional java servlet containers.

Over the last decade or so, asynchronous/non-blocking request processing architectures are gaining huge traction across the industry, primarily due to the capabilities of optimum usage of available resources (H/W, S/W) allowing significantly higher throughput. Although this model already been widely used in other (non-java) tech stacks (e.g. NodeJs, Scala/Akka), it has been a slow progress in Java community due to its lack of language features (functional) and lack of libraries / frameworks. However, with the introduction of Java 8 features and the appearance of several reliable libraries/frameworks (e.g. guava listenable futures, Rx Java, Akka) Java landscape is slowly shifting towards asynchronous non-blocking programming models.

The biggest challenge yet is the change of mentality among the developer community from a more traditional synchronous programming models to more functional / reactive programming models in order to gain the advantages these recent developments.

This repository presents few alternative non-blocking programming models / patterns and technologies for Java. We expect to adopt these (and possibly more) as we extend GOV.UK Pay in future.

Further Reading

Examples.

####1. Handling inbound requests

alt handling inbound requests

This is about how to handle HTTP/REST requests in a non-blocking way.

####2. Handling outbound requests

alt handling outbound requests

This is about how to handle outbound HTTP/REST requests in a non-blocking way.

####3. Handling internal workflows

alt internal workflows

This is about how we can compose a internal workflow of bunch of functions together in a reactive way.

####4. Decoupling of microservices using an event source

alt decoupling

This is about how we can compose a internal workflow of bunch of functions together in a reactive way.

###References

  1. RxJava rxjava
  2. Hystrix hystrix
  3. Guvava LitenableFutures Guvava
  4. Jersey
  1. Ratpack Ratpack
  2. Java8 CompletableFuture

Other options (not explored)

  1. VertX vert.x
  2. Akka akka

About

Firebreak

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%