<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Surya Venkat</title>
    <description>The latest articles on Forem by Surya Venkat (@suryavenkat_v).</description>
    <link>https://forem.com/suryavenkat_v</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F173071%2F5f07449d-4a1c-4861-abd8-d643e592841e.jpg</url>
      <title>Forem: Surya Venkat</title>
      <link>https://forem.com/suryavenkat_v</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/suryavenkat_v"/>
    <language>en</language>
    <item>
      <title>Azure Functions in the Portal – ALM</title>
      <dc:creator>Surya Venkat</dc:creator>
      <pubDate>Tue, 24 Sep 2019 12:53:51 +0000</pubDate>
      <link>https://forem.com/suryavenkat_v/azure-functions-in-the-portal-alm-1a73</link>
      <guid>https://forem.com/suryavenkat_v/azure-functions-in-the-portal-alm-1a73</guid>
      <description>&lt;p&gt;Author Credits: &lt;a href="https://www.serverless360.com/blog/author/michael" rel="noopener noreferrer"&gt;Michael Stephenson&lt;/a&gt;, Microsoft Azure MVP.&lt;/p&gt;

&lt;p&gt;Originally Published at &lt;a href="https://serverless360.com/" rel="noopener noreferrer"&gt;Serverless360 Blogs&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;This article is part of &lt;a href="https://dev.to/azure/serverless-september-content-collection-2fhb" rel="noopener noreferrer"&gt;#ServerlessSeptember&lt;/a&gt;. You'll find other helpful articles, detailed tutorials, and videos in this all-things-serverless content collection. New articles are published every day — that's right, every day — from community members and cloud advocates in the month of September.&lt;br&gt;&lt;br&gt;

Find out more about how Microsoft Azure enables your Serverless functions at &lt;a href="https://docs.microsoft.com/en-us/azure/azure-functions/?WT.mc_id=servsept_devto-blog-cxa" rel="noopener noreferrer"&gt;https://docs.microsoft.com/azure/azure-functions/&lt;/a&gt;.&lt;/blockquote&gt;

&lt;p&gt;One of the advantages of Azure is that for some use cases you can develop solutions in the Azure Portal.  This has the benefits that you can just focus on writing some code and not have to worry about versions of Visual Studio and extensions and all of the other overheads which turn a few simple lines of code which can be written by anyone into something which requires an additional level of developer skills. Let’s face it the ALM processes have been around for years but there are still large portions of the developer community who don’t follow them.&lt;/p&gt;

&lt;p&gt;The ability to just get the job done in the portal is compelling and I expect that we will see more of that in the future but it does give you a challenge when it comes to ALM activities like keeping a safe version of the code and being able to move between environments reliably&lt;/p&gt;

&lt;p&gt;This article explores the options for being able to develop an Azure Function in the portal but use some of the basic ALM type activities which would only be a minor overhead but gives some good practices so that developing in the portal would be ok in the real world.&lt;/p&gt;

&lt;h2&gt;My Process&lt;/h2&gt;

&lt;p&gt;The process I am going to follow is as follows:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;I will have a development resource group which will contain my Azure Function and the code for it&lt;/li&gt;
    &lt;li&gt;The resource group will also contain other assets for the function like AppInsights and Storage&lt;/li&gt;
    &lt;li&gt;I will create a 2&lt;sup&gt;nd&lt;/sup&gt; resource group called Test. In my Build process, I will refresh the Test resource group with the latest version so I can do some testing&lt;/li&gt;
    &lt;li&gt;Once I am happy with the test resource group I will then execute a release pipeline which will copy the latest for the function to other environments such as UAT which I assume are used by other testers etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To summarise the pipeline usage see below:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Dev -&amp;gt; Test = Build Pipeline&lt;/li&gt;
    &lt;li&gt;-&amp;gt; UAT and beyond = Release Pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Assumptions&lt;/h2&gt;

&lt;p&gt;I am going to make a few assumptions:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;The function apps and Azure resources will be created by hand in advance&lt;/li&gt;
    &lt;li&gt;Any config settings will be added to the function apps by hand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this simple example, we are assuming that everything is quite simple, and we can just update the code between environments.  In a future example, we will look at some more complex scenarios.&lt;/p&gt;

&lt;h2&gt;Walk-through&lt;/h2&gt;

&lt;p&gt;To begin the walk-through, let’s have a look at the code for our function below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sdILWcS4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Function-Code.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80217451" src="https://res.cloudinary.com/practicaldev/image/fetch/s--sdILWcS4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Function-Code.png" alt="Azure Function in the portal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see this is a very simple function which is just reading some config settings and returning them.&lt;/p&gt;

&lt;h3&gt;Build Process&lt;/h3&gt;

&lt;p&gt;From here we need to go to our Build process in Azure DevOps.  The build process looks like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--THHiey6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/build-process-azure-functions.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80217452" src="https://res.cloudinary.com/practicaldev/image/fetch/s--THHiey6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/build-process-azure-functions.png" alt="Build process in Azure DevOps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have defined a build process which I could use for any function app in the portal.  I would simply need to change the variables and subscriptions references and it could be reused easily via the Clone function.&lt;/p&gt;

&lt;p&gt;The build executes the following steps:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Show all build variables = I use this for troubleshooting as it shows the values for all build variables&lt;/li&gt;
    &lt;li&gt;Export code = This uses the App Service Kudu API features to download the source code for the function app as a zip file&lt;/li&gt;
    &lt;li&gt;Publish Artifact = This attaches the zip file to the build so I can use it in Release pipelines later&lt;/li&gt;
    &lt;li&gt;Azure Function App Deploy = This will deploy the zip file to the Test function app so that I can do some manual testing if I want.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;A closer look at Export&lt;/h3&gt;

&lt;p&gt;I think in the build process the Export Function Code step warrants a closer look.  This step uses Powershell to execute a web request to download the code as a zip file.  I have used the publisher profile in the function app to get the publisher credentials which I can save as build variables and then use as a basic authentication header for the web request to do the download. See the below piece of code&lt;/p&gt;

&lt;pre class="lang:ps decode:true  "&gt;$user = '$(my.functionapp.deployment.username)'
$pass = '$(my.functionapp.deployment.password)'
$pair = "$($user):$($pass)"

Write-Host $pair
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))

$basicAuthValue = "Basic $encodedCreds"

$Headers = @{
    Authorization = $basicAuthValue

}

Write-Host $(my.functionapp.name)

Invoke-WebRequest -Uri 

"https://$(my.functionapp.name).scm.azurewebsites.net/api/zip/site/wwwroot/" -OutFile 
"$Env:BUILD_STAGINGDIRECTORY\Function.zip" -Headers $Headers
&lt;/pre&gt;

&lt;h2&gt;A closer look at Azure Function App Deploy&lt;/h2&gt;

&lt;p&gt;The Azure Function app deploy is simply using the out of the box task.  I am pointing to the zip file I have just downloaded in the earlier step and it will automatically deploy it for me.  I have set the deployment type on this task to Zip deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dptPKc94--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Function-App-Deploy.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80217476" src="https://res.cloudinary.com/practicaldev/image/fetch/s--dptPKc94--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Function-App-Deploy.png" alt="Function App Deploy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Release Process&lt;/h3&gt;

&lt;p&gt;We now have a repeatable build process which will take the latest version of the code from my development function app and push it to the test instance and package the zip file so I can at some future point release this version of the code.&lt;/p&gt;

