Skip to content

Messages ​

One page for every option

This page covers every choice of --Persistence, --Auth, --IncludeTests and --Aspire. A label says which options a part is for; the copy in your app's docs/ folder has only yours. ApiHost stands for your app's name.

The messages ApiHost handles in the background, and the handlers that handle them. A message is sent by returning it from an endpoint or a handler (or with IMessageBus), stored with the data in the same transaction, and handled from a durable queue: see how messages are delivered. One message can have several handlers, one per feature that reacts to it.

Handlers ​

MessageHandlerNotes
With accounts AccountDeletedDeleteFilesOfDeletedAccountHandlerA deleted account's files (its picture, and anything else kept under users/{id}/) go with it, through DeleteStoredFiles: see there for why it's a message of its own. Published rather than returned: see DeleteStoredFiles. (PictureCleanup.cs)
With accounts AccountDeletedDeletePreferencesOfDeletedAccountHandlerA deleted account's preferences go with it. (UserPreferences.cs)
With accounts, without organisations AccountDeletedDeleteTodosOfDeletedAccountHandlerDeletes a user's Todos when they delete their account (AccountDeleted is published by Features/Account/DeleteAccountEndpoint.cs). Runs in the background through Wolverine's durable outbox; the changes are saved automatically (AutoApplyTransactions). Wolverine finds handlers by name: the class name must end in "Handler" (or "Consumer"). (DeleteTodosOfDeletedAccountHandler.cs)
With organisations AccountDeletedLeaveOrganisationsOfDeletedAccountHandlerWhen a user deletes their account, they leave each of their organisations. One they were the only member of is deleted, with its data (the store publishes OrganisationDeleted for its tenant, in the same transaction). (LeaveOrganisationsOfDeletedAccountHandler.cs)
With accounts AccountDeletedNotificationHandlerA deleted account's notifications go with it. (NotificationHandler.cs)
Marten DeleteAttachmentIfUnusedDeleteAttachmentIfUnusedHandlerWith organisations, the message keeps the organisation it was sent in, and Wolverine opens the session for it. (TodoAttachmentEndpoints.cs)
EF Core DeleteAttachmentIfUnusedDeleteAttachmentIfUnusedHandlerWith organisations, the message keeps the organisation it was sent in, and Wolverine opens the DbContext for it. (TodoAttachmentEndpoints.cs)
With accounts DeletePictureIfUnusedDeletePictureIfUnusedHandler(PictureCleanup.cs)
DeleteStoredFilesDeleteStoredFilesHandler(DeleteStoredFiles.cs)
With organisations DeliverWebhookWebhookHandler(WebhookHandler.cs)
With accounts EmailNotificationNotificationHandlerWith a one-click unsubscribe link (the List-Unsubscribe headers mail apps show as a button) and one in the text. Only to a confirmed address. (NotificationHandler.cs)
With organisations IncomingWebhookReceivedIncomingWebhookHandlerWhere received events are handled: replace the logging with the app's own work, switching on the source (and the event's "type" in the body). (IncomingWebhooks.cs)
With organisations OrganisationDeletedDeleteBillingOfDeletedOrganisationHandlerA deleted organisation's subscription is cancelled (it isn't charged again), and its billing account, usage and invoices go with it. The payment provider keeps its own records. (BillingSetup.cs)
With organisations OrganisationDeletedDeleteFilesOfDeletedOrganisationHandlerA deleted organisation's files (its logo, and anything else kept under organisations/{id}/) go with it, through DeleteStoredFiles: see there for why it's a message of its own. Published rather than returned: see DeleteStoredFiles. (OrganisationLogoEndpoints.cs)
With organisations OrganisationDeletedDeleteIntegrationsOfDeletedOrganisationHandlerAn organisation's keys, webhooks and secrets go with it. (IntegrationsSetup.cs)
Marten, with organisations OrganisationDeletedDeleteTodosOfDeletedOrganisationHandlerDeletes a deleted organisation's Todos. The message is sent for that organisation's tenant, so Wolverine opens the session for it and the query only finds its Todos. (DeleteTodosOfDeletedOrganisationHandler.cs)
EF Core, with organisations OrganisationDeletedDeleteTodosOfDeletedOrganisationHandlerDeletes a deleted organisation's Todos. The message is sent for that organisation's tenant, so Wolverine pins the DbContext to it; the explicit filter on TenantId is a second guard. (DeleteTodosOfDeletedOrganisationHandler.cs)
With organisations PaymentEventReceivedPaymentEventHandlerKeeps the organisation's BillingAccount (the app's copy of its billing state) in step with the provider. It reads the subscription again rather than trusting the event's copy, so events that arrive late or out of order can't leave an old state behind. (PaymentEventHandler.cs)
With accounts SendEmailChangeConfirmationAccountEmailHandlerSent to the new address: the email changes only when its owner opens the link. (AccountEmails.cs)
With accounts SendEmailConfirmationAccountEmailHandlerSends the emails. Each handler creates the one-time token itself, when it runs, so no token is ever stored in the message tables. Tokens are checked by the endpoints the links lead to (ConfirmEmailEndpoint, ResetPasswordEndpoint, ConfirmEmailChangeEndpoint, AcceptInvitationEndpoint). Wolverine finds handlers by name: the class name must end in "Handler". (AccountEmails.cs)
With accounts SendInvitationAccountEmailHandlerAn account an admin created, with no password yet: the link lets the person choose one. (AccountEmails.cs)
With accounts SendNotificationNotificationHandlerStores the notification and refreshes the user's open tabs; then emails it, unless they turned that category's emails off. (NotificationHandler.cs)
With organisations SendOrganisationInvitationOrganisationInvitationEmailHandlerSends an invitation email. Like the account emails (Identity/Email/AccountEmails.cs), the token is created when the email is sent, so it's never in Wolverine's message tables; only its hash is stored, on the invitation. Sending again (a new invitation to the same email) gives a new token, and the old link stops working. (OrganisationInvitationEmailHandler.cs)
With accounts SendPasswordResetAccountEmailHandlerSends the emails. Each handler creates the one-time token itself, when it runs, so no token is ever stored in the message tables. Tokens are checked by the endpoints the links lead to (ConfirmEmailEndpoint, ResetPasswordEndpoint, ConfirmEmailChangeEndpoint, AcceptInvitationEndpoint). Wolverine finds handlers by name: the class name must end in "Handler". (AccountEmails.cs)
With accounts SendSecurityNoticeSecurityNoticeHandlerWolverine finds handlers by name: the class name must end in "Handler". (SecurityNotices.cs)
With organisations TodoCompletedTodoCompletedHandlertenantId: the organisation the Todo belongs to; Wolverine carries it on every message. (TodoCompleted.cs)
Without organisations TodoCompletedTodoCompletedHandlerRuns asynchronously, after the endpoint that completed the Todo has returned. Local queues are durable (see Program.cs), so the message is stored by the transactional outbox in the same database transaction as the Todo change: it is never lost if the app stops, and never sent if that transaction rolls back. The returned TodoChanged is cascaded on to the browser over SignalR. Add real follow-up work here too, such as an email, a notification, or an integration call. (TodoCompleted.cs)
With organisations TodoReminderDueTodoReminderDueHandlerRuns when the reminder is due. Nothing happens if the Todo was completed or deleted in the meantime, the member who asked for it has left the organisation, or the organisation's plan no longer includes reminders (it was downgraded); otherwise their open tabs show the reminder. tenantId: the organisation the reminder was scheduled in; Wolverine keeps it on the message. (RemindTodoEndpoint.cs)
Without organisations TodoReminderDueTodoReminderDueHandlerRuns when the reminder is due. Nothing happens if the Todo was completed or deleted in the meantime; otherwise the owner's open tabs show the reminder. (RemindTodoEndpoint.cs)
With organisations WebhookEventRaisedWebhookHandlerAn event: one delivery for each of the organisation's subscriptions that wants it, each sent on its own (so one slow or failing receiver doesn't hold up the others). (WebhookHandler.cs)

Sent to browsers ​

Pushed to the open tabs over SignalR (/api/hub); the client recognises each by its name.

NameMessageNotes
With accounts notification-addedNotificationAddedPushed to the user's open tabs over SignalR, so the header's list refreshes; the client matches on the stable "notification-added" name. (Notification.cs)
todo-changedTodoChangedPushed to browsers over SignalR (see Realtime/AppHub.cs) whenever a Todo is created or completed, so every open tab refreshes its list. The client matches on the stable "todo-changed" name (the CloudEvents "type"), not on the .NET type name. (TodoChanged.cs)
todo-reminderTodoReminderPushed to the browser over SignalR when a reminder is due; the client matches on the stable "todo-reminder" name. (RemindTodo.cs)

Documentation for v0.9.0. Released under the MIT licence.