0Pricing
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) · Ders

Tepkisel Temeli Anlamak

Spring Cloud Gateway’in engellemeyen tepkisel bir yığın üzerine neden kurulduğunu ve bunun isteklerin ağ geçidinden geçiş biçimi açısından ne anlama geldiğini keşfedin.

Tepkisel Temeli Anlamak, CoddyKit'te ücretsiz bir API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

A Different Kind of Server

Unlike a traditional Spring MVC app, Spring Cloud Gateway runs on Spring WebFlux and Project Reactor. It uses a non-blocking, event-loop server (Netty) instead of one thread per request.

This design lets the gateway handle thousands of concurrent connections with very few threads.

Blocking vs Non-Blocking

In a blocking model, a thread waits idle while a backend responds. In a non-blocking model, the thread is freed and notified later when data is ready.

  • Blocking: 1 thread tied up per in-flight request
  • Non-blocking: a handful of threads serve many requests

Mono and Flux

Reactor's core types describe asynchronous results:

  • Mono<T> emits 0 or 1 value
  • Flux<T> emits 0 to many values

The gateway returns a Mono<Void> when a request finishes processing.

Mono<String> name = Mono.just("gateway");
Flux<Integer> nums = Flux.just(1, 2, 3);

Nothing Happens Until Subscribe

Reactive streams are lazy. A Mono or Flux does nothing until something subscribes. In the gateway, the framework subscribes for you when a request arrives.

Mono<String> greeting = Mono.fromSupplier(() -> "hello");
// runs only when subscribed:
greeting.subscribe(System.out::println);

The Reactive Web Stack

The starter spring-cloud-starter-gateway pulls in WebFlux automatically. You must not add spring-boot-starter-web (the servlet/MVC stack) or startup will fail with a conflict.

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>

The ServerWebExchange

Every request is wrapped in a ServerWebExchange, which holds the request and response. Filters read and mutate this exchange as the request flows through.

// inside a filter
ServerHttpRequest request = exchange.getRequest();
String path = request.getURI().getPath();

The Filter Chain

A request passes through an ordered chain. Each filter can act, then call chain.filter(exchange) to continue, and run more logic after the downstream response returns.

return chain.filter(exchange)
    .then(Mono.fromRunnable(() ->
        System.out.println("response sent")));

Why Reactive Fits a Gateway

A gateway spends most of its time waiting on the network for upstream services. Non-blocking I/O is ideal here: threads are not wasted waiting, so the gateway stays responsive under heavy load.

Avoid Blocking Calls

Calling a blocking JDBC driver or Thread.sleep inside a filter stalls the event loop and hurts every request. If you must block, offload to a bounded scheduler.

Mono.fromCallable(() -> blockingLookup())
    .subscribeOn(Schedulers.boundedElastic());

Operators Transform Streams

Operators like map, flatMap, and filter reshape the data flowing through a stream without blocking.

Flux.just(1, 2, 3, 4)
    .filter(n -> n % 2 == 0)
    .map(n -> n * 10)
    .subscribe(System.out::println); // 20, 40

Mental Model

Think of the gateway as a pipeline of asynchronous steps. A request enters, flows through predicates and filters, is forwarded reactively, and the response streams back through the same chain in reverse.

Quick Check

What underlying web stack does Spring Cloud Gateway run on?

Recap

You now understand the reactive foundation of the gateway:

  • Non-blocking I/O on Netty handles high concurrency
  • Mono and Flux model async results and are lazy
  • Each request is a ServerWebExchange flowing through a filter chain
  • Never block the event loop

This mindset underpins routes, predicates, and filters you build next.

Sıkça Sorulan Sorular

“Tepkisel Temeli Anlamak” dersi ücretsiz mi?

Evet — “Tepkisel Temeli Anlamak” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

“Tepkisel Temeli Anlamak” dersinde ne öğreneceğim?

Spring Cloud Gateway’in engellemeyen tepkisel bir yığın üzerine neden kurulduğunu ve bunun isteklerin ağ geçidinden geçiş biçimi açısından ne anlama geldiğini keşfedin. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Tepkisel Temeli Anlamak” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersinde kod yazıp çalıştırabilir miyim?

Evet. Her API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Gateway ve Geleneksel Mikro Hizmetler
  2. Temel Gateway Projesi Kurma
  3. Rotaları ve Koşulları Tanımlama
  4. Tepkisel Temeli Anlamak
← API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) Sayfasına Dön