Tous les Projets
BackendDéploiement

Architecture Microservices (Spring Boot)

Microservices de production : Spring Boot, streaming d'événements Apache Kafka, auth OAuth2/Keycloak, appels inter-services gRPC, passerelle API, Docker. Conception orientée événements avec isolation PostgreSQL par service.

Approche

Kafka orienté événements + OAuth2 Keycloak + appels sync gRPC + Spring Cloud Gateway

Stack Technique
JavaSpring BootApache KafkaKeycloakgRPCDockerPostgreSQL
Mots-clés
Spring BootKafkaKeycloakgRPCDockerJavaMicroservices
Analyse Approfondie

Système de microservices production avec architecture orientée événements.

Topologie des Services

Client → Spring Cloud Gateway (passerelle API)
  → Keycloak (auth OAuth2/OIDC)
  → Service A ←→ Kafka ←→ Service B
  → Service C --gRPC--> Service D
  → PostgreSQL (isolation BDD par service)

Décisions Clés

ProblèmeSolutionJustification
Communication asyncApache KafkaDécouplage + durabilité + replay
Appels sync internesgRPCContrats typés + 5–10× plus rapide que REST
AuthentificationKeycloak OAuth2Centralisé, standard industriel
Routage des servicesSpring Cloud GatewayChaînes de filtres + circuit breaking

Événements Kafka OrderCreated, PaymentProcessed, InventoryUpdated — rétention 7 jours permettant aux services de rejouer après défaillances.

gRPC vs REST

  • Interne (service→service) : gRPC (binaire, typé, rapide)
  • Externe (navigateur→passerelle) : REST/JSON (compatibilité, debuggabilité)

Keycloak OAuth2 Tokens JWT avec périmètres au niveau service. Comptes de service pour l'auth machine-à-machine. Introspection des tokens à la passerelle — pas de logique d'auth par service.