&lt;p&gt;To do the release to other environments I have an Azure DevOps Release pipeline. You can see this below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b5gfGNCr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Azure-devops-release-pipeline.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80217454" src="https://res.cloudinary.com/practicaldev/image/fetch/s--b5gfGNCr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/Azure-devops-release-pipeline.png" alt="Azure devops release pipeline"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Release pipeline contains a reference to the build output I should use and then contains a set of tasks for each environment we want to deploy to.  In this case its just UAT.  The UAT release process looks like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---7tBULQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/UAT-release.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80217455" src="https://res.cloudinary.com/practicaldev/image/fetch/s---7tBULQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.serverless360.com/wp-content/uploads/2019/07/UAT-release.png" alt="UAT release"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see that in this case the Release process is very simple and really it’s a cut down version of the Build process.  In this case, I am downloading the artifact we saved in the build.  We then use the Azure Function deploy to copy the function to the UAT function app.  We are just using the same OOTB configuration as in the above Build process but this time we are pointing to the UAT Function app.&lt;/p&gt;

&lt;p&gt;I now just need to run the Release process to deploy the function to other environments.&lt;/p&gt;

&lt;h2&gt;Limitations&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt;I am not using any visual studio so I am unlikely to be automatically testing my functions much. I could potentially look at doing something in this area but it's out of the scope of this article&lt;/li&gt;
    &lt;li&gt;I am not keeping the code in source control in this article. I am happy that the zip file attached to the build is sufficient.  I could possibly look to saving the zip to source control or unpacking it and saving files to source control if I wanted&lt;/li&gt;
    &lt;li&gt;I am not using any continuous integration here, you could maybe monitor Azure events with Logic Apps and then develop your own trigger.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;Hopefully, you can see that it is very simple to implement the most basic of ALM processes for your development in the portal effort which will add some maturity to it.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Azure Service Bus Overview</title>
      <dc:creator>Surya Venkat</dc:creator>
      <pubDate>Fri, 30 Aug 2019 06:37:00 +0000</pubDate>
      <link>https://forem.com/suryavenkat_v/azure-service-bus-overview-bm</link>
      <guid>https://forem.com/suryavenkat_v/azure-service-bus-overview-bm</guid>
      <description>&lt;h2&gt;What is Azure Service Bus?&lt;/h2&gt;

&lt;p&gt;Azure Service Bus is a messaging service on cloud used to connect any applications, devices, and also services running in the cloud to any other applications or services. As a result, it acts as a messaging backbone for applications available in the cloud or across any devices.&lt;/p&gt;

&lt;h2&gt;Service Bus Concepts&lt;/h2&gt;

&lt;p&gt;At the time of this webinar, there were three basic concepts in Azure Service Bus:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Relay -&amp;gt; To establish a secure connection between applications which is bridged through the cloud&lt;/li&gt;
    &lt;li&gt;Messaging -&amp;gt; Used to push/pull messages from the queue&lt;/li&gt;
    &lt;li&gt;Event Hub -&amp;gt; High performing stream-based event system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Relays and also Event Hubs were moved out as separate services and Service Bus will only refer to Messaging that consists of Queues / Topics&lt;/p&gt;

&lt;h2&gt;Multi-Tenant Service Bus environment&lt;/h2&gt;

&lt;p&gt;In this environment, we can create a namespace which would be the container for our Service Bus artifacts in the cloud. The namespace can be available in different regions.&lt;/p&gt;

&lt;p&gt;Each namespace comprises messaging entities like Queues, Relays or Topics. Most importantly, a namespace will be dedicated only to one type of Service Bus.&lt;/p&gt;

&lt;h3&gt;Message processing statistics (as of 2015)&lt;/h3&gt;

&lt;p&gt;The statistics generated by the Microsoft team working on Service Bus are as follows,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Event Hub = 30 Billion Events per day&lt;/li&gt;
    &lt;li&gt;Messaging = 7 Billion Messages per day&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It can handle a colossal number of messages in a very executable manner.&lt;/p&gt;

&lt;h2&gt;Service Bus Relay&lt;/h2&gt;

&lt;p&gt;In Service Bus Relay, we will have an endpoint that will be hosted in the cloud, but the difference would be the fact that our on-premise service will make an outbound connection to register with the Service Bus relay endpoint.&lt;/p&gt;

&lt;p&gt;At a conceptual level, we send a message to an endpoint in the cloud from where it will be forwarded to an on-premise service. As a result, it gives us the advantage to connect from one organization to another organization without having to set VPNs.&lt;/p&gt;

&lt;p&gt;Some of the key features are,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7YBkQLkT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Relay-advantages.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213250" src="https://res.cloudinary.com/practicaldev/image/fetch/s--7YBkQLkT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Relay-advantages.png" alt="Azure Service Bus overview"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Service Bus Relay can be used to solve problems in scenarios like,&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;Information passed between two data centers.&lt;/li&gt;
    &lt;li&gt;Building an integration architecture through SAP to forward messages into microservice architecture using Service Bus Relay.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example Scenarios:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Many of the Microsoft API apps connect to on-premise systems use relay under the hood&lt;/li&gt;
    &lt;li&gt;Danish pension and also insurance supplier exposes IBM WebSphere integration platform to partners through relay&lt;/li&gt;
    &lt;li&gt;Northumbria University use the relay to bridge cloud-hosted application to integrate with on-premise WCF service&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Demo-Relay&lt;/h3&gt;

&lt;p&gt;This demo explains the process of hybrid connectivity with Service Bus Relay. We would initially work on a WCF service (on-premise service). The demo constructed on a .NET framework with console application is to call the back-end service.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://www.serverless360.com/compare-service-bus-explorer" rel="noopener noreferrer"&gt;Service Bus Explorer&lt;/a&gt;, we will have a registered endpoint under the “relay” section. Now, a virtual directory (router) will be linked to the configuration file “web” under user defined location to establish a connection. The folder would also comprise of two more files, which are,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Bin directory&lt;/li&gt;
    &lt;li&gt;WcfRoutingService(SVC file)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the SVC file, there would be service pointing to WCF routing service endpoint. In the configuration file, there would a WCF service which uses the HTTP relay binding along with other credentials to access the Service Bus Relay.&lt;/p&gt;

&lt;p&gt;Finally, Service Bus Relay accepts a message and forwards it to the back-end service. When executed on the console application, every message will be processed within a time frame of 100 milliseconds.&lt;/p&gt;

&lt;h2&gt;Messaging&lt;/h2&gt;

&lt;p&gt;In Azure Service Bus, We can transfer the data between services or applications in message format like XML, JSON, or text.&lt;/p&gt;

&lt;p&gt;In this messaging protocol, Microsoft would handle most of the scaling. We just have to create a namespace using platforms like Azure Portal, Service Bus Explorer or &lt;a href="https://www.serverless360.com/"&gt;Serverless360&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V_pwX3kr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Messaging-Advantages.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213251" src="https://res.cloudinary.com/practicaldev/image/fetch/s--V_pwX3kr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Messaging-Advantages.png" alt="Messaging Advantages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us consider some example scenarios,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Construction companies use sensors to monitor buildings in real time to ensure adherence to safety more standards.&lt;/li&gt;
    &lt;li&gt;Using Service Bus, “Qoros” (Chinese car manufacturer) connects a car to the internet to stream messages.&lt;/li&gt;
    &lt;li&gt;Metro Bank Use Service Bus Messaging to manage near real-time messaging between SharePoint and also Dynamics CRM.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Queue&lt;/h3&gt;

