<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Merve Topal on Medium]]></title>
        <description><![CDATA[Stories by Merve Topal on Medium]]></description>
        <link>https://medium.com/@merve.tpl?source=rss-c05c40f043b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XSjkUewVm01fBc6Jy-yluA.jpeg</url>
            <title>Stories by Merve Topal on Medium</title>
            <link>https://medium.com/@merve.tpl?source=rss-c05c40f043b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:36:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@merve.tpl/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Azure Functions]]></title>
            <link>https://medium.com/adessoturkey/azure-functions-2ca2635f1eec?source=rss-c05c40f043b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ca2635f1eec</guid>
            <category><![CDATA[azure-storage]]></category>
            <category><![CDATA[azure-storage-account]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[azure-storage-explorer]]></category>
            <category><![CDATA[azure-storage-blob]]></category>
            <dc:creator><![CDATA[Merve Topal]]></dc:creator>
            <pubDate>Fri, 21 Jul 2023 07:51:55 GMT</pubDate>
            <atom:updated>2023-07-24T18:14:03.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*iRfRwsdpuMWva_AwrJ70vA.jpeg" /></figure><p>Hello,</p><p>I hope you are well! In this article, I will tell you about Azure Functions. My advice to you is to read my previous article, where I discussed Azure Storage, before this article. Because both are on very related topics. At the end of the article, I will be sharing a link to a project where I use Azure Storage and Azure Functions together. I separated the topics because both are quite comprehensive, and combining them would result in a much longer article. After this short explanation, I want to start right away.</p><p>Have a pleasant and useful adventure, again! 😊</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*cFLkQ04YM_SX6mZ5jJnBfg.png" /></figure><p>Azure Functions is a serverless (FaaS — Function as a Service) cloud service from Microsoft that allows you to run small pieces of code without worrying about the application infrastructure.</p><p>Serverless architecture is a structure that is growing in popularity. Servers are also used in serverless architectures, but only service providers perform this management. Now, onto Azure Functions… If the term “function” is included in the name, it means that there is a method involved. If there is a method, there is something to work with. Where will this code run? Normally, for this, you would need to get a server, web hosting, an app service, etc. on Azure. This is where Azure Functions come into play. In fact, they tell us, “Don’t worry about the infrastructure; don’t worry about where your code will run; that’s our job.” Whether it’s IIS, Kestrel, Apache, etc., we can see the running version of our code by taking it directly to production without any hassle. This is the service that Azure Functions offer us, which is also called “serverless”. In other words, the process of running a function without installing any server infrastructure. It has become more popular, especially with microservices. Functions are available not only on Azure but also on all cloud systems, such as AWS, Google Cloud, Alibaba Cloud, IBM Cloud. It is very simple to use and code. We can get our code into production in a short time without dealing with infrastructure.</p><p>Well, with so much convenience, there comes a cost. But don’t worry; it’s cost-effective. 😉</p><p>When we publish the code that we wrote with Azure Functions in Azure, we only pay for what works. The more RAM our function used while running and the longer it worked, the more payment is offered. If the function we received for the production is not working, no payment will be needed. Of course, there are future payments. Because it is necessary to use a few mandatory services with Azure Functions. Azure enforces this. One is Azure Storage. These are not huge fees, which I will talk about later.</p><p><strong>In summary, it is serverless and pay-as-you-work.</strong></p><p>We said that we can easily take our method, which we call a “function”, and into production. Another feature is that it can scale automatically. You are doing some coding, but you don’t want to do it inside your current application. For example, you want to process an image. You can use the Azure function without doing this within the app. Azure Functions will be able to scale automatically. In other words, the more your function is triggered, the more it will be able to respond to these triggers. 10 requests per second, 10,000,000 requests per second… All of these are Azure’s problem. It will be done independently from you. 😊 Normally, we would get an annual host plan to run our code, or we would set up an app service on Azure. We were paying a monthly fee, whether we used it or not. But here, it’s a pay-as-you-go system.</p><p><strong>Azure Function Hosting Plan Types</strong></p><p>When a function is created in Azure, you need to choose a hosting plan to determine how it scales and behaves. Application hosting plans are designs that also allow you to take advantage of special infrastructures and provide resources available for all types of function instances.</p><p>Hosting plans are three in number:</p><ul><li>Consumption plan,</li><li>Premium plan,</li><li>Dedicated (App Service) plan.</li></ul><p><strong>Consumption plan:</strong></p><p>It is a code based on the structures we call “functions”. Therefore, in order to run this code, we first need a function host. We call each function host an instance. When a function is defined, whether there is an instance with that function is important for us in performance evaluation. There is no default instance running unless there is a trigger in the Consumption plan, that is, the function is not run. Whenever a trigger occurs, then the instance will be raised. In this case, it will provide an extra delay for the first request. Of course, this delay will not be because the first created instance will be used in subsequent requests.</p><p>The Consumption plan scales automatically and is charged only when the relevant function is triggered. As a matter of fact, it depends on the pay-as-you-go principle. Billing is based on factors such as the number of requests, function time, the amount of memory used, etc.</p><p>The hosts where the functions are run are called Function Host, and each function host is called an Instance. The functions created with the Consumption plan are the functions that are expected to finish within 10 minutes. If a function will run for more than 10 minutes (even 10 minutes is too much time for a function to run), the Premium plan should be preferred. The default plan in Azure Functions is the Consumption plan.</p><p><strong>Premium plan:</strong></p><p>According to the Consumption plan, one default instance always stands. Thus, the incoming request is either first or n. Regardless, there will be no extra cost to set up an instance. This default instance number can be multiplied as much as desired, and the maximum function time to run in an instance can be determined manually.</p><p>The premium plan gives unlimited functional time, with up to 60 minutes of warranty per function. It is multifunctional and more suitable for heavy operations. It makes pricing more predictable according to the weight of the function to be performed. Billing function time is calculated by the number of default instances, the number of cores used, and the amount of memory used. As a result, it is inevitable that there will be a minimum monthly cost in the premium account due to the default instances. It is obvious that it is subject to an extra fee. It has adopted the pay-as-you-go principle.</p><p>The Premium plan will keep the function running continuously without any requests, thanks to the default instance. There are more CPU and memory options than the Consumption plan, and it should be preferred for operational functions lasting longer than 10 minutes compared to the Consumption plan.</p><p>You can define multiple Azure Functions in an Azure Storage. Multiple definitions do not have any negative impact on Azure or even affect scalability and reliability in the slightest.</p><p><strong>Dedicated (App Service) plan:</strong></p><p>A plan that charges for the consumption of resources in a domain taken in Azure. It is not automatically scaled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISD_n9d70Ekkm_zX15Ib4w.png" /></figure><p><strong>Let’s look at a few useful features!</strong></p><ul><li>It has more than one SDK, while coding C#, Java, Node JS, Python… So, there is a wide range of language support. Of course, we will proceed based on C# in this article.</li><li>You can use npm packages on the client side and NuGet packages on the server side. Custom or NuGet package makes no difference. I should also point out that using too many packages will increase the uptime of Azure Function. Because these are light services.</li><li>Being able to work in full integration with other services of Azure. Because it’s in Azure. So, what does this mean? For example, you are using blob storage in Azure, you can say that your function should be triggered when an image is saved to the blob.</li><li>It can be integrated into services by using bindings without writing any connection code with related services such as table storage, blob storage, etc.</li><li>Azure Function runtime is open source.</li></ul><p><strong>Services that Azure Functions is connected to:</strong></p><p>Azure Functions actively use Azure storage. The information of an Azure function that we have created in the Function App (which we will talk about in the future) is saved in Azure storage. This means that an Azure storage is required for each Function App we create. So, can I create an Azure storage account and connect it to more than one function? Yes, I can connect. Best practice is to create a storage for each function app. So, I’m going to create a storage for each function? No. A Function App can have multiple Azure functions.</p><p>Azure storage is a must for an Azure function. When you create an Azure function, it will definitely ask you for a storage account.</p><p>Another is Application Insights… This is a monitoring process of the number of function requests, response times, error states, etc. It is an environment that we can observe. It would be appropriate to connect Azure Functions to an application insight service. It is enabled by default, but we can disable it if we want. When we use it, we can see the status of the application instantly. It shortens the fault detection time. It is intended to understand the behavior of the application.</p><p>Here, the payments for these two services that Azure Functions is connected to are separate. Application Insights is initially free to a certain extent. Even if our Azure function code doesn’t work, you pay for these two friends. However, these payments are not very large payments. Payments will remain low, as no transaction will be opened to them when Azure Function is not running. When the Azure function runs, it starts using these services. Application Insights is one of those rare applications that deserves its money.</p><p><strong>Azure Functions creation methods:</strong></p><p>➜ Visual Studio vs. Visual Studio Code</p><p>Ide-based</p><p>➜ Azure Portal</p><p>We can create an Azure function through the website.</p><p>➜ Azure Function Core Tool</p><p>The command line actually uses a template when creating functions in Visual Studio (VS) and Visual Studio Code (VS Code). This command line is also used in the background. Azure Functions’ operation and local standing depend on this command line. It must be installed on our machine. Moreover, when we install the SDK, we also get the Core tool. Although it is not the preferred method, we can create a function via this command line if we want.</p><p>I’m going through VS here.</p><p><strong>Creating Functions with Visual Studio (VS):</strong></p><p>With VS, we can create functions very easily by choosing ready-made templates for Azure functions and test them locally. We need a tool to perform this operation. This tool is the Azure development tool. We will install this tool on our IDE and start working with functions. This tool is not just specific to functions. On Azure, it allows us to code and publish many services without ever going to the Azure portal. The second is Microsoft Azure Storage Explorer. Guys, this is an emulator. I gave detailed information about what happened in my “Azure Storage” article; you can check it out. In short, this emulator creates an Azure environment locally without going to the Azure portal.</p><p>Visual Studio ➜ Tools ➜ Get Tools and Features ➜ Visual Studio Installer ➜ Azure Development</p><p>After installing the Azure development tool we can choose</p><p>New Project ➜ Azure Function</p><p>The ready template will be available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*3gv_RR7JEq_j-XjIm6DHkg.png" /></figure><p>Now, Azure functions must be triggered to run. We will choose a trigger type when creating the function. Here, you will encounter many triggers. We will go through Http Trigger, which we will use frequently and are likely to use. It is also easy and understandable to test and explain. But I used the queue trigger in the project whose link I left.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*6vruaag70Y_UzP1MM_A5Hw.png" /></figure><p>As seen in the photo, it asks you for storage account information. Now here is what we need to know: The http trigger gives us an endpoint. When we send a request to this endpoint, our function is triggered.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3e0747769eaf035cec1ba5892b7840c/href">https://medium.com/media/c3e0747769eaf035cec1ba5892b7840c/href</a></iframe><p>Let’s explain step by step through the photo.</p><p>Here, I have a method named “run”. As you can see, it is marked with async, which means we can use the async method in it. Notice that it is a static method, but it may not be static either. Especially when the DI state is entered, our methods and classes will not be static. By defining a static class and a static method, the default comes like this. The name of our static method is “Run”. You can change this name if you wish. Here, a FunctionName attribute is specified to indicate that this friend is a function. Thanks to this attribute, our method here becomes a function. Then it is getting an attribute called Http Trigger; the reason it got it is because this method will be triggered with an http request. So, what is this request, which endpoint will I work with? When we run the application, it will give us an endpoint. Our function will be triggered when we make get and post requests to that endpoint, as specified in the code sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pjT-J8yqtZe30GnFEFwuyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*atNOuQX-LC5Cszp7-CK9Uw.png" /></figure><p>Of course, if we want to put, delete, etc., we can also create functions with requests; it will be enough to specify. An authorization level is also specified here; I will explain it later. In the Route section, we will be able to direct our method from here. As you can see, it has received a parameter of type HtttpRequest. Thanks to this parameter, you can do whatever comes to mind about a normal request. You can think of it like an action in an API project. There, too, an action was returning the IActionResult type. Depending on the trigger type you choose, the return type may change, or nothing may return. Also, the logging object has been injected into the method, so we can log as we want. OkObjectResult is specified as the return value. This indicates that an object will be sent with 200 status codes. If you want, you can send the status code just by saying OK.</p><p><strong>Azure Function Trigger Types:</strong></p><p>There are many trigger types. You will see them when you create VS functions. There are other triggers other than http and timer triggers that use Azure services. However, http trigger and timer trigger do not use these services. In other words, it does not need to be triggered, we can trigger these two friends with the commands we give from outside. Queue Trigger and Blob Trigger work in integration with the Queue and Blob services in Azure storage.</p><p>You can use the Queue Trigger if you have a process that will be triggered when a message arrives in our queue. For example, for a queue trigger, you can code your queuing process with .NET, you can code your function with Java because your function will run when a message arrives in the queue independent of the application.</p><p>Likewise, you can use the blob trigger if you have something to do when a file is saved to blobs. If you do not want to tire your main server for this process, it would be ideal to use a function.</p><p>Since the function will scale automatically, your process will proceed successfully.</p><p>Cosmos DB Trigger is an upgrade of Cosmos DB Azure table storage (comes in Azure storage). Both are a kind of noSQL DB that Azure offers us. I will not talk about the other trigger types you will see while creating a function, because the others are subjects that have their own atmosphere.</p><p><strong>Azure Function File Structure</strong></p><p>Whatever trigger type you choose, the same file structure applies. If we want, we can create more than one Azure Function Project in a solution, which already has a general structure, or you can create different functions within the function project you created. You can even create more than one method into the function class that is created after you create your function. Of course, provided that the functionName attributes are different. What I mean is that you can create a separate function class for each of your functions, or you can create multiple trigger methods within a single function class.</p><p>When we create a function project, two files come as host.json and local.settings.json. Here, information about runtime is kept in host.json and when you publish, this information goes to the portal, such as the information about logging. When we look at local.settings.json, the information here remains local and does not go to the portal.</p><p>As you can see inside this file there is a runtime environment (dotnet). There is also a key field specified as AzureWebJobsStorage. We said that while the function is running, it needs to use storage. Since we are currently working locally, it is specified as “UseDevelopmentStorage=true”. This information also reflects this situation. When we go to the cloud environment, the connection string of the storage account we are connected to is added to the AzureWebJobsStorage field in the configuration section.</p><p>What we need to know is that when we take our code to the production environment, this file does not go to production. On the other hand, the constant data we will use in the function, we can define them here. You can think of it like the appsettings file in a normal core project. The following question may come to your mind, if it does not go to the cloud, how will we obtain this information there? We will be able to enter this information in the interface that comes up while publishing to the cloud.</p><p>In the Dependencies section of your project, as I mentioned before, we can use npm packages on the client-side and NuGet packages on the .NET server side.</p><p><strong>Function Authorization Level:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*9p45LarCXXeucLZl1VMJLA.png" /></figure><p>If you can tell from the photo, we specify the authorization level when creating the function. Let’s examine them now.</p><p><strong>Function </strong>— It is a level where you access your method at the function level, that is, with a code called the function key (you can think of it as a token) that you will get from Azure.</p><p><strong>Anonymous </strong>— It is the level you would prefer if you wanted to access it without any external authorization.</p><p><strong>Admin</strong> — When you want to access your method at the admin level, you can access it with a code called the master key, which you will get from Azure.</p><p>So, what’s the difference? On Azure, a default key is given for functions that are in the same function app. With the default key, you can access functions with authorization level i function, but not admin ones.</p><p>I should also mention that these levels don’t matter when working locally.</p><p><strong>Dependency Injection:</strong></p><p>How can we use the DI template? How can we pass our class or interfaces in the constructor of any class? Let’s talk about these.</p><p>Earlier versions of Azure Function did not support DI, but it is now available with the latest updates. In this way, we can reduce our dependencies.</p><p>Consider the startup class in any API core project. There, we would write a class and interfaces in our built-in DI container and then pass the constructor whenever we wanted to get an object of any class.</p><p>We will do the same here. For this, we need to use a NuGet package.</p><p><strong>Microsoft.Azure.Functions.Extentions</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a67a4a866b1a710f455ea31145801462/href">https://medium.com/media/a67a4a866b1a710f455ea31145801462/href</a></iframe><p>First of all, we created a class called “Startup”, the name is not important. This class has inherited from FunctionsStartup. As you can see, we override the Configure method.</p><p>As you know, we will specify our dependencies in this configure method. Also, an assembly attribute has been added on the namespace. We also give the desired FunctionsStartup type to the class we created. As you can see, we can simply prepare our DI container. The point we will pay attention to is static by default; our function class is removing it. Because we will use DI.</p><p>Now we can pass in our constructor and use our object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1bd48cdaf22d783a3ae040f7a45baed3/href">https://medium.com/media/1bd48cdaf22d783a3ae040f7a45baed3/href</a></iframe><p><strong>Publish to Azure Portal</strong></p><p>Let’s talk about sending our functions to Azure in general terms, because explaining each step would make the article too long. :) Now, there are a few situations that we need to set when sending to the cloud. Since the first of these works with functions storage, which storage account will we work with in the cloud, and secondly, we need to set our environment variables. In other words, how the values we have specified in local.settings.json will be expressed in Azure, we need to specify them. You know because this file is not being sent to the cloud.</p><p>Now, when we create an Azure function project on VS, it corresponds to our Function APP on the Azure portal. Function APP that we have to create before creating function in Azure portal. Because an Azure function must be in a Function APP. For a Function APP, there should be a storage account, the best practice is to create a separate storage for each function app, to prevent all transactions from going to the same place in terms of performance, if you don’t mind the cost constraint and you have an important application to run in production. On the other hand, the authorization level we have chosen now gains importance when sending it to the cloud. I mentioned levels above.</p><p>We have options when publishing our function: We can publish directly to Azure, we can save it to the docker container register in Azure, we can save it to a folder, we can choose a profile. As a matter of fact, there is no case for Docker here, it already scales itself. Next, we choose the environment where our Function will run. It can be Windows, Linux, Container, Azure Container Register. By the way, Docker only works in the Linux environment, let’s pay attention to that too. As we talked about at the beginning, the infrastructure is not important, it is important that our function is alive. Publish situations are like this in general.</p><p>I’ve left an example of the Azure Function in my GitHub profile here.</p><p><a href="https://github.com/adessoTurkey-dotNET/MT.AzureStorageCreateFile"><strong><em>https://github.com/adessoTurkey-dotNET/ MT.AzureStorageCreateFile</em></strong></a></p><p>I hope it will come in handy, and thank you for reading.</p><p><strong><em>Sağlıcakla kalın. :)</em></strong></p><p><a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview?pivots=programming-language-csharp">https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview?pivots=programming-language-csharp</a></p><p><a href="https://github.com/Azure/Azure-Functions">https://github.com/Azure/Azure-Functions</a></p><p><a href="https://www.geeksforgeeks.org/what-is-microsoft-azure-functions/">https://www.geeksforgeeks.org/what-is-microsoft-azure-functions/</a></p><p><a href="https://www.checkpoint.com/cyber-hub/cloud-security/what-is-serverless-security/what-is-azure-functions/">https://www.checkpoint.com/cyber-hub/cloud-security/what-is-serverless-security/what-is-azure-functions/</a></p><p><a href="https://www.c-sharpcorner.com/article/what-is-azure-functions/">https://www.c-sharpcorner.com/article/what-is-azure-functions/</a></p><p><a href="https://intellipaat.com/blog/what-is-azure-functions/?US">https://intellipaat.com/blog/what-is-azure-functions/?US</a></p><p><a href="https://www.dynatrace.com/news/blog/what-is-azure-functions/">https://www.dynatrace.com/news/blog/what-is-azure-functions/</a></p><p><a href="https://www.serverless360.com/azure-functions">https://www.serverless360.com/azure-functions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ca2635f1eec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/azure-functions-2ca2635f1eec">Azure Functions</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Have You Tried Azure Storage?]]></title>
            <link>https://medium.com/adessoturkey/have-you-tried-azure-storage-5ebcd13d7ce?source=rss-c05c40f043b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ebcd13d7ce</guid>
            <category><![CDATA[azure-storage-explorer]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[azure-storage-blob]]></category>
            <category><![CDATA[azure-storage-account]]></category>
            <category><![CDATA[azure-storage]]></category>
            <dc:creator><![CDATA[Merve Topal]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 13:18:58 GMT</pubDate>
            <atom:updated>2023-07-10T13:23:30.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*BDfVWC3gZxbzom26E4xZ2Q.jpeg" /></figure><p>Hello,</p><p>I hope you are well. In this article, I will explain different types of Azure Storage. My original intention was to cover Azure Functions as well, since it would be nice for you to create scenarios for storage services and Azure Functions, and to project them. However, it is a comprehensive subject as it is. But no problem. 😊 I will be discussing Azure Functions in my next article.</p><p>Here, I will be sharing with you the GitHub link of a project where I use Azure service types and Azure Functions together.</p><p>I wish you a pleasant and useful adventure.</p><p>Shall we start? 😊</p><h4><strong><em>What is the Azure Storage Services?</em></strong></h4><p>“Azure Storage is a cloud storage solution for modern data storage scenarios,” as reported in the Microsoft Azure documentation.</p><p>Azure Storage is a cloud storage solution for modern applications that is scalable, highly available, secure, durable, and based on availability to meet the needs of its customers.</p><p>Its pay-as-you-go model provides you with the flexibility to pay only as much as you use.</p><p>Storage capacity is virtually unlimited. It offers many options by supporting different clients, such as .NET, Ruby, Java, etc.</p><p>You must have an Azure Storage account to access any of the storage services. To do this, first create an Azure account. Let me briefly explain:</p><h4><strong><em>How to create a storage account?</em></strong></h4><p>In the Azure portal ➜ click on Storage Accounts ➜ then on Add.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*1WiIQBgKzVR7L_hyAGkKsg.png" /></figure><h4><strong><em>Azure Store Explorer</em></strong></h4><p>Carrying out the work to be done on the data held in Azure Storage over the cloud can be costly in terms of the pay-as-you-go method. Ultimately, we may want to add, delete, query, and briefly test many data points in the development process, and we may not want to pay for our needs in this whole process. At this point, Azure Storage Explorer is an effective solution. In short, you use Azure Storage Explorer to manage the contents of your Storage account in your local area while in the development process, free of charge. This allows you to easily work across different operating systems such as Windows, Mac, and Linux. It gives you several ways to connect with your Storage accounts. For example, you can connect and manage your local storage and accounts associated with the Azure subscription. I used local storage in my sample project, where I shared the GitHub link. I won’t go into how to connect our current Azure account to Azure Storage Explorer because the scope of the article is getting too big.</p><h4><strong><em>Azure SDK</em></strong></h4><p>We also need the Azure SDK to use Azure services in our development environment. Azure SDK is a tool based on Visual Studio that allows us to interact with Azure services.</p><p>Here’s briefly how to install it:</p><p>Visual Studio ➜ Tools ➜ Get Tools and Features ➜ Visual Studio Installer ➜ Azure Development</p><p>That’s all.</p><p>Well, we said, “Let’s use Azure Storage.”</p><p><strong>Let’s use it. But why?</strong></p><h4><strong><em>Azure Storage features and benefits</em></strong></h4><p>So, how does storing data in the cloud affect businesses or people in general?</p><p>The first and foremost advantage is that it does not require any hardware or physical space. When you don’t need any infrastructure, you also save money. You can grow or shrink your storage according to your needs.</p><ul><li><strong>Durable and Highly Available</strong></li></ul><p>The most important thing for us is data. The stored data is replicated and kept in different geographical locations. Therefore, in case of any hardware failure, your copies, hence your data, will be safe. In addition, in the event of a natural disaster, your data will remain safe, and you can take advantage of them quite easily.</p><ul><li><strong>Scalable</strong></li></ul><p>Scalability ensures access to data at the same time, regardless of the number of clients. Data scales automatically to meet the highest demands.</p><ul><li><strong>Secure</strong></li></ul><p>All our data stored in Azure is encrypted. Azure Storage uses a shared key model to authenticate a user. Using a shared access signature (SAS) can restrict access to data.</p><ul><li><strong>Accessible</strong></li></ul><p>You can access your data stored in Azure Storage in different ways from anywhere in the world. It can be HTTP or HTTPS; you can write your code on Azure PowerShell or Azure CLI. It also provides resources for various programming languages.</p><p>Now that you know why it’s important to store data in the cloud, let’s see what Azure Storage is.</p><h4><strong><em>Azure Storage Services by Data Types</em></strong></h4><p>In fact, in this article, I will discuss in detail the storage types that can be accessed with the API. Do not worry, I will briefly touch on the types designed for VMs. 😉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*HR4zT_xmcM1HYX_q7vE1Xg.png" /></figure><h4>Azure Table Storage</h4><p>It is schemaless, meaning that the data has no fixed structure. It is a derivative of the NoSQL database. You can easily store datasets that do not require any joins or foreign keys. You can denormalize them for faster access. They will also scale as demand for tables increases. Table names must be unique to your account and no longer than 63 characters.</p><p>It will allow you to make queries for similar volumes of data at a lower cost than traditional SQL methods. In addition, NoSQL approaches yield very favorable results in queries made with the OData protocol.</p><p>There is no transaction support in Azure Table Storage. This does not mean that databases that have adopted the NoSQL approach do not have transaction support. MongoDB is an example of this; that is, it has adopted the NoSQL approach and has transaction support.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*Xs3Jsgh6w7xPS3PjfhjPnw.png" /></figure><ul><li><strong><em>Account</em></strong></li></ul><p>This is the storage account where you want to save your tables.</p><p><strong>https://&lt; your storage account&gt;.table.core.windows.net/</strong></p><p>Using this address, you can provide direct access or query via the URL with the OData protocol. It also supports LINQ.</p><p>It is an object that consists of properties and is a whole that models that object. An entity has a RowKey, a Partition Key I, and a timestamp. Because every entity must inherit from TableEntity in Azure Storage.</p><p><em>like that → public class Person: TableEntity</em></p><p>✓ <strong>RowKey: </strong>It can be thought of as a Primary Key. It is a unique value.</p><p>✓<strong> PartitionKey: </strong>It is used for grouping and fast searching of entities. For example, in my example project, I used the City property as the partition key in the Person table.</p><p>✓ <strong>TimeStamp: </strong>It automatically keeps the date when the data was added.</p><ul><li><strong><em>Table</em></strong></li></ul><p>Tables are collections of entities. Since they adopt the NoSQL approach, the entities to be kept in do not have to be uniform. It corresponds to the MongoDB collection in NoSQL.</p><p><strong>Properties</strong></p><p>Properties are key-values. The property name must not exceed 255 characters and is case-sensitive. The following types are supported for properties:</p><p>Common Language Runtime type</p><p>Byte[], Bool, DateTime, Double, Guid, Int32 or int, Int64 or long</p><p>Microsoft Azure Table Storage is designed to store NoSQL structured data. Storage is massively scalable and inexpensive to store data. However, it becomes more expensive if you access the files frequently.</p><p>Microsoft Azure is useful if you find SQL too costly and can manage without its structure and architecture.</p><p>You can use it by installing the <strong>Microsoft.Azure.Cosmos.Table</strong> NuGet package in your project.</p><p>You can implement a repository for crud operations in Azure Table Storage as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a5935076034ad5773333a5a32b70e51/href">https://medium.com/media/9a5935076034ad5773333a5a32b70e51/href</a></iframe><h4>Azure Blob Storage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*mtisKw-R_P5SWsdT0iIK7g.png" /></figure><p>The definition of blob is “Binary Large Object.”</p><p>We can define the blob concept as almost anything consisting of bits and bytes. so, in a sense, we can think of a blob as a data block. These blobs are stored in Containers in the Storage Account. From here, we can deduce that Blob Storage architecture has three layers. Storage Account, Container, and Blob trio. You can have multiple Blob Containers in your Azure Storage Account in your Azure Structure. You can store your data in them. For example, I can put the data I want from outside (mp3, png, jpg, pdf, etc.) into this blob element, regardless of the contents of the box. Why? Because it streams (binary) files and hence the related file can be of any type. So, the data type and size don’t matter. There is no limit to the number of containers or blobs. However, a Storage Account can have a maximum of 500 TB in total, there is the restriction. On the other hand, each of these blobs or items has a unique address. Therefore, when we want to receive any data, we can receive it directly and quickly without any problems. The point we need to pay attention to here is that we can see and find exactly where these data are.</p><p>Objects in Blob Storage can be accessed from anywhere in the world via HTTP or HTTPS. Users or client applications can access blobs via URLs, Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library. The storage client libraries are available for multiple languages, including .NET, Java, Node.js, Python, PHP, and Ruby. So, when we want to make the data publicly available or store application data privately, we can have a Blob Storage address.</p><p>In many cases, you can choose Blob Storage;</p><ul><li>to keep files directly in the cloud,</li><li>to create video and audio streams,</li><li>to backup, restore, recover, or archive data in case of disasters,</li><li>for data doping in analysis studies.</li></ul><p>Rather, it is used to store and scale files in a single place in applications that are raised as more than one instance. Thus, the files are centralized, and the level of manageability is increased. If you’re familiar with AWS S3, containers work pretty much the same as S3 buckets. You can store any number of blob files up to a total size of 500 TB and apply security policies such as S3.</p><p>Blobs are divided into three:</p><p><strong>→ Block Blobs</strong></p><p>The file is not saved as a whole, but by fragmenting it block by block, and only after you complete the upload, the file/blob is combined into one piece. Each block takes a maximum of 100 MB of data, and a blob can have a maximum of 50 thousand blocks. This corresponds to 5 terabytes of data in a single blob.</p><p>When the added file names or contents are desired to be changed, no change is made; the relevant file is overwritten. “Append Blobs” should be preferred to keep modifiable files.</p><p><strong>→ Append Blobs</strong><br> It consists of blocks like block blobs. But it is optimized for insertions. For example, files with log.txt extensions, whose content is constantly changing where logging information is kept.</p><p><strong>→ Page Blobs</strong><br> A page block consists of pages. A page is 512 bytes, and the blob size can be up to 1 TB. This is usually used for fast reads and writes.</p><p>Lastly, I will mention the .net development environment. You need to install the <strong>Azure.Storage.Blobs</strong> library in the application to use it in your applications.</p><p>You can perform operations in Blog Storage as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e3d6fe65929c89c8fa237e9f4e28e78/href">https://medium.com/media/0e3d6fe65929c89c8fa237e9f4e28e78/href</a></iframe><h4>Azure Queue Storage</h4><p>The purpose of message queue systems is to securely and asynchronously queue a message received from one source and transfer it to another. The asynchronous feature provides a structure that does not require the sender and receiver to be online at the same time, thus reducing the server cost. Azure Queue Storage is one of the message queue systems offered by Microsoft Azure.</p><p>The size of the message sent to Azure Queue Storage can be up to 64 KB, and a queue can contain millions of messages. The default lifetime of each message is 7 days. Messages are automatically deleted after 7 days. You can change the message lifetimes in a custom way or keep them in the queue for life, provided that you give the value -1. Messages are not guaranteed to be processed in any particular order. (FIFO is not valid.)</p><p>The subscription system (Subscribe) is not supported. Each message can only have one recipient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*3Gd7tLOpOFIz225hZmsOiQ.png" /></figure><p>It can be addressed using the following URL format:</p><p><strong><em>https: // &lt;storage account&gt;.queue.core.windows.net /&lt;queue&gt;</em></strong></p><h4><strong><em>Azure Queue Storage Concepts:</em></strong></h4><p><strong>→ <em>Storage Account: </em></strong>This is your Azure Storage account containing your queue storage, and we can create multiple queues within this Storage Account.</p><p><strong>→ <em>Queues</em>:</strong> They are structures in which messages are sent and kept. There are some standards we must follow when naming queues:</p><ul><li>The queue name must begin with a letter or number and can contain only letters, numbers, and the hyphen (-) character.</li><li>The first and last letters of the queue name must be alphanumeric. The hyphen (-) character cannot be the first or the last character. Consecutive dashes are not allowed in the queue name.</li><li>All letters in the queue name must be lowercase.</li><li>The queue name must be between 3 and 63 characters long.</li></ul><p><strong>→ <em>Message</em>: </strong>A message can be sent in any format up to 64 KB.</p><p>When we create an Asp.NET Core application, we need to add the Azure.Storage.Queues NuGet package to our application. And in the development environment, you can perform operations in Queue Storage as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e8810428652c9feac095dffe717a112/href">https://medium.com/media/1e8810428652c9feac095dffe717a112/href</a></iframe><h4>Azure File Storage</h4><p>Microsoft Azure File Storage is the second storage type that was designed to support the needs of the Azure VM environment. That storage is, in essence, a network share. You can store files there that can be accessed from different Virtual Machines.</p><p>It allows the ability to read and write shared files. It is used for file sharing in in-house applications. The drive connected to the storage can be mounted on the personnel computers, and all transfers made over this drive facilitate the data transfer to Azure Storage. To mount Azure File Storage on your computer:</p><p>Azure portal➜ Overview ➜ File shares.</p><h4>Azure Disk Storage</h4><p>Microsoft Azure Disk Storage is based on Page Blobs. It is a service that allows you to create disks for your virtual machines. A disk created in Disk Storage can be accessed from only one virtual machine. In other words — it is your local drive. Yes, it’s that simple.</p><p>Here, you have two options for the speed of your disks:</p><ul><li>HDDs that are cheap but slow are called <strong>standard</strong> storage.</li><li>SSDs that are fast but expensive are called <strong>premium</strong> storage.</li></ul><p>And two options for disk management:</p><ul><li>Unmanaged disk: You should manage the disk storage and corresponding account yourself.</li><li>Managed disk: Azure does everything for you. You need to select only the size of the disk and the desired type (standard or premium)</li></ul><p>I’ve left an example of Azure Storage in my GitHub Profile here.</p><p><a href="https://github.com/adessoTurkey-dotNET/MT.AzureStorageCreateFile"><strong><em>https://github.com/adessoTurkey-dotNET/MT.AzureStorageCreateFile</em></strong></a></p><p>I hope it will come in handy and thank you for reading.</p><p><strong><em>Sağlıcakla kalın. :)</em></strong></p><p><a href="https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction">https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction</a></p><p><a href="https://intellipaat.com/blog/tutorial/microsoft-azure-tutorial/azure-storage/?US">https://intellipaat.com/blog/tutorial/microsoft-azure-tutorial/azure-storage/?US</a></p><p><a href="https://cloudacademy.com/blog/azure-storage-service-overview/">https://cloudacademy.com/blog/azure-storage-service-overview/</a></p><p><a href="https://www.sqlshack.com/different-azure-storage-types-file-blob-queue-table/">https://www.sqlshack.com/different-azure-storage-types-file-blob-queue-table/</a></p><p><a href="https://www.msp360.com/resources/blog/microsoft-azure-storage-types-explained/">https://www.msp360.com/resources/blog/microsoft-azure-storage-types-explained/</a></p><p><a href="https://www.edureka.co/blog/azure-storage-tutorial/">https://www.edureka.co/blog/azure-storage-tutorial/</a></p><p><a href="https://www.serverless360.com/azure-storage-account">https://www.serverless360.com/azure-storage-account</a></p><p><a href="https://www.logicmonitor.com/blog/what-is-azure-blob">https://www.logicmonitor.com/blog/what-is-azure-blob</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ebcd13d7ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/have-you-tried-azure-storage-5ebcd13d7ce">Have You Tried Azure Storage?</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Exactly Is This Event Bus, What Does It Solve? Outbox pattern And DotNetCore.CAP]]></title>
            <link>https://medium.com/adessoturkey/what-exactly-is-this-event-bus-what-does-it-solve-outbox-pattern-and-dotnetcore-cap-dc1c95b76982?source=rss-c05c40f043b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc1c95b76982</guid>
            <category><![CDATA[outbox-pattern]]></category>
            <category><![CDATA[cap]]></category>
            <category><![CDATA[eventbus]]></category>
            <dc:creator><![CDATA[Merve Topal]]></dc:creator>
            <pubDate>Tue, 14 Mar 2023 13:30:25 GMT</pubDate>
            <atom:updated>2023-03-14T17:02:10.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*ZqvBw6hxuJIuzMGku_gxGQ.jpeg" /></figure><p><strong>What Exactly Is This Event Bus, What Does It Solve?</strong></p><p><strong>Outbox pattern And DotNetCore.CAP</strong></p><p>Hello,</p><p>I am excited and happy because this is my first post here,</p><p>Let’s start..</p><p>You know why we’re moving from monolith to distributed architecture in almost every project today, so I’m skipping this part. One of the most important issues to be considered in this transition process is how the communication between services should be. We did not have such a problem in monolithic structures because the whole project was running on a single content, but when it comes to microservice architecture, how the data traffic between services will become an important issue.</p><p>Here we will focus on what is event bus, what is facilitator, how it is implemented, which patterns are applied for data consistency. There are many different subtleties that make asynchronous communication between microservices much easier or much more difficult.</p><p>First of all, the event bus…</p><p>The event bus is a mechanism that enables different services (publisher-subscriber) to communicate with each other without being aware of each other. A service may send an Event to the event bus without knowing who or how many people will receive it. Services can also listen for events on an event bus without knowing who is sending the events. In this way, services can communicate without being dependent on each other.</p><p>Event buses are useful when you don’t want services to be interdependent. Instead of a service with many references to other services you can send events to an event bus and not have to worry about who will take care of them. This will make it much easier to develop an application and break it down into separate parts. Thus, when a service in the ecosystem is down, all system or other services are not affected and the application life cycle continues. In addition, thanks to the event bus, you will not lose the data that the crashed service will process by applying various patterns, and the service can process these data when it is up. And of course, while all this is happening, our main point is that the application lifecycle continues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*aF7jXq-lYA2EeTEVsKO8Vw.png" /></figure><p><strong>What about the Outbox pattern?</strong></p><p>If our topic is event bus, naturally distributed systems, and asynchronous communication between services, it may not always be possible to use more than one external service together and in a single transaction. The reliability of our application is also reduced when we develop by ignoring integrity. Now, we will examine together how we can use different services transactionally through the Outbox design pattern and what the Outbox design pattern is.</p><p>One of the biggest challenges of microservice architectures is to ensure data consistency. Some data is transferred from one service to another via asynchronous events to ensure consistency.</p><p>Yes, in such an atmosphere, situations such as disconnection, error, and unexpected physical or software interruptions in the process occur before the messages are sent during the inter-service (or service and event bus) communication processes reach their destination. By preventing the loss of the message, we will definitely encounter simple but critical points that come into play to resend the message when the unfavorable situations pass. This is a possible scenario in distributed architectures such as microservice architecture.</p><p>The problem arises when two situations occur:</p><p>You are saving the data to your database, but an error occurred while publishing the event to your messenger. You post an event to your message broker that something has happened on your system, but then it fails when trying to save it to your database. In either case, there is no consistency between what your database saves and what you publish to the message broker. What you want in this case is a single atomic transaction that can save the data to your database and broadcast the event. If one fails, the other is rolled back.</p><p>This is where Outbox is a hugely effective pattern.</p><p>Keeping the communication data between services in the Outbox in the asynchronous process, protects the integrity by ensuring that it is not affected by the communication and data transfer problems that may occur due to possible malfunctions, system interruptions, or disconnections.</p><p>It actually works with a very simple logic. Solution: A change is made to the database. Then, it stores the operation to be executed as a task in the database. In other words, in one transaction, we both do the operation we want to do in the database and leave a mark for the action we will take after this transaction. We also scan tasks periodically with a background application. If a new task is found, we process it via the background service and mark it as complete. This is how we can summarize the Outbox design pattern.</p><p><strong>Now, let’s consider the event bus and the Outbox pattern together.</strong></p><p>Let’s assume that a new event will be published to an event bus as a result of the operations performed on a request to a service. If this operation is performed at the time of need, we must make sure that the sent message reaches the event bus. If a problem occurs, all operations performed by this service must be reversed for consistency. But is this true? After all, it is quite normal for services to experience temporary problems in a distributed architecture.</p><p>It should be able to keep the events to be processed until the related service is fixed and be able to process the events from where it left off when the service stands up. Many event bus technologies can provide us with this situation. But what if something happens to the event bus, not to the services that will process the event, and we can’t send the event? This means that we lost the event, which leads to data inconsistency between services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*foOsmZgY_0-0x3ZEtaapyg.png" /></figure><p>In such a case, instead of directly communicating with the event bus, the related event is recorded in a table that will correspond to the Outbox and kept waiting. Then, with a background service that scans this table at regular intervals, the events registered there are tried to be transmitted to the event bus.</p><p>Thus, in terms of architectural design, possible data loss risks will be prevented, and it will be guaranteed that the message will reach the target at least once, depending on whether the event bus is working or not during the communication process between the services. As a result, the services will become a little more loosely coupled.</p><p>It is understood from here that the Outbox pattern can be used if you want to guarantee at least one transmission for the message to be sent to the event bus.</p><p>So far, we have talked about the use of the event bus and the Outbox pattern and its advantages. At this point, I would like to talk about a technology that offers these approaches together.</p><p>DotNetCore CAP. Let’s see what’s inside.</p><p><strong>DotNetCore.CAP</strong></p><p>CAP is a lightweight, easy, and efficient .NET based, open-source library. It provides ease in terms of manageability and has the event bus function, since the producer-consumer structure in distributed systems does not fully guarantee reliability.</p><p>In systems that take the microservice approach, we usually need to use events to integrate each service. In this process, simple use of the message queue does not guarantee reliability.</p><p>CAP is a library that has adopted the Local Message Table approach that works integrated with the existing database in order to resolve the exceptions that will occur when the services communicate with each other in the microservice architecture. It can ensure that event messages are not lost under any circumstances.</p><p>Here, the Outbox pattern comes to mind. In other words, an event bus solution with an Outbox pattern feature in itself.</p><p>CAP is one of the libraries that has successfully implemented the transactional Outbox pattern for .NET Core.</p><p>As you can see in the picture, this is how it promotes its NuGet Package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*JlKEUI2oD8OhH0zLLsakdw.png" /><figcaption>DotNetCore.CAP Nuget Package</figcaption></figure><p>CAP provides a simpler way to publish events and implement subscriptions. You don’t need to inherit or implement any interface during the subscription and submit process.</p><p>One of the strengths of asynchronous communication is reliability, where errors in one part of the system do not propagate or cause the entire system to crash. To ensure the reliability of the messages, the messages are stored in the CAP and strategies such as retries are used to achieve the eventual consistency of data between services.</p><p>Compared to other service buses or event buses, CAP has its own characteristics. It does not require users to implement or inherit any interface when sending or processing messages. It has very high flexibility, so CAP is very simple to use, very easy, and light.</p><p>CAP has a modular design and is highly scalable. You have many options to choose from, such as message queues, storage, serialization, etc., where many elements of the system can be replaced with custom applications.</p><p>Now, let’s take a look at some of the conveniences provided by CAP:</p><p>FailedRetryInterval</p><p>If the message transfer fails during the message sending process, the CAP will try to send the message again. This configuration option is used to configure the interval between each retry.</p><p>FailedRetryCount</p><p>When the value for maximum number of retries is reached, the retry will stop, and the maximum number of retries will be changed by setting this parameter.</p><p>CollectorCleaningInterval →Expired messages are deleted.</p><p>SucceedMessageExpiredAfter →The expiration time of the success message (in seconds).</p><p>When the message is successfully sent or consumed, it will be removed from the database when the duration reaches SucceedMessageExpiredAfter seconds. You can set the expiration time by specifying this value.</p><p>FailedMessageExpiredAfter →The expiration time of the failed message (in seconds).</p><p>If the message fails when sent or consumed, it will be removed from the database storage when the time reaches FailedMessageExpiredAfter seconds. You can set the expiration time by specifying this value.</p><p>The subject of message transmission to the consumer side, in the CAP in transaction approach:</p><p>At Most Once</p><p>Situations where you are guaranteed to receive all messages once or not at all are covered by the Once at Most approach.</p><p>At Least Once</p><p>Situations where you are guaranteed to receive all messages once, or several times in the event of an error, are those covered by the at least once approach.</p><p>Supported structures:</p><p>CAP uses persistent storage media to store event messages in the database. CAP uses this approach to deal with message loss in all environments or network problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*V5aarUdAqPm1OXpBtR-RYw.png" /><figcaption>It gives you an idea of how the CAP works when implementing the outbox template.</figcaption></figure><p>CAP, which is very simple to use, supports RabbitMQ, Kafka and Azure Service Bus, so you can use any message broker service you want, or you can seamlessly transition on demand.</p><p>On the database side; SQL Server, MySQL, PostgreSQL, and MongoDB are among the options it supports.</p><p>And it also has entity framework support. At the end of the article, you can review my project where I used Entity Framework and Unit of Work pattern with CAP.</p><p>Each event is kept at the database level, preventing data loss in case of possible errors or interruptions. In cases where communication is restored, it resends messages that have not been sent to the message queue system and that have not expired, thus allowing development in isolation from the message queuing system used and even from errors or interruptions.</p><p>After starting the CAP, two tables are created by default in the database, their default names are cap.Published and cap.Received.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*fVoKKjdQn88G-yisBLS4Vw.png" /><figcaption>Cap Tables -Published and Received</figcaption></figure><p><strong>Message publishing on CAP</strong></p><p>After integrating the DotNetCore.CAP NuGet package into your project, you can publish your message with the name you want with the “ICapPublisher” interface.</p><p><em>await _capPublisher.PublishAsync&lt;object&gt;(“producer.MyMessage”,MyObject);</em></p><p>Again, since you can use the capPublisher object that you inject through the context object, you can perform your database operations and publish messages in the same transaction.</p><p><strong>Message subscribing in CAP</strong></p><p>In order to get the message published by the producer on the Consumer side, it is sufficient to pass [CapSubscribe(“producer.MyMessage “)] on the consumer in the relevant project. It is important that you capture it with the name of the message you publish here.</p><p><strong>Creating subscriber groups</strong></p><p>CAP can distribute an incoming message to more than one group, allowing it to be listened to by more services or controllers.</p><p><em>[CapSubscribe(“producer.MyMessage”, Group = “group1”)]</em></p><p><strong>Creating a dashboard</strong></p><p>CAP has a dashboard feature so that we can easily see the sent and received messages in real-time. For dashboard integration, you can download the DotNetCore.CAP.Dashboard NuGet package to the application and easily integrate it into your project in the startup file. You can see successful and unsuccessful messages on a dashboard screen under the address you matched in Startup; for example, /cap-dashboard. (It looks very similar to the Hangfire dashboard.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*g1jZB4Ua69k01QbEBBhrag.png" /><figcaption>cap-dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*JcDL_VFcdlyPo2s3d4MpEA.png" /><figcaption>Message Content in cap-dashboard</figcaption></figure><p>Yes, friends, the situation is like this in CAP in general.</p><p>I’ve left a example of CAP in my GitHub Profile here.</p><p><a href="https://github.com/adessoTurkey-dotNET/MT.DotNetCoreCAP"><strong>https://github.com/adessoTurkey-dotNET/MT.DotNetCoreCAP</strong></a></p><p>I hope it will come in handy and thank you for reading.</p><p>Sağlıcakla kalın. :)</p><p><a href="http://www.rribbit.org/eventbus.html">http://www.rribbit.org/eventbus.html</a></p><p><a href="https://docs.microsoft.com/en-US/dotnet/architecture/microservices/architect-microservice-container-applications/communication-in-microservice-architecture">https://docs.microsoft.com/en-US/dotnet/architecture/microservices/architect-microservice-container-applications/communication-in-microservice-architecture</a></p><p><a href="https://bernardo-teixeira-691.medium.com/eventbus-microservices-58b8c51a08f4">https://bernardo-teixeira-691.medium.com/eventbus-microservices-58b8c51a08f4</a></p><p><a href="https://dzone.com/articles/communication-between-microservices">https://dzone.com/articles/communication-between-microservices</a></p><p><a href="https://github.com/dotnetcore/CAP">https://github.com/dotnetcore/CAP</a></p><p><a href="https://event-driven.io/en/outbox_inbox_patterns_and_delivery_guarantees_explained/">https://event-driven.io/en/outbox_inbox_patterns_and_delivery_guarantees_explained/</a></p><p><a href="https://dzone.com/articles/implementing-the-outbox-pattern">https://dzone.com/articles/implementing-the-outbox-pattern</a></p><p><a href="http://www.kamilgrzybek.com/design/the-outbox-pattern/https://dev.to/sacha/outbox-pattern-never-loose-an-event-anymore-319l">http://www.kamilgrzybek.com/design/the-outbox-pattern/https://dev.to/sacha/outbox-pattern-never-loose-an-event-anymore-319l</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc1c95b76982" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/what-exactly-is-this-event-bus-what-does-it-solve-outbox-pattern-and-dotnetcore-cap-dc1c95b76982">What Exactly Is This Event Bus, What Does It Solve? Outbox pattern And DotNetCore.CAP</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>