This repository contains a sample project for Azure Service Fabric, the next-generation platform as a service offering from Microsoft.
This document walks you through how to deploy a the Predict Backend application, which demonstrates how to integrate the real time flow of orders from an e-commerce site and leverage Service Fabric to provide Stock Trend predictions. The following key concepts are demonstrated in this sample:
Visual Studio 2015
Before starting, make sure you have the Service Fabric development environment setup on your machine. Detailed instructions on how to setup the development environment can be found here https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-get-started/
This solution is built against Service Fabric 188.8.131.5294 (install using web platform installer by searching for “Service Fabric”) Note - For full end to end run you will need to set up the Azure ML dependency, but the sample runs with “random” data generated to improve the F5 experience. Please see “Setting up the Azure ML Dependency” if you want to deploy the full version including the back end Azure ML Service.
Download the source and verify that you can build it in your local development environment by right clicking the DataStreaming solution and selecting Rebuild Solution. The solution uses the NuGet package manager to download and install its dependencies automatically.
Deploying the Solution to a Service Fabric Cluster - Right click on the PredictiveBackend Service Fabric application and select Publish - Select either your local cluster or your cloud deployment (requires that you have access to an Azure based Service fabric cluster). For the purposes of these instructions we’ll assume you are deploying to a local dev box Service Fabric cluster - Click Publish and validate the application deploys successfully. - Open Service Fabric Explorer and validate that the cluster and the PrectiveBackendType application and all sub-services are healthy
Open DataStreaming\Tests\PublicGateway.Test\bin\x64\Debug and run PublicGateway.Test.exe. If you run it with no command line argument parameters in a command prompt window it provides instructions on how to run it in one of 3 modes
Purchase: place orders over the Web API Controller
Reorder: reorder specified stock
Stream: Uses web sockets to place orders
Once the solution is deployed we provide two views implemented using Angular and hosted in the PublicGateway stateless service
- Products in stock - Real time updates http://localhost:3251/ - Aggregated view of stock trend predictions http://localhost:3251/StockAggregator.html note there is a link to this from the main page
The default implementation of the AzureML client is a mocked out implementation that generates a random value. This setting is determined by the file: src\DataStreaming\StockTrendPredictionActor\PackageRoot\Config\Settings.xml
if you open this file you should see a section AzureML, which contains Parameter Client with value "Mocked". If you change this value to "Azure" then you will also need to update the following two values AzureMlApiUrl AzureMlKey
This section will talk you through how to set up the fully functioning Azure ML model that this sample can integrate with
Azure Machine Learning is a useful tool to make predictions from your data. It provides a managed cloud based solution for predictive analytics solutions that is both easy to use and incredibly powerful. We have provided a sample experiment to use as part of this E-Commerce example that will make predictions on whether stock should be re-ordered based on historical consumption rates and stock levels amongst other features. To set this up perform the following steps