&lt;p&gt;A messaging protocol based on the first-in-first-out pattern. Here a sender would send a message to a queue from where the receiver would collect it in initial or later stage. Besides that, queues enable us to store the message until the receiver is available to receive and also process them. The user will receive the message upon request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d4A0mklm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Queue.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213224" src="https://res.cloudinary.com/practicaldev/image/fetch/s--d4A0mklm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Queue.png" alt="service bus Queue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Topics&lt;/h3&gt;

&lt;p&gt;Topics are similar to queues. Most importantly, topics make multiple subscriptions available. A sender will send a message to a topic then a routing rule can determine which subscription may receive the slotted copy of the message.&lt;/p&gt;

&lt;p&gt;The receiver can receive the message from the subscription. Multiple receivers could be allocated to a subscription.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uJzP9fy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Topics.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213225" src="https://res.cloudinary.com/practicaldev/image/fetch/s--uJzP9fy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Topics.png" alt="service bus Topics"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Other messaging patterns include,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;RPC&lt;/li&gt;
    &lt;li&gt;Scatter Gather&lt;/li&gt;
    &lt;li&gt;Pub/Sub&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Demo-Messaging&lt;/h3&gt;

&lt;p&gt;In this demo, we will send a message to a queue and also collect it back. Initially, a queue (testqueue) will be specified and also the following properties will be determined in Service Bus Explorer as mentioned below,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Path&lt;/li&gt;
    &lt;li&gt;Queue properties&lt;/li&gt;
    &lt;li&gt;Lock duration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To send a message to a queue and also to collect it back, we define the Service Bus connection string along with reference to Service Bus NuGet package.&lt;/p&gt;

&lt;p&gt;We will now create a Service Bus message and sent it. On receiving side, we have a competing consumer pattern which enables multiple concurrent consumers to process messages received on the messaging channel. Dynamic message delivery method is employed in a single-thread pattern i.e., first-in-first-out. But in multi-threading pattern, messages will be processed at a higher throughput for multiple receivers.&lt;/p&gt;

&lt;p&gt;On receiving side, using “OnMessagingOption” we can specify the number of concurrent receivers required,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f-xmSppr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/code-02.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213227" src="https://res.cloudinary.com/practicaldev/image/fetch/s--f-xmSppr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/code-02.png" alt="code-02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will then access the body of the message through the event (OnMessage) and also write it to the console window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--il6LPE8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Messaging-Code-02.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213228" src="https://res.cloudinary.com/practicaldev/image/fetch/s--il6LPE8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Messaging-Code-02.png" alt="Demo Messaging Code-02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The message can either be removed from the queue or abandoned. Service Bus handles serialization with the help of SDK’s.&lt;/p&gt;

&lt;p&gt;Let us consider, when we send a message it would be processed in a loop format. So, we will take the .NET type specified as “TestMessage” and also moves it to “BrokeredMessage” to handle the serialization of the .NET type when passed to the queue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QRPxJzJF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Messaging-Code-03.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213229" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QRPxJzJF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Messaging-Code-03.png" alt="Demo Messaging Code 03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The content of the message will be extracted. Then the format of the message which delivered, received should be verified.&lt;/p&gt;

&lt;p&gt;Now if we run our demo on two separate console applications, one to send and also another to receive. The respective messages would be sent and also received from the queue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sR02SDJd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/messaging-code-01.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone wp-image-80213230 size-full" src="https://res.cloudinary.com/practicaldev/image/fetch/s--sR02SDJd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/messaging-code-01.png" alt="Messaging output 01"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M2pRzHM6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/messaging-output-02.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213231" src="https://res.cloudinary.com/practicaldev/image/fetch/s--M2pRzHM6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/messaging-output-02.png" alt="Messaging output 02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Event Hubs:&lt;/h2&gt;

&lt;p&gt;Event hubs will manage massive scale event stream processing and are similar to Service Bus messaging. It is similar in the case that it supports sending the message over AMQP (Advanced Message Queuing Protocol).&lt;/p&gt;

&lt;p&gt;The key difference between Event Hubs and also Service Bus messaging is that there is no concept of deleting a peek lock message like in Service Bus. Instead, Microsoft has used a reader across a stream which provides a high level of scaling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6clRWHeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Event-Hub-Advantages.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213252" src="https://res.cloudinary.com/practicaldev/image/fetch/s--6clRWHeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Event-Hub-Advantages.png" alt="Azure Event Hub Advantages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us consider an IOT scenario where Event Hub comes in use,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H3GsCZcq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/event-hub-scenario.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213235" src="https://res.cloudinary.com/practicaldev/image/fetch/s--H3GsCZcq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/event-hub-scenario.png" alt="azure event hub scenario"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above picture comprises many subsystems, each with an individual offering. Event Hub can stream a high volume of data from different applications and also store it.&lt;/p&gt;

&lt;p&gt;Most importantly, users can process the streamed data and apply it for their individual purpose.&lt;/p&gt;

&lt;p&gt;Let us consider some example scenarios:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Microsoft uses Event Hub under the hood as a part of application insights and also API management.&lt;/li&gt;
    &lt;li&gt;A company called “Autolib” uses Event Hub as a part of Microsoft IOT stack to exchange information between devices and also vehicles as a part of a car-sharing scheme in Paris.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Event Hub, multiple senders store their telemetry data in the message stream. A receiver cannot remove the message from the stream. Rather, they only get deleted when their retention period gets over. A consumer group can access message from any stream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UtYuGeK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Event-Hub-example.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213236" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UtYuGeK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Event-Hub-example.png" alt="Event Hub example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Application Telemetry&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---jg566Ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Application-Telemetry.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213237" src="https://res.cloudinary.com/practicaldev/image/fetch/s---jg566Ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Application-Telemetry.png" alt="Application Telemetry"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above picture represents a typical message flow of a system. The idea is to feed telemetry data to Power BI through Event Hub. Message from the user would pass through various systems and also would reach Event Hub.&lt;/p&gt;

&lt;p&gt;Here, Stream Analytics and Machine learning process collect the data from Event Hub and send it to Power BI for any business analytics service.  &lt;/p&gt;

&lt;h3&gt;Demo-Event Hubs&lt;/h3&gt;

&lt;p&gt;This demo illustrates the purpose of Event Hub and is similar to Azure Service Bus messaging.&lt;/p&gt;

&lt;p&gt;On Sender Side,&lt;/p&gt;

&lt;p&gt;In the console application, we have a connection string followed by an Event Hub name (key name). In the code portion, we have&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;EventHubClient -&amp;gt; To create an instance of a client through the connection string&lt;/li&gt;
    &lt;li&gt;Client.Send -&amp;gt; To send an object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8EWl_oZs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Code.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213238" src="https://res.cloudinary.com/practicaldev/image/fetch/s--8EWl_oZs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-Code.png" alt="Demo Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On Receiver Side,&lt;/p&gt;

&lt;p&gt;In the console application, we have an “EventHubName” and also storage account followed by a &lt;a href="https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.EventProcessorHost/" rel="noopener noreferrer"&gt;ServiceBus.EventProcessorHost&lt;/a&gt; which is used to create a listener for different partitions in the Event Hub instance. In the Azure storage account, this package creates a blob for each partition to manage the index of its location in the stream.&lt;/p&gt;

