User Tools

Site Tools


programming:spring

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:spring [2024/07/07 16:53] – [Rest Controller] skipidarprogramming:spring [2024/07/14 19:36] (current) – [Docker] skipidar
Line 247: Line 247:
   * SAME-URL produces=application/vnd.company.app-vl+json   * SAME-URL produces=application/vnd.company.app-vl+json
   * SAME-URL produces=application/vnd.company.app-v2+json   * SAME-URL produces=application/vnd.company.app-v2+json
 +
 +
 +===== Libs =====
 +
 +==== Hystrix - Circuit Breaker ====
 +https://www.baeldung.com/spring-cloud-netflix-hystrix
 +
 +==== Feign - declarative REST client ====
 +
 +Reduces the glue-code to the minimum.
 +Need only to express - what to call and receive the response DTO
 +
 +https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html
 +
 +
 +
 +
 +<sxh java>
 +package com.in28minutes.microservices.currencyconversionservice;
 +
 +import org.springframework.cloud.netflix.feign.FeignClient;
 +import org.springframework.web.bind.annotation.GetMapping;
 +import org.springframework.web.bind.annotation.PathVariable;
 +
 +@FeignClient(name = "currency-exchange-service", url = "localhost:8000")
 +public interface CurrencyExchangeServiceProxy {
 +
 +    @GetMapping("/currency-exchange/from/{from}/to/{to}")
 +    public CurrencyConversionBean retrieveExchangeValue
 +            (@PathVariable("from") String from, @PathVariable("to") String to);
 +}
 +
 +</sxh>
 +==== Ribbon - Client based load balancer ====
 +
 +Exposes multiple deployments under one URL
 +
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/K9ELIqz2Uf.png}}
 +
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/Od4LgsV7Ij.png}}
 +
 +
 +==== Zuul API Gateway ====
 +
 +API Gateway in SPring
 +
 +
 +
 +
 +==== EUreka Namingserver ====
 +
 +Allows to register / discover services on a naming server.
 +
 +Has a GUI to list available services.
 +
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/qVkyO04yvD.png}}
 +
 +
 +
 +==== Cloud Sleuth - unique tracing id to requests ====
 +
 +adds a unique tracing id to requests
 +
 +
 +
 +==== Zipkin - Distributed Tracing Server ====
 +
 +
 +Central tracing server. 
 +
 +  * Like ELK.
 +  * and CloudWatch
 +
 +
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/ce868zFAte.png}}
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/EG0bVz0lrr.png}}
 +==== Spring Cloud Bus  ====
 +
 +Can use it to refresh the configs of all services,
 +by sending a message via the bus.
 +
 +
 +
 +
 +=====  Docker ===== 
 +
 +== Build manually without gradle ==
 +
 +<sxh java>
 +docker build --build-arg JAR_FILE=build/libs/\*.jar -t springio/demo-consume-api -f src/main/docker/Dockerfile  .
 +</sxh>
 +
 +== Build with Gradle ==
 +
 +You can build a tagged docker image with Gradle in one command:
 +
 +<sxh java>
 +sudo su
 +./gradlew bootBuildImage --imageName=springio/demo-consume-api
 +
 +
 +sudo docker images
 +
 +</sxh>
 +
 +== And run ==
 +
 +<sxh java>
 +sudo docker run -p 8080:8080 springio/demo-consume-api
 +</sxh>
programming/spring.1720371215.txt.gz · Last modified: by skipidar