public ActionResult Index() { this.ViewBag.CenterLatitude = MappyData.Constants.SeattleLatitude; this.ViewBag.CenterLongitude = MappyData.Constants.SeattleLongitude; this.ViewBag.MapsId = AzureUtilities.FromConfiguration("OpenStreetMapId"); this.ViewBag.MapsAccessToken = AzureUtilities.FromConfiguration("OpenStreetMapAccessToken"); return(View()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // Fire and forget // Start the factory based on a configuration entry, and have the callback just send the incoming points through our SignalR hub. RoutePointSourceFactory.StartAsync(AzureUtilities.FromConfiguration("RoutePointSource"), pt => RouteHub.Send(RouteHub.Hub(), pt.UserID, (float)pt.Latitude, (float)pt.Longitude)); // Note the casts to floats - SignalR seems to have issues sending doubles to Javascript, possibly because JS doesn't support that precision. }
static void WriteToEventHub() { var ehConnStr = AzureUtilities.ServiceBusConnectionString( AzureUtilities.FromConfiguration("MappyServiceBusNamespace"), AzureUtilities.FromConfiguration("MappyEventHubSASName"), AzureUtilities.FromConfiguration("MappyEventHubSASKey")); var eventHubName = AzureUtilities.FromConfiguration("MappyEventHubName"); var eventHubClient = EventHubClient.CreateFromConnectionString(ehConnStr, eventHubName); new RandomRoutePointSource(pt => { Console.WriteLine("Sending {0}", pt); var data = new EventData(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(pt))); data.PartitionKey = pt.UserID; eventHubClient.Send(data); }).StartAsync().Wait(); }