&lt;p&gt;When a message is received, it will be fired to the event listed in the below piece of code,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jEHgF0aJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-code-02.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213239" src="https://res.cloudinary.com/practicaldev/image/fetch/s--jEHgF0aJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Demo-code-02.png" alt="Demo Code 02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our position in the stream can also be acknowledged so if the whole process blew up, we can simply move to the last index we read and also continue our progress. Now, we can see how the operation gets executed. As a result, Event Hub can receive and store any kind of data and events. &lt;/p&gt;

&lt;h2&gt;Fact&lt;/h2&gt;

&lt;p&gt;Service Bus team provided a cost estimation analysis for processing a billion events per day which lead to,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;12 Throughput units&lt;/li&gt;
    &lt;li&gt;12,000 events per second&lt;/li&gt;
    &lt;li&gt;720,000 events per minute&lt;/li&gt;
    &lt;li&gt;43,200,000 events per hour&lt;/li&gt;
    &lt;li&gt;Total Cost -&amp;gt; $37.67&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Service Bus Costs&lt;/h2&gt;

&lt;h3&gt;Relay:&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;10,000 listening hours=6.60 pounds&lt;/li&gt;
    &lt;li&gt;100 million messages=6.20 pounds&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;&lt;strong&gt;Messaging:&lt;/strong&gt;&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;5 million operations per month=6.20 pounds&lt;/li&gt;
    &lt;li&gt;13-100 million operations = 50pounds per million&lt;/li&gt;
    &lt;li&gt;100-2500 million = 31pounds per million&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Event Hubs:&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;100 million events = 1.72 pounds&lt;/li&gt;
    &lt;li&gt;The rate of Processing = Throughput units = 14 pounds per month per unit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;strong&gt;Service Bus + BizTalk&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;Although Service Bus and BizTalk provide connectivity in many aspects for a seamless experience, they could be more aligned in the following aspects;&lt;/p&gt;

&lt;p&gt;SB- Adapter (latest version not available)&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Service Bus Relay&lt;/li&gt;
    &lt;li&gt;Service Bus Messaging&lt;/li&gt;
    &lt;li&gt;Event Hubs-it does not provide out-of-box support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Addition of features list includes,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;AMQP Adapter- Supports non-Microsoft Service Bus type products&lt;/li&gt;
    &lt;li&gt;Event Hub Adapter&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;strong&gt;User scenarios of BizTalk+Relay&lt;/strong&gt;&lt;/h2&gt;

&lt;h3&gt;Scenario 1:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QGFbFrhO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-1.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213242" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QGFbFrhO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-1.png" alt="Scenario-1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us consider a BizTalk server hosted in Azure as a Virtual Machine needs to connect to an on-premise web service. The simplest method to do that would be through SB adapter in BizTalk.&lt;/p&gt;

&lt;p&gt;Here, BizTalk Server will send a message to Relay and the rest of the process will be carried out in WCF service.&lt;/p&gt;

&lt;h3&gt;Scenario 2:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L61DhBnk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-2.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213243" src="https://res.cloudinary.com/practicaldev/image/fetch/s--L61DhBnk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-2.png" alt="Scenario-2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we have BizTalk server on-premise followed by a SaaS application in the cloud, a communication can be established between them through Service Bus Relay.&lt;/p&gt;

&lt;p&gt;This can be achieved through Service Bus Relay or by assigning a REST API between SaaS component and the server. So, the Relay offers an easy way to expose a BizTalk endpoint from an organization.&lt;/p&gt;

&lt;h3&gt;Scenario 3:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lNXozrmk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-3.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213244" src="https://res.cloudinary.com/practicaldev/image/fetch/s--lNXozrmk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-3.png" alt="Scenario-3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us consider the scenario where two BizTalk Servers in separate companies needs to communicate. The best way to do that will be to send the message through Relay by exposing their endpoints. This flow does not require any separate infrastructure support.&lt;/p&gt;

&lt;h2&gt;User scenarios of BizTalk+Messaging&lt;/h2&gt;

&lt;h3&gt;Scenario 1:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5j0eVRdq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-4.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213245" src="https://res.cloudinary.com/practicaldev/image/fetch/s--5j0eVRdq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-4.png" alt="Scenario-4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This scenario would focus more on transferring a massive number of messages from a web application in the cloud to on-premise Server. Here, BizTalk Server pulls the messages from the queue at a manageable level.&lt;/p&gt;

&lt;h3&gt;Scenario 2:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T_WUXPPe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-5.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213246" src="https://res.cloudinary.com/practicaldev/image/fetch/s--T_WUXPPe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-5.png" alt="Scenario-5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To publish an event in pub/sub format to various receivers, we will push the message from on-premise server to a queue where the application can access it. You cannot directly link the applications to the BizTalk Server located on-premise.&lt;/p&gt;

&lt;p&gt;The key difference between Service Bus and BizTalk is that,&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;BizTalk does not support poll pattern&lt;/li&gt;
    &lt;li&gt;Service Bus does not support push pattern&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore, combining both the services would lead to dynamic productivity. The receiver can access the message available on Service Bus Topic at any time.&lt;/p&gt;

&lt;h3&gt;Scenario 3:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k5p7frj0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-6.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213247" src="https://res.cloudinary.com/practicaldev/image/fetch/s--k5p7frj0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-6.png" alt="Scenario-6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us consider a scenario where Service Bus Topic will share the resource between two BizTalk application. But if we want to delete the shared resource in the application and patch a new resource, the dependency management in BizTalk would make it harder.&lt;/p&gt;

&lt;p&gt;When the BizTalk application has to be updated, we cannot undeploy it because the subscriptions would be eliminated. Therefore, this causes overcomplexity when trying to solve it. &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Demo&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;This demo explains on combining both BizTalk and Service Bus, through which messages can be sent and also received between BizTalk applications. Most importantly, you can execute the process in JSON format.&lt;/p&gt;

&lt;p&gt;Let us assume there are three BizTalk applications (app1, app2, app3), each comprising of “Hello World” scheme followed by a unique namespace. We will have a sender in each application to receive a message from the file system, which will be routed to Service Bus through Send Ports. Furthermore, you can convert the messages to JSON format before sending it using JSON encoder.&lt;/p&gt;

&lt;p&gt;Most importantly, when we receive the message in Service Bus, it would hit the topic comprising of two subscriptions. Each subscription will forward the content to the desired queue. The Topic can specify who can send and also receive the message in it, but if there are multiple receivers, there is a probability where one receiver may fetch the message of another receiver. Hence, this problem can be solved by using “Forward to” option in Topic and can also specify which receiver should receive the appropriate message.&lt;/p&gt;

&lt;p&gt;Most importantly, the agenda is to send a message from any application to topics before it gets forward to the selected queues.&lt;/p&gt;

&lt;p&gt;After the initialization process gets over, the virtual machine will receive a message. Using the JSON decode, we will change the format of the message in the receive pipeline of the virtual machine. Finally, the respective Biztalk applications receive the message.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;User scenarios of BizTalk+Event Hub&lt;/strong&gt;&lt;/h2&gt;

&lt;h3&gt;Scenario 1:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2AU2G54K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-7.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213248" src="https://res.cloudinary.com/practicaldev/image/fetch/s--2AU2G54K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-7.png" alt="Scenario-7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here Event Hubs forwards the messages to BizTalk server after processing from event processor host. If the scenario does not involve a huge number of messages to forward to BizTalk server, then the event processor host will act as an isolated BizTalk host without any adapter for a smoother transition.&lt;/p&gt;

