Spring Cloud Gateway
Spring Cloud Gateway, EK, REACTIVE, (non-blocking) API, gateway, hai — routes, predicates, aur, filters, ke, saath, CONFIGURE, kiya, jaata hai — HIGH-THROUGHPUT, gateway, TRAFFIC, ke, liye, DESIGN, kiya, gaya, hai.
Gateway, Eureka, ke, saath, INTEGRATE, ho, sakta hai — service, discovery, se, MILA, INFORMATION, USE, karके, AUTOMATICALLY, load-balanced, ROUTES, banaта hai, MANUAL, HARDCODED, URLs, ki, ZAROORAT, ke, bina.
spring:
cloud:
gateway:
routes:
- id: order-service
uri: lb://ORDER-SERVICE
predicates:
- Path=/api/orders/**- Spring Cloud Gateway = reactive API gateway — routes/predicates/filters
- Eureka, ke, saath, integrate, hoke, automatic, load-balanced, routing
- lb://, prefix, se, service, discovery-based, routing, hoti, hai
Global, filters, SAARI, routes, PAR, apply, hote, HAIN (jaise, ek, logging, filter). Route-specific, filters, sirf, ek, SPECIFIC, route, PAR, apply, hote, hain — DONO, ko, COMBINE, kiya, ja, sakta hai.
@Bean
public GlobalFilter customGlobalFilter() {
return (exchange, chain) -> {
log.info("Request: " + exchange.getRequest().getPath());
return chain.filter(exchange);
};
}Spring Cloud Gateway, Spring WebFlux, (reactive) PAR, BUILT, hai — traditional, Spring, MVC, (blocking) starter, ke, saath, gateway, application, mein, CONFLICT, ho, sakta hai — gateway, applications, ko, generally, PURE, WebFlux, rakhna, CHAHIYE.