internal void OnVehicleSubscription(SubscriptionEventArgs eventArgs) { VehicleSubscription?.Invoke(this, eventArgs); }
public Task Add(VehicleSubscription value) => Task.FromResult(_storage[value.Id] = value);
public static Task SubscribeEvents(this IServiceBusListenerFactory listener, IStatusCache statusCache, VehicleSubscription vehicleSubscription) => listener.Create() .SubscribeVehicleInfo(t => statusCache.Update(t.Id, t)) .SubscribeVehicleInfo(vehicleSubscription.Send);
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, IServiceBusListenerFactory listenerFactory, IStatusCache statusCache, VehicleSubscription vehicleSubscription) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseAuthentication(); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"client-build")), RequestPath = new PathString(@"/client-build") }); app.UseSignalR(routes => routes.MapHub <VehicleHub>("/vehicleHub")); app.UseMvc(); lifetime.ApplicationStarted.Register(() => listenerFactory.SubscribeEvents(statusCache, vehicleSubscription)); }