&lt;h3&gt;Scenario 2:&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFpO0p7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-8.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-80213249" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFpO0p7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/08/Scenario-8.png" alt="Scenario-8"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this scenario, you share the telemetry data and logging information with Service Bus Event Hub when a message flows through the pipeline of BizTalk server. Most importantly, powerful analysis machines like Power BI and also Cortana Analytics make use of the telemetry data from Service Bus.&lt;/p&gt;

&lt;h2&gt;Wrap up&lt;/h2&gt;

&lt;p&gt;This blog gives an overview of various Service Bus components available with demo scenarios for a better understanding of the audience. There are a lot of features available in Azure Service Bus and also more to come soon.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
    </item>
    <item>
      <title>How To Build A Reactive Solution With Azure Event Grid</title>
      <dc:creator>Surya Venkat</dc:creator>
      <pubDate>Wed, 14 Aug 2019 06:10:59 +0000</pubDate>
      <link>https://forem.com/suryavenkat_v/how-to-build-a-reactive-solution-with-azure-event-grid-a8k</link>
      <guid>https://forem.com/suryavenkat_v/how-to-build-a-reactive-solution-with-azure-event-grid-a8k</guid>
      <description>&lt;p&gt;Author Credits: &lt;a href="https://www.serverless360.com/blog/author/steef"&gt;Steef-Jan Wiggers&lt;/a&gt;, Azure MVP&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://www.serverless360.com/blog"&gt;Serverless360 Blogs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Azure &lt;span&gt;&lt;a href="https://azure.microsoft.com/en-us/services/event-grid/" rel="noopener noreferrer"&gt;Event Grid&lt;/a&gt;&lt;/span&gt; was the missing piece for messaging in the cloud. Instead of extensive polling or ‘hammer-polling,’ a very resource intensive process, you now get ‘tap on the shoulder’ – here’s an event ‘an image is available for processing.’ Event Grid is a service in Azure that enables central management of events. It provides intelligent routing with filters and standardizes on an &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/event-grid/event-schema" rel="noopener noreferrer"&gt;event schema&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Event Grid&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;With Event, Grid offers a mechanism for reactive event handling. An application can subscribe to events and handle them accordingly – for instance, handle events like storage blob events, provisioning notifications in an Azure subscription, IoT device signals, or even custom event.&lt;/p&gt;

&lt;p&gt;Event Grid handles events, not messages. A message has an intent and requires an action – for instance, an order that needs to be fulfilled. An event is a fact, something that has happened and you can react to it or not. Hence there is a clear distinction between messaging and events. Thus, there are services for both available in the Azure Platform - Clemens Vasters explains this in the blog post from last year: &lt;a href="https://azure.microsoft.com/en-us/blog/events-data-points-and-messages-choosing-the-right-azure-messaging-service-for-your-data/" rel="noopener noreferrer"&gt;&lt;span&gt;Events, Data Points, and Messages&lt;/span&gt; - &lt;span&gt;Choosing the right Azure messaging service for your data&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Pub-Sub Model&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;The concept of Azure Event Grid is simple – it is a pub-sub model. An event source pushes events to Azure Event Grid, and event handlers subscribe to events. An event source or publisher - an Azure service like Storage, IoT Hub, or a third party source emits an event, for instance, &lt;strong&gt;blobCreated&lt;/strong&gt; or &lt;strong&gt;blobDeleted&lt;/strong&gt;. You can send the event to a topic.  Each topic can have one or multiple subscribers (event handlers).  You can configure an Azure Service, if supported, as an event publisher or you create a custom Azure Event Grid Topic. Subsequently, the event handlers in Azure like Functions, WebHook, and Event Hubs can react to the events and process them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QFuaq7jN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Event-Grid-concepts.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-116" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QFuaq7jN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Event-Grid-concepts.png" alt="It is a pub-sub model. An event source pushes events to Azure Event Grid, and event handlers subscribe to events."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pub-sub model of Azure Event Grid is not similar to service bus Topics and subscriptions. Moreover, Topics and subscription are push-pull, while Azure Event Grid is push-push. Furthermore, there are other differences too, as shown in the picture below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PR1uWh8l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Cloud-Pub-Sub-Models.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-117" src="https://res.cloudinary.com/practicaldev/image/fetch/s--PR1uWh8l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Cloud-Pub-Sub-Models.png" alt="Pub-sub model of Azure Event Grid is not similar to service bus Topics and subscriptions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Consider a function listening to a blob storage container and each time a new blob is created it will send a message to a message queue. Subsequently, you can listen to the queue with another function, process the blob with the function and call two other functions (or place a queue between that function and the other two functions). The diagram below shows how pull-push would work using a Service Bus Queue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2MZHlxHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-3.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-130" src="https://res.cloudinary.com/practicaldev/image/fetch/s--2MZHlxHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-3.png" alt="pull-push would work using a Service Bus Queue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Event Grid, you can have a different approach as shown in the diagram below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nWx6KbYT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-4.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-132" src="https://res.cloudinary.com/practicaldev/image/fetch/s--nWx6KbYT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-4.png" alt="With Event Grid, you can have a different approach"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view Event Grid as the backbone of event-driven computing in Microsoft Azure - and it brings a few benefits to the enterprise. With the push-push pub-sub model you can be more efficient with resources. Event Grid delivers besides efficiency:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Native integrations (point and click) in a serverless way;&lt;/li&gt;
    &lt;li&gt;Fan out to multiple places;&lt;/li&gt;
    &lt;li&gt;Reliable delivery of events within 24 hours;&lt;/li&gt;
    &lt;li&gt;Intelligent routing of events with types and filters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These benefits will become apparent in this blog post.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Reversal of dependencies&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;With Event Grid in Azure, you can use as a developer can or adopt reverse dependencies in an existing cloud solution – where services are supporting business processes by depending on each other. In this type of solution, each service has some logic to communicate with others across the architecture. Moreover, the solution or architecture becomes complex or spaghetti of services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hdVmBYt5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-5.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-133" src="https://res.cloudinary.com/practicaldev/image/fetch/s--hdVmBYt5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-5.png" alt="with leveraging Event Grid, you can loosen these dependencies by making the services more event-driven. "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, with leveraging Event Grid, you can loosen these dependencies by making the services more event-driven. The services communicate by pushing events to a central place, i.e., Event Grid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CTOPmQ34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-6.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-134" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CTOPmQ34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Building-reactive-solution-with-Azure-Event-Grid-Picture-6.png" alt="By pushing events to a central place you fundamentally unify the communication between services."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By pushing events to a central place you fundamentally unify the communication between services. Tom Kerhove discusses this in his blog &lt;span&gt;&lt;a href="https://blog.tomkerkhove.be/2017/08/22/exploring-azure-event-grid/" rel="noopener noreferrer"&gt;Exploring Event Grid&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Toll booth Scenario&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;A typical use-case or sample of Event Grid is processing an image leveraging the Vision API. Azure Blob Storage emits an event &lt;strong&gt;blobCreated&lt;/strong&gt;, which is subsequently handled by a function or Logic App subscribing to that event. In the following scenario, the event grid plays a crucial role in handling &lt;strong&gt;blobCreated&lt;/strong&gt; events where several functions subscribe to that event.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PC5CwDb0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Toll-booth-license-plate-recognition-scenario.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-122" src="https://res.cloudinary.com/practicaldev/image/fetch/s--PC5CwDb0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Toll-booth-license-plate-recognition-scenario.png" alt="Azure Event Grid and its Toll booth Scenario"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above scenario, a camera registers every car going through a toll booth. The picture of the vehicle includes a license plate. These images are uploaded in batches to an Azure Storage account – configured as event publisher. Every image is stored as a blob and thus results in an event being emitted to the Event Grid topic. Subsequently, several functions subscribe to the events:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;A function to push the blob (image) to a Computer Vision API – extracting license plate number through Optical Character Recognition (OCR) feature. The function will push the result as an event to another Event Grid Topic.&lt;/li&gt;
    &lt;li&gt;A Function to save the license plate (the result of the Vision API) to Cosmos DB.&lt;/li&gt;
    &lt;li&gt;A Function to save a reference of the image in the storage account to Cosmos DB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above scenario shows how a developer can build several functions to handle the events. Moreover, the developer is a part of making reactive components, i.e., functions (tasks) in this case. The process of managing events (car passing a toll booth) is through a loosely coupled, scalable, and serverless type of solution. In the following paragraphs, we will further discuss some of the critical concepts of Event Grid with the given scenario.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Azure Event Grid Schema&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;The events in Event Grid adhere to a predefined schema – a JSON schema with several properties. Furthermore, events are sent as a JSON array to Event Grid with a maximum size of 1 MB – each event in the array is limited to 64 KB. In case you send an array of an event exceeding the limits – you will receive the HTTP response 413 Payload Too Large. Note that even a single event is sent as an array.&lt;/p&gt;

