﻿
{"id":16322,"date":"2020-07-12T11:57:43","date_gmt":"2020-07-12T11:57:43","guid":{"rendered":"https:\/\/www.gencayyildiz.com\/blog\/?p=16322"},"modified":"2020-07-12T11:57:43","modified_gmt":"2020-07-12T11:57:43","slug":"event-driven-yontemi-ile-microservice-mimarisinde-haberlesme-rabbitmq-cap","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/event-driven-yontemi-ile-microservice-mimarisinde-haberlesme-rabbitmq-cap\/","title":{"rendered":"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme &#8211; RabbitMQ &#8211; CAP"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>Bu i\u00e7eri\u011fimizde <a href=\"https:\/\/www.gencayyildiz.com\/blog\/monolithic-ve-microservice-mimariler-nelerdir\/\" target=\"_blank\" rel=\"noopener noreferrer\">Microservice<\/a> mimarilerde servislerin kendi aralar\u0131nda haberle\u015febilmesi i\u00e7in Event Driven y\u00f6nteminin nas\u0131l \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 ve kullan\u0131ld\u0131\u011f\u0131n\u0131 ele alaca\u011f\u0131z.<\/p>\n<h3 style=\"color:#e83e8c;\">Microservice&#8217;lerde Event Driven Nedir?<\/h3>\n<p>Her bir servisin i\u015flevsel a\u00e7\u0131dan yapaca\u011f\u0131 operasyon neticesinde bir event&#8217;i fire ederek sonucu\/de\u011feri\/neticeyi herhangi bir message queue(RabbitMQ, Kafka vs.) sistemine atarak bu kuyruklar\u0131 dinleyen di\u011fer servisleri uyarmas\u0131d\u0131r.<\/p>\n<h3 style=\"color:#e83e8c;\">Event Driven&#8217;\u0131n Avantajlar\u0131 Nelerdir?<\/h3>\n<ul>\n<li>Gev\u015fek ba\u011fl\u0131(loosely coupled) bir mimari olu\u015fturulmas\u0131na olanak sa\u011flar.<\/li>\n<li>Servisler aras\u0131nda asenkron bir ileti\u015fim sa\u011flanaca\u011f\u0131 i\u00e7in performans\u0131 artt\u0131r\u0131r.<\/li>\n<li>Servisler aras\u0131nda mesajla\u015fma sistemleri kullan\u0131laca\u011f\u0131ndan dolay\u0131, event fire edildi\u011fi taktirde consumer servis&#8217;e bir sebepten dolay\u0131 eri\u015filemezse e\u011fer kuyruk verinin kal\u0131c\u0131l\u0131\u011f\u0131n\u0131 sa\u011flayacak ve tekrar eri\u015filebilir olunca t\u00fcketim devam edecektir. B\u00f6ylece s\u00fcre\u00e7te veri kayb\u0131 ya\u015famaks\u0131z\u0131n sa\u011fl\u0131kl\u0131 i\u015flevsellik s\u00f6z konusu olacakt\u0131r.<\/li>\n<li>\u00d6l\u00e7eklenebilirlik(scalability) sa\u011flar.<\/li>\n<\/ul>\n<h3 style=\"color:#e83e8c;\">RabbitMQ Nedir? Nas\u0131l Kullanaca\u011f\u0131z?<\/h3>\n<p>RabbitMQ&#8217;nun ne oldu\u011fu ve nas\u0131l kullan\u0131ld\u0131\u011f\u0131na dair uzun uzun kaleme ald\u0131\u011f\u0131m\u0131z <a href=\"https:\/\/www.gencayyildiz.com\/blog\/rabbitmq-yazi-dizisi\/\" rel=\"noopener noreferrer\" target=\"_blank\">RabbitMQ yaz\u0131 dizisi<\/a>ni okuyabilirsiniz. Lakin bizler bu i\u00e7eri\u011fimizde RabbitMQ&#8217;yu <a href=\"https:\/\/www.gencayyildiz.com\/blog\/net-core-docker-yazi-dizisi\/\" rel=\"noopener noreferrer\" target=\"_blank\">Docker<\/a> ile kurup o \u015fekilde kullanmay\u0131 tercih edece\u011fiz. Bunun i\u00e7in <a href=\"https:\/\/www.gencayyildiz.com\/blog\/dockerda-rabbitmq-ayaga-kaldirma\/\" rel=\"noopener noreferrer\" target=\"_blank\">Docker\u2019da RabbitMQ Aya\u011fa Kald\u0131rma<\/a> ba\u015fl\u0131kl\u0131 makalemi incelemenizi tavsiye ederim.<\/p>\n<h3 style=\"color:#e83e8c;\">CAP Nedir? Nas\u0131l Kullan\u0131l\u0131r?<\/h3>\n<p><div id=\"attachment_16524\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-16524\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-300x118.png\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"300\" height=\"118\" class=\"size-medium wp-image-16524\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-300x118.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-1024x402.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-768x302.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP.png 1102w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-16524\" class=\"wp-caption-text\">CAP k\u00fct\u00fcphanesinin mimarisi&#8230;<\/p><\/div>CAP, distributed sistemlerdeki producer-consumer yap\u0131s\u0131n\u0131n g\u00fcvenilirli\u011fi tam olarak garanti etmemesi durumuna istinaden, y\u00f6netilebilirlik a\u00e7\u0131s\u0131ndan kolayl\u0131k sa\u011flayan ve Event Bus i\u015flevine sahip olan, hafif, kolay ve verimli bir .NET tabanl\u0131 a\u00e7\u0131k kaynak(open source) k\u00fct\u00fcphanedir.<\/p>\n<p>Microservice yakla\u015f\u0131m\u0131n\u0131 benimseyen sistemlerde yukar\u0131da da bahsedildi\u011fi \u00fczere mesaj kuyruk sisteminin basit\u00e7e kullan\u0131lmas\u0131 g\u00fcvenilirli\u011fi garanti etmeyecektir. \u0130\u015fte bu olas\u0131 duruma istinaden da\u011f\u0131t\u0131lm\u0131\u015f sistemlerin birbirini \u00e7a\u011f\u0131rmas\u0131 s\u00fcrecinde olu\u015fabilecek istisnalar\u0131 \u00e7\u00f6z\u00fcmlemek i\u00e7in CAP&#8217;\u0131 kullanmay\u0131 tercih edece\u011fiz.<\/p>\n<blockquote><p><strong style=\"color:orange;\">CAP, microservice mimarisinde servislerin birbirleriyle ileti\u015fime ge\u00e7mesinde olu\u015facak istisnalar\u0131 \u00e7\u00f6z\u00fcmleyebilmek i\u00e7in mevcut veritaban\u0131 ile entegre \u00e7al\u0131\u015fan <em style=\"color:red;\">Local Message Table<\/em> yakla\u015f\u0131m\u0131n\u0131 benimsemi\u015f bir k\u00fct\u00fcphanedir.<\/strong><\/p><\/blockquote>\n<p><em>Nas\u0131l kullanaca\u011f\u0131z?<\/em> sorusuna gelirsek e\u011fer zaten bu i\u00e7eri\u011fimizde komple ilgili k\u00fct\u00fcphane \u00fczerine kurulu bir anlat\u0131m sergileyece\u011fiz \ud83d\ude42<\/p>\n<h3 style=\"color:#e83e8c;\">\u00d6rnek Senaryo<\/h3>\n<h4 style=\"color:blue;\">Servislerin Olu\u015fturulmas\u0131 ve CAP Entegrasyonu<\/h4>\n<p>\u0130lk olarak aralar\u0131nda ileti\u015fim kuracak olan &#8216;ProducerAPI&#8217; ve &#8216;ConsumerAPI&#8217; isminde iki adet servis olu\u015ftural\u0131m.<br \/>\n<code style=\"color:red;\">dotnet new webapi --name producerAPI<\/code><br \/>\n<code style=\"color:red;\">dotnet new webapi --name consumerAPI<\/code><br \/>\nArd\u0131ndan her iki projeyede <a href=\"https:\/\/www.nuget.org\/packages\/DotNetCore.CAP\/\" rel=\"noopener noreferrer\" target=\"_blank\">DotNetCore.CAP<\/a> k\u00fct\u00fcphanesini<br \/>\n<code style=\"color:red;\">dotnet add package DotNetCore.CAP<\/code><br \/>\nkomutuyla, kullanaca\u011f\u0131m\u0131z RabbitMQ mesaj kuyruk sistemi i\u00e7inse <a href=\"https:\/\/www.nuget.org\/packages\/DotNetCore.CAP.RabbitMQ\/\" rel=\"noopener noreferrer\" target=\"_blank\">DotNetCore.CAP.RabbitMQ<\/a> k\u00fct\u00fcphanesini<br \/>\n<code style=\"color:red;\">dotnet add package DotNetCore.CAP.RabbitMQ<\/code><br \/>\nkomutuyla ve son olarak servisler aras\u0131nda ileti\u015fim i\u00e7in yarat\u0131lan olaylar\u0131 loglayabilmek i\u00e7in <a href=\"https:\/\/www.nuget.org\/packages\/DotNetCore.CAP.SqlServer\/\" rel=\"noopener noreferrer\" target=\"_blank\">DotNetCore.CAP.SqlServer<\/a> k\u00fct\u00fcphanesini<br \/>\n<code style=\"color:red;\">dotnet add package DotNetCore.CAP.SqlServer<\/code><br \/>\nkomutu arac\u0131l\u0131\u011f\u0131yla y\u00fckleyiniz.<\/p>\n<p>\u0130lgili k\u00fct\u00fcphaneleri y\u00fckledikten sonra her iki projeninde &#8216;Startup.cs&#8217; dosyas\u0131nda a\u015fa\u011f\u0131daki konfig\u00fcrasyonlar\u0131n yap\u0131lmas\u0131 gerekmektedir;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n      public void ConfigureServices(IServiceCollection services)\r\n      {\r\n         services.AddDbContext&lt;ExampleContext&gt;(options =&gt; options.UseSqlServer(&quot;Server=.;Database=MicroserviceExampleDB;Trusted_Connection=True;&quot;));\r\n         services.AddCap(options =&gt;\r\n         {\r\n            options.UseEntityFramework&lt;ExampleContext&gt;();\r\n            options.UseSqlServer(&quot;Server=.;Database=MicroserviceExampleDB;Trusted_Connection=True;&quot;);\r\n\r\n            options.UseRabbitMQ(options =&gt;\r\n            {\r\n               options.ConnectionFactoryOptions = options =&gt;\r\n               {\r\n                  options.Ssl.Enabled = false;\r\n                  options.HostName = &quot;localhost&quot;;\r\n                  options.UserName = &quot;guest&quot;;\r\n                  options.Password = &quot;guest&quot;;\r\n                  options.Port = 5672;\r\n               };\r\n            });\r\n         });\r\n         services.AddControllers();\r\n      }\r\n<\/pre>\n<h4 style=\"color:blue;\">Port Ayarlamas\u0131<\/h4>\n<p>\u00d6rneklendirmemizi localde ger\u00e7ekle\u015ftirece\u011fimizden dolay\u0131 her iki uygulaman\u0131nda farkl\u0131 portlarda aya\u011fa kald\u0131r\u0131lmas\u0131 gerekmektedir. Bunun i\u00e7in her iki projenin &#8216;launchSettings.json&#8217; dosyas\u0131nda a\u015fa\u011f\u0131daki gibi port ayarlamas\u0131nda bulunulmas\u0131 gerekmektedir;<\/p>\n<p>ProducerAPI;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    &quot;producerAPI&quot;: {\r\n      &quot;commandName&quot;: &quot;Project&quot;,\r\n      &quot;launchBrowser&quot;: false,\r\n      &quot;applicationUrl&quot;: &quot;https:\/\/localhost:5001;http:\/\/localhost:5000&quot;,\r\n      &quot;environmentVariables&quot;: {\r\n        &quot;ASPNETCORE_ENVIRONMENT&quot;: &quot;Development&quot;\r\n      }\r\n    }\r\n<\/pre>\n<p>ConsumerAPI;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    &quot;consumerAPI&quot;: {\r\n      &quot;commandName&quot;: &quot;Project&quot;,\r\n      &quot;launchBrowser&quot;: false,\r\n      &quot;applicationUrl&quot;: &quot;https:\/\/localhost:5003;http:\/\/localhost:5002&quot;,\r\n      &quot;environmentVariables&quot;: {\r\n        &quot;ASPNETCORE_ENVIRONMENT&quot;: &quot;Development&quot;\r\n      }\r\n    }\r\n<\/pre>\n<h4 style=\"color:blue;\">Mesaj Yay\u0131nlama<\/h4>\n<p>\u015eimdi ProducerAPI servisi \u00fczerinden bir i\u015flem ger\u00e7ekle\u015ftirelim ve neticede ConsumerAPI servisini uyaral\u0131m. Bunun i\u00e7in ProducerAPI uygulamas\u0131nda a\u015fa\u011f\u0131daki gibi bir controller geli\u015ftirelim;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n   &#x5B;ApiController]\r\n   &#x5B;Route(&quot;api\/&#x5B;controller]&quot;)]\r\n   public class ProducerController : ControllerBase\r\n   {\r\n      private readonly ICapPublisher _capPublisher;\r\n      public ProducerController(ICapPublisher capPublisher)\r\n      {\r\n         _capPublisher = capPublisher;\r\n      }\r\n      public async Task&lt;IActionResult&gt; ProducerTransaction()\r\n      {\r\n         using ExampleContext context = new ExampleContext();\r\n         using var transaction = context.Database.BeginTransaction(_capPublisher, autoCommit: true);\r\n         var date = DateTime.Now;\r\n         await _capPublisher.PublishAsync&lt;DateTime&gt;(&quot;producer.transaction&quot;, date);\r\n         return Ok(date);\r\n      }\r\n   }\r\n<\/pre>\n<p>Dikkat ederseniz burada &#8216;ICapPublisher&#8217; interface&#8217;i ile CAP k\u00fct\u00fcphanesi inject edilmekte ve context nesnesi \u00fczerinden ba\u015flat\u0131lan transactionda kullan\u0131lmaktad\u0131r. Ayr\u0131ca ilgili aray\u00fcz arac\u0131l\u0131\u011f\u0131yla &#8216;producer.transaction&#8217; de\u011feri alt\u0131nda veri olarak o an\u0131n tarih bilgisini yay\u0131nlamaktad\u0131r.<\/p>\n<h4 style=\"color:blue;\">Mesaj Yakalama<\/h4>\n<p>ProducerAPI taraf\u0131ndan yay\u0131nlanan mesaj\u0131 ConsumerAPI&#8217;da elde edebilmek i\u00e7in ilgili projede a\u015fa\u011f\u0131daki gibi bir controller geli\u015ftirilmelidir;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n   &#x5B;ApiController]\r\n   &#x5B;Route(&quot;&#x5B;controller]&quot;)]\r\n   public class ConsumerController : ControllerBase\r\n   {\r\n      &#x5B;CapSubscribe(&quot;producer.transaction&quot;)]\r\n      public void Consumer(DateTime date)\r\n      {\r\n         Console.WriteLine(date);\r\n      }\r\n   }\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer consumer&#8217;\u0131n dinleyici fonksiyonunu &#8216;CapSubscribe&#8217; attribute&#8217;u ile i\u015faretleyerek producer&#8217;de ki publish de\u011feri olan &#8216;producer.transaction&#8217; ile ili\u015fkilendiriyor ve ilgili yay\u0131na abone yap\u0131yoruz. B\u00f6ylece producer bir mesaj yay\u0131nlad\u0131\u011f\u0131 an direkt olarak consumer haberdar ediliyor.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP.gif\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"800\" height=\"469\" class=\"aligncenter size-full wp-image-16572\" \/><\/a><\/p>\n<h4 style=\"color:blue;\">Business Logic Service&#8217;lerde Mesaja Yakalama<\/h4>\n<p>E\u011fer ki yay\u0131nlanan mesaj\u0131 controllerda de\u011fil business logic&#8217;de yakalamak istiyorsan\u0131z ilgili s\u0131n\u0131f\u0131n a\u015fa\u011f\u0131daki gibi geli\u015ftirilmesi gerekmektedir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n   public class ConsumerService : ICapSubscribe\r\n   {\r\n      &#x5B;CapSubscribe(&quot;producer.transaction&quot;)]\r\n      public void Consumer(DateTime date)\r\n      {\r\n         Console.WriteLine(&quot;Servis : &quot; + date);\r\n      }\r\n   }\r\n<\/pre>\n<p>Burada s\u0131n\u0131f\u0131 incelerseniz e\u011fer &#8216;ICapSubscribe&#8217; interface&#8217;inden t\u00fcremesi gerekmekte ve &#8216;CapSubscribe&#8217; attribute&#8217;u ile tekrardan ilgili producer de\u011ferini ta\u015f\u0131yacak \u015fekilde i\u015faretlenmesi gerekmektedir. Bu i\u015flemin ard\u0131ndan in\u015fa edilen ilgili s\u0131n\u0131f\u0131n uygulamaya a\u015fa\u011f\u0131daki gibi servis olarak eklenmesi gerekmektedir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n      public void ConfigureServices(IServiceCollection services)\r\n      {\r\n         .\r\n         .\r\n         .\r\n         services.AddTransient&lt;ConsumerService&gt;();\r\n         services.AddCap(options =&gt;\r\n         {\r\n            .\r\n            .\r\n            .\r\n         });\r\n         .\r\n         .\r\n         .\r\n      }\r\n<\/pre>\n<p><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-1.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-1.gif\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"800\" height=\"469\" class=\"aligncenter size-full wp-image-16574\" \/><\/a><\/p>\n<h4 style=\"color:blue;\">Abone Gruplar\u0131 Olu\u015fturma<\/h4>\n<p>CAP, gelen bir mesaj\u0131 birden fazla gruba da\u011f\u0131tarak daha fazla servis yahut controller taraf\u0131ndan dinlenilmesini sa\u011flayabilmektedir. \u015e\u00f6yle ki;<br \/>\nService;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n      &#x5B;CapSubscribe(&quot;producer.transaction&quot;, Group = &quot;group2&quot;)]\r\n      public void Consumer(DateTime date)\r\n      {\r\n         Console.WriteLine(&quot;Servis : &quot; + date);\r\n      }\r\n<\/pre>\n<p>Controller;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n   &#x5B;ApiController]\r\n   &#x5B;Route(&quot;&#x5B;controller]&quot;)]\r\n   public class ConsumerController : ControllerBase\r\n   {\r\n      &#x5B;CapSubscribe(&quot;producer.transaction&quot;, Group = &quot;group1&quot;)]\r\n      public void Consumer(DateTime date)\r\n      {\r\n         Console.WriteLine(date);\r\n      }\r\n   }\r\n<\/pre>\n<p>Ayn\u0131 gruba abone olan yap\u0131lardan sadece bir tanesi tetiklenmekte, bilakis farkl\u0131 gruplarda ise her biri ayr\u0131 ayr\u0131 tetiklenmektedir.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-2.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-2.gif\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"800\" height=\"469\" class=\"aligncenter size-full wp-image-16576\" \/><\/a><\/p>\n<h4 style=\"color:blue;\">G\u00f6sterge Paneli Olu\u015fturma(Dashboard)<\/h4>\n<p>CAP, g\u00f6nderilen ve al\u0131nan mesajlar\u0131 kolayca ger\u00e7ek zamanl\u0131 g\u00f6rebilmemiz i\u00e7in Dashboard \u00f6zelli\u011fi ta\u015f\u0131maktad\u0131r. Dashboard entegrasyonu i\u00e7in uygulamaya <a href=\"https:\/\/www.nuget.org\/packages\/DotNetCore.CAP.Dashboard\/\" rel=\"noopener noreferrer\" target=\"_blank\">DotNetCore.CAP.Dashboard<\/a> k\u00fct\u00fcphanesini a\u015fa\u011f\u0131daki komutla y\u00fckleyiniz.<br \/>\n<code style=\"color:red;\">dotnet add package DotNetCore.CAP.Dashboard<\/code><br \/>\nArd\u0131ndan &#8216;Startup.cs&#8217; dosyas\u0131nda a\u015fa\u011f\u0131daki konfig\u00fcrasyonu ger\u00e7ekle\u015ftiriniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n      public void ConfigureServices(IServiceCollection services)\r\n      {\r\n         .\r\n         .\r\n         .\r\n         services.AddCap(options =&gt;\r\n         {\r\n            .\r\n            .\r\n            .\r\n            options.UseDashboard(o =&gt; o.PathMatch = &quot;\/cap-dashboard&quot;);\r\n            .\r\n            .\r\n            .\r\n         });\r\n         .\r\n         .\r\n         .\r\n      }\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer &#8216;AddCap&#8217; servisi alt\u0131nda &#8216;UseDashboard&#8217; servisini uygulamaya dahil etmekte ve &#8216;\/cap-dashboard&#8217; adresi alt\u0131nda eri\u015fim sa\u011flanabilece\u011fi bildirilmektedir.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-3.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-3.gif\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"800\" height=\"602\" class=\"aligncenter size-full wp-image-16582\" \/><\/a><\/p>\n<h4 style=\"color:blue;\">CAP Faydas\u0131n\u0131 G\u00f6relim<\/h4>\n<p>Her event veritaban\u0131 seviyesinde tutularak olas\u0131 hata yahut kesinti durumlar\u0131nda veri kayb\u0131n\u0131 \u00f6nlemekte ve ileti\u015fimin tekrar sa\u011fland\u0131\u011f\u0131 durumlarda mesaj kuyruk sistemine g\u00f6nderilmemi\u015f ve expire s\u00fcresi dolmayan mesajlar\u0131 tekrardan g\u00f6ndermekte ve b\u00f6ylece kullan\u0131lan mesaj kuyruk sistemi ve hatta hatalar yahut kesintilerden izole bir \u015fekilde geli\u015ftirme yap\u0131lmas\u0131na olanak sa\u011flamaktad\u0131r.<\/p>\n<p>\u00d6rnek veritaban\u0131 g\u00f6r\u00fcnt\u00fcs\u00fc i\u00e7in a\u015fa\u011f\u0131daki ekran al\u0131nt\u0131s\u0131n\u0131 inceleyiniz;<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-4.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/Event-Driven-Y\u00f6ntemi-\u0130le-Microservice-Mimarisinde-Haberle\u015fme-RabbitMQ-CAP-4.gif\" alt=\"Event Driven Y\u00f6ntemi \u0130le Microservice Mimarisinde Haberle\u015fme - RabbitMQ - CAP\" width=\"1022\" height=\"382\" class=\"aligncenter size-full wp-image-16585\" \/><\/a><\/p>\n<p>\u0130lgilenenlerin faydalanmas\u0131 dile\u011fiyle&#8230;<br \/>\nSonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<p>Not : \u00d6rnek \u00e7al\u0131\u015fmay\u0131 indirmek i\u00e7in <a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/07\/CAPExample.zip\">buraya<\/a> t\u0131klay\u0131n\u0131z.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, Bu i\u00e7eri\u011fimizde Microservice mimarilerde servislerin kendi aralar\u0131nda haberle\u015febilmesi i\u00e7in Event Driven y\u00f6nteminin nas\u0131l \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 ve kullan\u0131ld\u0131\u011f\u0131n\u0131 ele alaca\u011f\u0131z. Microservice&#8217;lerde Event Driven Nedir? Her bir servisin i\u015flevsel a\u00e7\u0131dan yapaca\u011f\u0131 operasyon neticesinde bir event&#8217;i fire&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":16524,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3573],"tags":[3592,3593,3594,2433,3591,3590,3589],"class_list":["post-16322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microservices","tag-dotnetcore-cap","tag-dotnetcore-cap-rabbitmq","tag-dotnetcore-cap-sqlserver","tag-event-driven","tag-event-driven-cap","tag-event-driven-haberlesme","tag-microservice-event-driven"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/16322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=16322"}],"version-history":[{"count":85,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/16322\/revisions"}],"predecessor-version":[{"id":16616,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/16322\/revisions\/16616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/16524"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=16322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=16322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=16322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}