Azure Stream Analytics - A Simple Proof-Of-Concept
Contents
In my last post I gave a high level overview of the CallStats proof-of-concept app that I built using Azure Stream Analytics, in this post I’m going to explain how to get it running for yourself.
Prerequisites
You will need an Azure subscription with the Stream Analytics preview enabled.
Setting up Service Bus
The first step is to configure some Event Hubs, these will be the ingest and output for Stream Analytics.
- From the Azure portal (http://manage.windowsazure.com) create a new Service Bus namespace, (make a note of this, as you will need it when configuring the projects).
- Create a new Event Hub called CallStatsIn with 8 partitions
- Create a shared access policy with the Manage, Send and Listen permissions
- Make a note of the connection string for this policy
- Create another Event Hub, this time called CallStatsOut with 8 partitions
- Create a shared access policy with the Manage, Send and Listen permissions
- Make a note of the policy name and the primary key
Setting up Stream Analytics
The next step is to configure a new Stream Analytics job
- From the Stream Analytics section in the Azure portal create a new job, you can call it whatever you like
- Select the Input tab, and create a new event hub input called CallStatsIn specifying JSON as the serialization format
- Select the Output tab and create a new event hub output called CallStatsOut, specifying JSON as the serialization format
- Select the Query tab, and paste the following query:
|
|
Setting up the Solution
Download my sample solution from GitHub (https://github.com/kzhen/StreamAnalytics/archive/master.zip).
- Open in Visual Studio (as an administrator)
- Open the App.config file in the Consumer project
- Set ServiceBus.Namespace to the namespace you created above
- Set ServiceBus.KeyName to the name of the shared access policy for CallStatsOut Event Hub
- Set ServiceBus.Key to the Primary Key for the CallStatsOut Event Hub
- Open the App.config file in the CallProducer project
- Set Microsoft.ServiceBus.ConnectionString to the connection string for the CallStatsIn Event Hub
Running the Solution
Build the solution then start each project. You should see output in each of the console projects and the graph on the webpage should start updating
🍪 I use Disqus for comments
Because Disqus requires cookies this site doesn't automatically load comments.
I don't mind about cookies - Show me the comments from now on (and set a cookie to remember my preference)