&lt;p&gt;The following schema shows the properties of an event:&lt;/p&gt;

&lt;pre class="lang:default decode:true "&gt;[
 {
  "topic": string,
  "subject": string,
  "id": string,
  "eventType": string,
  "eventTime": string,
  "data":{
  object-unique-to-each-publisher
  },
  "dataVersion": string,
  "metadataVersion": string
 }
]&lt;/pre&gt;

&lt;p&gt;For example, the schema published for an Azure Blob storage event in our scenario:&lt;/p&gt;

&lt;pre class="lang:default decode:true "&gt;[{
"topic": "/subscriptions/0bf166ac-9aa8-4597-bb2a-a845afe01415/resourceGroups/RG_LicensePlates_Demo/providers/Microsoft.Storage/storageAccounts/licenseplatesstorage",
"subject": "/blobServices/default/containers/images/blobs/LicensePlate1.png",
"eventType": "Microsoft.Storage.BlobCreated",
"eventTime": "2018-06-05T08:35:26.2778593Z",
"id": "2c6f7c22-201e-00b7-0aa8-fca7ce06e319",
"data": {
"api": "PutBlob",
"clientRequestId": "32a51839-6bf5-44d6-acfe-7d284229988c",
"requestId": "2c6f7c22-201e-00b7-0aa8-fca7ce000000",
"eTag": "0x8D5CABF497519C6",
"contentType": "application/octet-stream",
"contentLength": 41860,
"blobType": "BlockBlob",
"url": "https://licenseplatesstorage.blob.core.windows.net/images/LicensePlate1.png",
"sequencer": "000000000000000000000000000008BC0000000003fd850f",
"storageDiagnostics": {
"batchId": "fbb4e831-82b2-4e64-b0e5-0735449f9cb7"
}
},
"dataVersion": "",
"metadataVersion": "1"
}]&lt;/pre&gt;

&lt;p&gt;The image processing function in our scenario can handle the event and use the URL in the data payload to download the image from the storage account container. The Rest Call pushes the downloaded image to the Computer Vision endpoint. Finally, this function will read the JSON result and push to another Event Grid topic as an event.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ErWoIIws--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Tollbooth-license-plate-recognition-scenario1.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-123" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ErWoIIws--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Tollbooth-license-plate-recognition-scenario1.png" alt="SON result and push to another Event Grid topic as an event."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;The security of Event Grid consists of several parts. The first part is the Role-based Access Control (RBAC) on the Event Grid resource - where the person creating a new subscription needs to have the &lt;strong&gt;Microsoft.EventGrid/EventSubscriptions/Write&lt;/strong&gt; permissions. Second, there is a validation on WebHooks – the first and foremost mechanism for listening to events – every newly registered WebHook needs to be validated by Event Grid first. This is what is implicitly happening when creating subscriptions to events in an event resource like Storage Account V2 – you can hook events to a Function or Logic App using the events feature in the storage account. In our scenario, the arrangement of subscriptions to events is implicit.&lt;/p&gt;

&lt;p&gt;In case you want to subscribe to events using custom code, i.e., the on-premise client you will need to respond to the validation token the Event Grid will send out. The validation request Event Grid will send to the client will look like below:&lt;/p&gt;

&lt;pre class="lang:default decode:true "&gt;[{
"id": "2d1781af-3a4c-4d7c-bd0c-e34b19da4e66",
"topic": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"subject": "",
"data": {
"validationCode": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6"
},
"eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
"eventTime": "2018-01-25T22:12:19.4556811Z",
"metadataVersion": "1",
"dataVersion": "1"
}]&lt;/pre&gt;

&lt;p&gt;The client will respond with the validation code in the response with a 200-OK. If you want to send custom events, use SAS tokens or key authentication to publish an event to a topic. For more details on security and authentication of Event Grid, see &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/event-grid/security-authentication" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/event-grid/security-authentication&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Guaranteed delivery of events&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;A key aspect of the scenario is the guaranteed delivery of events. The default behavior of Event Grid is that it will try at least once to deliver the event and retry using exponential backoff - Event Grid will keep on sending events to the Event Handler until it acknowledges the request with either an HTTP 200 OK or HTTP 202 Accepted. The back-off mechanism will use progressively longer waits between retries for following error responses. Furthermore, it will last until 24 hours have passed - after 24 hours the Event Grid will delete the event. See also &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/event-grid/delivery-and-retry" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/event-grid/delivery-and-retry&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Fan-in fan-out Scenario&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;You can view Event Grid as serverless that is you do not have to manage any infrastructure, you pay per operation, and Microsoft handles the scaling for you. Event Grid leverages Service Fabric under the hood and thus scales when the workload increases.&lt;/p&gt;

&lt;p&gt;Event Hubs and Event Grid together work seamlessly in ingestion (fan-in) and push (fan-out) scenarios. Both scale easily when workloads increases and do not require you manage infrastructure. In the following situation, the capture feature will send the wind farm data (per turbine) to the event hub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KcyvfDi---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Ingestion-and-migration-of-event-data.png" class="article-body-image-wrapper"&gt;&lt;img class="alignnone size-full wp-image-124" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KcyvfDi---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://serverless360.wpengine.com/wp-content/uploads/2018/07/Ingestion-and-migration-of-event-data.png" alt="Azure Event Grid and its fan-in and fan-out scenario"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-capture-overview" rel="noopener noreferrer"&gt;Event Hubs Capture&lt;/a&gt; &lt;/span&gt;pulls the data from the stream of windfarm data and generates storage blobs with the data in &lt;span&gt;&lt;a href="https://en.wikipedia.org/wiki/Apache_Avro" rel="noopener noreferrer"&gt;Avro&lt;/a&gt;&lt;/span&gt; format. Subsequently, when Capture creates the blob (1), the blobCreated event is generated and emitted to Event Grid (2). Subscribers to the event will receive it and handle it accordingly, in this case, an Azure Function (3) will get the event. Furthermore, the function will retrieve the file (URL to the Avro file) from the blob storage (4) and store it into a SQL Data Warehouse (5). This sample is available on the Microsoft docs: &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-gb/azure/event-grid/event-grid-event-hubs-integration" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-gb/azure/event-grid/event-grid-event-hubs-integration&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Wrap up&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;This blog discusses Event Grid scenarios where Event Grid plays a central role, and how developers can leverage this service. Another scenario showed how Event Grid could collaborate with Event Hubs in high volume ingestion and migration of event data.&lt;/p&gt;

