Skip to content

daggerok/avoiding-reactor-meltdown

Repository files navigation

how to block in reactor Build Status

...when it's needed

problem

In short: we should never block! But sometimes we just cannot avoid blocking calls... For instance, when we have to use library which hasn't reactive non-blocking support, and maybe even not planed to be reactive, legacy libraries, JDBC, ThreadLocal, etc...

identify problem

solve problem

  • bad: create separate microservice, which will call blocking one
  • good: perform all blocking calls in a separate thread provided by special defined scheduled

run and test

  1. start apps:
    jdk11 ; ./mvnw -f mongo spring-boot:run
    jdk11 ; ./mvnw -f name-service spring-boot:run
  2. execute all REST API calls from api.http file

resources