Paul Wheeler paul@paulwheeler.com
Solutions Architect at Martus Solutions
@PaulWheeler
https://github.com/pwhe23/RiotHangfireDemo
- Hangfire - BackgroundTask processing (SQL Server)
- Riot.js - custom-tag based html/js UI
- Asp.net Identity - User authorization
- SimpleInjector - IoC container
- Routemeister - dispatches handlers for commands
- SignalR - push notifications from server to client
- Entity Framework - QueueItem, User tables
- Supports: Asp.net, web apps, console apps, Windows services, etc
- Job Types: Fire-and-forget, delayed, and recurring
- Cancellation: IJobCancellationToken.ThrowIfCancellationRequested()
- Best Practices: methods small and simple, re-entrant, app always running
- Client - BackgroundJobClient instance, or BackgroundJob static
- Persistent Storage - Redis, SQL Server (including Azure); supports MSMQ, RabbitMQ
- Server - BackgroundJobServer, app.UseHangfireServer; same process, separate server, multiple instances
- Dashboard - Asp.net OWIN app, app.UseHangfireDashboard
- Startup.ConfigureHangfire
- HangfireSimpleInjectorJobActivator
- DemoHangfireJobFilter
- DemoHangfireAuthorizationFilter
- Queue, QueueItem
- BackgroundTask, TaskResult
- GenerateReportTask, SendEmailTask
- ICommander, IRequest, IRequestHandler
- Command.cs - Command, Query, CommandResponse, CommandHandler, PagedList
- JsonRpcController - receives /jsonrpc POSTs
- Commander - maintains dictionary of commands by name
- Routemeister - calls command handlers by command type
- UserContext - current UserId (Asp.net Identity)
- IDb - generic database functions (EF)
- Startup - app configuration (Hangfire & SignalR use OWIN)
- DemoConfig - strongly-typed AppSettings class
- Pusher - sends notifications to client (SignalR)
- Identity - ConfigureAuthentication, User, LoginUser, LogoutUser, PasswordHash
- Controllers - HomeController, JsonRpcController, PushHub
- Views - Index, Login, _Layout, _Navbar, _CommandResponse
- Custom tags - supports attributes, expressions, scripts, styles
- Mixins: shared, global
- Nested tags
- Transclusion - <yield />
- Supports server-side rendering
- Virtual tag, data-is attribute
- riot.mount("*")
- <CommandButton command="RequeueItems" data={ {ItemIds:selectedTasks} } />
- if={ hasPrevious }, show={ truthy }, hide={ truthy }
- each={ item in result.Items }
- ListQueueItems: ref="Log"
- onclick={ nextClicked }
- Tags - CommandButton, ListQueueItems, Pager, SelectAll
- Lifecycle: before-mount, mount, update, updated, before-unmount, unmount, *
- No self-closing in html
- Classes: string, shorthand, objects
- Styles: string, objects
- Simple debugging
- RiotHangfireDemo.Tests
- TestQueryQueueItems (Xunit, Shouldly, FakeItEasy)