&lt;p&gt;Event Grid is globally available in several Azure regions of the U.S., Europe, and Asia, with more to come soon. For pricing of Event Grid, details see the &lt;span&gt;&lt;a href="https://azure.microsoft.com/en-us/pricing/details/event-grid/" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;&lt;/span&gt;. Furthermore, the full documentation on the Azure Event Grid service is available on the &lt;span&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/event-grid/" rel="noopener noreferrer"&gt;Microsoft Documentation site&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>eventgrid</category>
    </item>
    <item>
      <title>Exposing Azure Services using Azure API Management</title>
      <dc:creator>Surya Venkat</dc:creator>
      <pubDate>Mon, 05 Aug 2019 12:37:31 +0000</pubDate>
      <link>https://forem.com/suryavenkat_v/exposing-azure-services-using-azure-api-management-50k</link>
      <guid>https://forem.com/suryavenkat_v/exposing-azure-services-using-azure-api-management-50k</guid>
      <description>&lt;p&gt;Originally Published at &lt;a href="http://bit.ly/2Ke92I6"&gt;Serverless360 Blogs&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure API Management
&lt;/h2&gt;

&lt;p&gt;With Azure API Management we can expose our services in a managed way, allowing to take control through policies, add security, gain insights, provide decoupling between frontend and backend, and much more. &lt;a href="https://docs.microsoft.com/en-us/azure/api-management/api-management-key-concepts"&gt;API Management&lt;/a&gt; enables us to create a service repository, where we can expose all our services to clients, which can quickly start using these – thanks to the documentation and testing capabilities presented by the &lt;a href="https://docs.microsoft.com/en-us/azure/api-management/api-management-key-concepts?irgwc=1&amp;amp;OCID=AID2000142_aff_7593_1243925&amp;amp;tduid=(ir__ou9wk0pcqgkfrxdpxmdf30kppu2xjrpnj3bwoehe00)(7593)(1243925)(je6NUbpObpQ-Ym49p.VvpJmUxoOTRCZJZA)()&amp;amp;irclickid=_ou9wk0pcqgkfrxdpxmdf30kppu2xjrpnj3bwoehe00#developer-portal?ranMID=24542&amp;amp;ranEAID=je6NUbpObpQ&amp;amp;ranSiteID=je6NUbpObpQ-Ym49p.VvpJmUxoOTRCZJZA&amp;amp;epi=je6NUbpObpQ-Ym49p.VvpJmUxoOTRCZJZA"&gt;developer portal&lt;/a&gt;. By implementing various of the available policies, we can enrich our services with capabilities like caching, throttling, advanced security, and even protocol and data translations. In short, API Management gives the option to create a complete ecosystem around our services, including everything from development and publishing to customization and monitoring.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dRiuxIm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/API-Management-Overview.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dRiuxIm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/API-Management-Overview.png" alt="API Management Overview" width="880" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This gives us various possibilities around exposing our services, not only in the cloud but on-premises as well. Moreover, we can also present several of our Azure services this way. Some of these can be exposed in API Management out of the box, like API Apps or Logic Apps, but as the other Azure services also provide REST endpoints, we can use these as well. This way, we can easily publish a large variety of services to our clients through a single repository, with a homogenous experience to consume all these different services.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exposing services
&lt;/h2&gt;

&lt;p&gt;All of this starts by creating an API management instance, which is used to publish our services. If you haven’t done so yet, follow these instructions to create your own. During this blog post, we will assume you have API Management set up, including the basics like users, groups, and products. When we add a new API to API management, we will find that there are several different options to do this. Some of these will be discussed in the following paragraphs, while others provide the capability to add our own services running outside of Azure. For example, an API with an OpenAPI specification, which is the successor of Swagger, can be added through here. You just point to the location of you’re the OpenAPI definition, and API Management will pull in all information around the operations, messages, etc. Another option is to load an API from a WSDL, allowing to even expose SOAP services. Consequently, the SOAP service can then be exposed directly, however, we even have the option to expose this as a REST API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p6UldNxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Create-new-API-in-API-Management.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p6UldNxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Create-new-API-in-API-Management.png" alt="Create new API in API Management" width="880" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API Apps
&lt;/h2&gt;

&lt;p&gt;Now let’s have a look at the various options for presenting our Azure services through API Management. Besides the options to load definitions like OpenAPI, WADL or WSDL, we also have the opportunity to load several of the Azure services directly. The first example of this is API Apps, which allow to build and host RESTful services in Azure. By choosing the API Apps option on the Add a new API screen, we will be presented with an overview of all API Apps available in our subscription.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XrUNYXOq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Add-API-App.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XrUNYXOq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Add-API-App.png" alt="Add API App" width="880" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can just select one of the API Apps, update the names and suffix if required, and the API definition will be created in our API Management. Altogether, it took us only a few seconds to add the API App through API Management, where we can now configure it as desired, like adding additional policies or security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S1C5Oa3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/API-App-imported.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S1C5Oa3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/API-App-imported.png" alt="API App imported" width="880" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Logic Apps
&lt;/h2&gt;

&lt;p&gt;Similarly, we can also use API Management to expose our Logic Apps to our consumers. This does require the Logic App to be triggered using an HTTP based trigger like the Request trigger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l328trBs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Logic-App-HTTP-Request-Trigger.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l328trBs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Logic-App-HTTP-Request-Trigger.png" alt="Logic App HTTP Request Trigger" width="602" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we choose to add a Logic App from API Management, we will find an overview of all the Logic Apps which are usable in this manner. Once again, this allows us to quickly and easily publish another Azure service through API Management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;Next, we have Azure Functions, which once again can be imported from the Add a new API screen. Important to note here is that to expose a Function through API Management, the Function needs to use an HTTP trigger, and the authorization needs to be on an anonymous or function level. Additionally, it’s even possible to select multiple Functions inside a single Function App, which will then all be exposed through the same API in API Management as different operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UH3nFBQm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Add-Multiple-Functions.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UH3nFBQm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Add-Multiple-Functions.png" alt="Add Multiple Functions" width="553" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Bus
&lt;/h2&gt;

