Posts

Showing posts with the label Spring Boot

Spring Boot, Google Cloud Trace - Distributed tracing example

Image
In this section, we will  create 2 simple services ( customer  & product ) and add distributed tracing with Spring Cloud Sleuth , and use Spring Cloud GCP to forward the trace information to Google Cloud Trace . Distributed tracing , also known as distributed request tracing , is a method of monitoring and observing service requests in applications built on a microservices architecture . When we have chained service to service calls, from customer to product , it's important to understand that the calls were successful and also the latency at every step. Spring Cloud Sleuth is used to generate the trace id , span id and add this information to the service calls in the headers and MDC, so that it can be used by tools like Zipkin or Google Cloud trace . By default, it can forward the trace data to Zipkin . Google Cloud Platform has Google Cloud Trace , which is a managed service that allows us to store trace data without having to manage us on Zipkin instance nor storage. In t

Google Cloud SQL for PostgreSQL + Spring Boot + Spring WebFlux + R2DBC - Building Reactive REST CRUD APIs

Image
In this section,  we will learn how to use Spring Boot, Spring WebFlux, and R2DBC to create a reactive web service that interacts with Google Cloud SQL for PostgreSQL. Reactive APIs are non-blocking and tend to be more efficient because they’re not tying up processing while waiting for stuff to happen. Reactive systems adopt asynchronous I/O. Reactive apps allow us to scale better if we are dealing with lots of streaming data.  If we are going to build a reactive app, we need it to be reactive all the way down to your database.  Spring WebFlux uses a library called Reactor for its reactive support. The Reactor is an implementation of the Reactive Streams specification. The Reactor Provides two main types called Flux and Mono. Both of these types implement the Publisher interface provided by Reactive Streams. Flux is used to represent a stream of 0..N elements and Mono is used to represent a stream of 0..1 element. 1.  A little bit of Background Google Cloud SQL for PostgreSQL Cloud SQL