{"id":69,"date":"2021-10-20T19:28:00","date_gmt":"2021-10-20T19:28:00","guid":{"rendered":"http:\/\/blog.firatyasar.com\/?p=69"},"modified":"2022-03-28T19:31:18","modified_gmt":"2022-03-28T19:31:18","slug":"api-gateway-tasarim-deseni","status":"publish","type":"post","link":"https:\/\/blog.firatyasar.com\/?p=69","title":{"rendered":"API Gateway Tasar\u0131m Deseni"},"content":{"rendered":"\n<p>Bir \u00e7ok farkl\u0131 client tipini i\u00e7eren ve bir \u00e7ok microservice&#8217;ten meydana gelen bir uygulama dizayn edilecekse API gateway&#8217;i mimari i\u00e7erisinde konumland\u0131rmak gerekir. API gateway pattern&#8217;i ile birlikte kompleks bir uygulama i\u00e7in tek bir giri\u015f noktas\u0131 uygulaman\u0131n \u00f6n\u00fcne entegre edilmi\u015f olur.<br>API gateway client taraf\u0131 ile microservice&#8217;lerin aras\u0131nda yer al\u0131r ve bir nevi reverse proxy olarak \u00e7al\u0131\u015f\u0131r. Gelen istekleri arka taraf\u0131nda bulunan microservice&#8217;lere route eder.<br>Ayr\u0131ca \u00fczerinde &#8220;cross-cutting features&#8221; olarak isimlendirilen kimlik do\u011frulama, SSL termination ve cache gibi advanced konfig\u00fcrasyon se\u00e7enekleri de mevcuttur.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"601\" src=\"\/wp-content\/uploads\/2022\/03\/image-1-1024x601.png\" alt=\"\" class=\"wp-image-70\" srcset=\"\/wp-content\/uploads\/2022\/03\/image-1-1024x601.png 1024w, \/wp-content\/uploads\/2022\/03\/image-1-300x176.png 300w, \/wp-content\/uploads\/2022\/03\/image-1-768x450.png 768w, \/wp-content\/uploads\/2022\/03\/image-1-660x387.png 660w, \/wp-content\/uploads\/2022\/03\/image-1.png 1398w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Uygulaman\u0131n b\u00fcy\u00fckl\u00fc\u011f\u00fcne, client tiplerinin \u00e7e\u015fitlili\u011fine g\u00f6re API Gateway&#8217;i bir den \u00e7ok konumland\u0131rmak \u00f6nerilir. Tek bir API Gateway&#8217;i t\u00fcm microservice&#8217;lerin \u00f6n\u00fcnde konumland\u0131rmak coupling problemini do\u011furacakt\u0131r. Microservice&#8217;lerin \u00f6n\u00fcnde tek bir toplay\u0131c\u0131 olmas\u0131 iyi bir fikir de\u011fildir. Bu da microservice mimarisinin do\u011fas\u0131na ayk\u0131r\u0131 bir durumdur.<\/p>\n\n\n\n<p><strong>API gateway&#8217;in \u00f6nemli \u00f6zellikleri:<\/strong><\/p>\n\n\n\n<p><strong>Reverse Proxy:<\/strong><br>API gateway 7. katmanda client&#8217;lardan gelen HTTP isteklerini al\u0131p microservice&#8217;lere y\u00f6nlendirir. Client&#8217;lar tek bir URL \u00fczerinden microservice&#8217;lere eri\u015firler. Bu sayede client side ile microservice&#8217;lerin decouple olmas\u0131 sa\u011flanm\u0131\u015f olunur.<br>Uygulamalar\u0131n modernizasyonu s\u0131ras\u0131nda bir s\u00fcre monolitic API ile entegre olmas\u0131 gereken client taraf\u0131 API gateway \u00fczerinden kolayl\u0131kla legacy Infra ile ileti\u015fim kurabilir. Yeni microservice&#8217;ler ile geli\u015ftirme yap\u0131ld\u0131ktan sonra basit bir trafik y\u00f6nlendirmesi ile monolitic yap\u0131lar modernize edilmi\u015f olur. Bu tarz ge\u00e7i\u015flerde client ile servisler aras\u0131nda API Gateway konumland\u0131r\u0131ld\u0131\u011f\u0131 i\u00e7in bu i\u015flemlerden client taraf\u0131 hi\u00e7 bir \u015fekilde etkilenmez.<\/p>\n\n\n\n<p><strong>Request Aggrigation:<\/strong><\/p>\n\n\n\n<p>Bu \u00f6zellik ile bir \u00e7ok microservice&#8217;i call edecek \u00e7oklu client istekleri tek bir client request&#8217;i i\u00e7erisinde toplan\u0131r. Bu yakla\u015f\u0131m genellikle client taraf\u0131 birden \u00e7ok microservice&#8217;ten veri \u00e7ekece\u011fi zaman kullan\u0131l\u0131r. \u00d6rne\u011fin bu yakla\u015f\u0131m ile birlikte client taraf\u0131ndan gelen tek bir istek birden fazla microservice&#8217;e y\u00f6nlendirilir, gelen cevaplar ise toplan\u0131p client uygulamas\u0131na y\u00f6nlendirilir. Mobile uygulamalarda ve java script kullanan single page web uygulamalar\u0131nda bu \u00f6zelli\u011fin kullan\u0131lmas\u0131 \u00f6nemlidir. geleneksel server side&#8217;da request yapan web uygulamalar\u0131nda bu \u00f6zelli\u011fi kullanmak \u00e7ok da \u00f6nemli de\u011fildir.<\/p>\n\n\n\n<p><strong>Cross-cutting concerns<\/strong><\/p>\n\n\n\n<p>API gateway&#8217;in sundu\u011fu advanced \u00f6zellikler sayesinde offload fonksiyonlar\u0131n\u0131 microservice taraf\u0131ndan API gateway \u00fczerine ta\u015f\u0131yabilirsiniz. B\u00f6ylelikle bu tarz gereksinimler tek noktada handle edilmi\u015f olur. B\u00f6ylelikle bu \u00f6zelliklerin her microservice \u00f6zelinde entegre edilmesi i\u00e7in gerekli olan development eforu ortadan kalm\u0131\u015f olur.<\/p>\n\n\n\n<p>Bu \u00f6zellikler;<\/p>\n\n\n\n<ul><li>Authentication &amp; Authorization<\/li><li>Caching<\/li><li>Rate limiting &amp; throttling<\/li><li>Ip whitelisting<\/li><li>Retry rules<\/li><li>Data transformations<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bir \u00e7ok farkl\u0131 client tipini i\u00e7eren ve bir \u00e7ok microservice&#8217;ten meydana gelen bir uygulama dizayn edilecekse API gateway&#8217;i mimari i\u00e7erisinde konumland\u0131rmak gerekir. API gateway pattern&#8217;i ile birlikte kompleks bir uygulama i\u00e7in tek bir giri\u015f noktas\u0131 uygulaman\u0131n \u00f6n\u00fcne entegre edilmi\u015f olur.API gateway client taraf\u0131 ile microservice&#8217;lerin aras\u0131nda yer al\u0131r ve bir nevi reverse proxy olarak \u00e7al\u0131\u015f\u0131r.\u2026 <span class=\"read-more\"><a href=\"https:\/\/blog.firatyasar.com\/?p=69\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":70,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[24,27,28,29,31],"_links":{"self":[{"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/posts\/69"}],"collection":[{"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69"}],"version-history":[{"count":1,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions\/71"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=\/wp\/v2\/media\/70"}],"wp:attachment":[{"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.firatyasar.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}