&lt;p&gt;We now have seen how to expose various services directly through the API Management user interface, but how about services which do not offer this option? Luckily, we can leverage the REST endpoints of these services. For example, Service Bus offers &lt;a href="https://docs.microsoft.com/en-us/rest/api/servicebus/service-bus-runtime-rest?ranMID=24542&amp;amp;ranEAID=je6NUbpObpQ&amp;amp;ranSiteID=je6NUbpObpQ-lEdPCeehVSZmNaVM__Rr.A&amp;amp;epi=je6NUbpObpQ-lEdPCeehVSZmNaVM__Rr.A&amp;amp;irgwc=1&amp;amp;OCID=AID2000142_aff_7593_1243925&amp;amp;tduid=(ir__ou9wk0pcqgkfrxdpxmdf30kppu2xjrpntfbwoehe00)(7593)(1243925)(je6NUbpObpQ-lEdPCeehVSZmNaVM__Rr.A)()&amp;amp;irclickid=_ou9wk0pcqgkfrxdpxmdf30kppu2xjrpntfbwoehe00"&gt;various endpoints&lt;/a&gt;, which we can use to send and retrieve messages to queues and topics. Service Bus does, however, require us to use a WRAP token to authenticate against the service. In API Management we can leverage a policy to expose the Service Bus entities, allowing our clients to, for example, send in messages over HTTP, without them needing to know all details about how to create a WRAP token. To do this, we will create a blank API in API Management using our service namespace URI as the Service URI (f.e. &lt;a href="https://yournamespace.servicebus.windows.net/"&gt;https://yournamespace.servicebus.windows.net/&lt;/a&gt;), and then add a new POST operation to the API. Next, we open the policy editor for the inbound processing of the operation, where we will set up the policies needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LDXI676n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Edit-Inbound-Processing-Policy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LDXI676n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://www.serverless360.com/wp-content/uploads/2018/10/Edit-Inbound-Processing-Policy.png" alt="Edit Inbound Processing Policy" width="880" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The policies we need to set up will set the necessary headers while using variables to pass in the needed data. As you will find, we will execute some C# code from the policy to set the Authorization header, which is needed since we need to calculate some of the values expected in this header. Remember, the SAS key should be created in Service Bus with the correct permissions, like send or listen.&lt;/p&gt;

&lt;pre&gt;&amp;lt;policies&amp;gt;

    &amp;lt;inbound&amp;gt;

        &amp;lt;base /&amp;gt;

        &amp;lt;set-variable name="resourceUri" value="https://yournamespace.servicebus.windows.net/yourqueuename" /&amp;gt;

        &amp;lt;set-variable name="sasKeyName" value="yoursaskeyname" /&amp;gt;

        &amp;lt;set-variable name="sasKey" value="yoursaskeyvalue" /&amp;gt;

        &amp;lt;set-header name="Authorization" exists-action="override"&amp;gt;

            &amp;lt;value&amp;gt;@{

// Load variables

string resourceUri = (string) context.Variables.GetValueOrDefault("resourceUri");

string sasKeyName = (string) context.Variables.GetValueOrDefault("sasKeyName");

string sasKey = (string) context.Variables.GetValueOrDefault("sasKey");

// Set the token lifespan

System.TimeSpan sinceEpoch = System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1));

var expiry = System.Convert.ToString((int)sinceEpoch.TotalSeconds + 60); //1 minute

string stringToSign = System.Uri.EscapeDataString(resourceUri) + "\n" + expiry;

System.Security.Cryptography.HMACSHA256 hmac = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(sasKey));

var signature = System.Convert.ToBase64String(hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes(stringToSign)));

// Format the sas token

var sasToken = String.Format("SharedAccessSignature sr={0}&amp;amp;sig={1}&amp;amp;se={2}&amp;amp;skn={3}",

System.Uri.EscapeDataString(resourceUri), System.Uri.EscapeDataString(signature), expiry, sasKeyName);return sasToken;

}&amp;lt;/value&amp;gt;

        &amp;lt;/set-header&amp;gt;

        &amp;lt;set-backend-service base-url="https:// yournamespace.servicebus.windows.net/" /&amp;gt;

    &amp;lt;/inbound&amp;gt;

    &amp;lt;backend&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/backend&amp;gt;

    &amp;lt;outbound&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/outbound&amp;gt;

    &amp;lt;on-error&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/on-error&amp;gt;

&amp;lt;/policies&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now when we save the policy, we can use API Management to pass in any message, which then places these in the specified queue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blob Storage
&lt;/h2&gt;

&lt;p&gt;Similarly, we can expose Azure Blob Storage using API Management as well. In this case, we can use API Management to expose a storage container, allowing us to have clients send messages which are then created as a blob inside the container. We will also use some C# code here to calculate the Authorization header.&lt;/p&gt;

&lt;pre&gt;&amp;lt;policies&amp;gt;

    &amp;lt;inbound&amp;gt;

        &amp;lt;set-variable name="UTCNow" value="@(DateTime.UtcNow.ToString("R"))" /&amp;gt;

        &amp;lt;set-variable name="ContainerName" value="@(context.Request.Headers.GetValueOrDefault("Container"))" /&amp;gt;

        &amp;lt;set-variable name="BlobName" value="@(context.Request.Headers.GetValueOrDefault("Blob"))" /&amp;gt;

        &amp;lt;base /&amp;gt;

        &amp;lt;set-header name="Authorization" exists-action="override"&amp;gt;

            &amp;lt;value&amp;gt;@{

                    string storageAccount = " yournamespace ";

                    string storageKey = "yourstoragesaskeyvalue";

                    string containerName = context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("ContainerName");

                    string blobName = context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("BlobName");

                    string contentLength = context.Request.Headers.GetValueOrDefault("Content-Length");

                    string ContentType = context.Request.Headers.GetValueOrDefault("Content-Type");

                    string dateToSign = context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("UTCNow");

                    string headerResource = $"x-ms-blob-type:BlockBlob\nx-ms-date:{dateToSign}\nx-ms-version:2016-05-31";

                    string urlResource = $"/{storageAccount}/{containerName}/{blobName}";

                    var stringToSign = string.Format("PUT\n\n\n{0}\n\n{1}\n\n\n\n\n\n\n{2}\n{3}",contentLength,ContentType,headerResource,urlResource);

                    HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(storageKey));

                    string signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));

                    string authorizationHeader = String.Format("{0} {1}:{2}", "SharedKey", storageAccount, signature);

                    return authorizationHeader;

                }&amp;lt;/value&amp;gt;

        &amp;lt;/set-header&amp;gt;

        &amp;lt;set-header name="x-ms-date" exists-action="override"&amp;gt;

            &amp;lt;value&amp;gt;@(context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("UTCNow"))&amp;lt;/value&amp;gt;

        &amp;lt;/set-header&amp;gt;

        &amp;lt;set-header name="x-ms-version" exists-action="override"&amp;gt;

            &amp;lt;value&amp;gt;2016-05-31&amp;lt;/value&amp;gt;

        &amp;lt;/set-header&amp;gt;

        &amp;lt;set-header name="x-ms-blob-type" exists-action="override"&amp;gt;

            &amp;lt;value&amp;gt;BlockBlob&amp;lt;/value&amp;gt;

        &amp;lt;/set-header&amp;gt;

        &amp;lt;set-backend-service base-url="@{

            string containerName = context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("ContainerName");

            string blobName = context.Variables.GetValueOrDefault&amp;lt;string&amp;gt;("BlobName");

            return String.Format("https://yournamespace.blob.core.windows.net/{0}/{1}", containerName, blobName);

        }" /&amp;gt;

    &amp;lt;/inbound&amp;gt;

    &amp;lt;backend&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/backend&amp;gt;

    &amp;lt;outbound&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/outbound&amp;gt;

    &amp;lt;on-error&amp;gt;

        &amp;lt;base /&amp;gt;

    &amp;lt;/on-error&amp;gt;

&amp;lt;/policies&amp;gt;&lt;/pre&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As we have seen, API Management allows us to easily expose our Azure services, both out of the box or by making use of policies. We can now assign the various APIs we created in API Management to our products, which expose them to the clients. As the consumers won’t need to know anything about the underlying services, they can consume the exposed APIs in a consistent manner over HTTP, using a single key, and from a single repository. In the meantime, we gain the advantage of advanced insights into the usage of the services and can apply all the capabilities provided by API Management, like additional security and advanced policies.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>logicapps</category>
      <category>serverless</category>
      <category>servicebus</category>
    </item>
  </channel>
</rss>
