public static Task SubscribeEvents(this IServiceBusListenerFactory listener, IStatusCache statusCache, VehicleSubscription vehicleSubscription)
 => listener.Create()
 .SubscribeVehicleInfo(t => statusCache.Update(t.Id, t))
 .SubscribeVehicleInfo(vehicleSubscription.Send);
 public static Task SubscribeEvents(this IServiceBusListenerFactory serviceBus, VehicleService vehicleService)
 => serviceBus.Create().SubscribeVehicleTrackSubscribe(t => vehicleService.Add(t.Ids));
Exemplo n.º 3
0
        // 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));
        }
 public static Task SubscribeEvents(this IServiceBusListenerFactory listener, IVehicleService vehicleService)
 => listener.Create().SubscribeVehicleTrackRequest(vehicleService.Ping);
Exemplo n.º 5
0
        // 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 listener, VehicleService vehicleService)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
            lifetime.ApplicationStarted.Register(() =>
            {
                vehicleService.StartJob();
                listener.SubscribeEvents(vehicleService);
            });
        }